annotate TaskManager/ManyCore/FileMapReduce.h @ 2057:432d96650d55 draft

add member variable
author masa
date Sat, 30 Jan 2016 17:36:42 +0900
parents c62fbe66f549
children ce57fa0495a7
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
2048
6796d85f3d6b remove error
Masataka Kohagura <kohagura@cr.ie.u-ryukyu.ac.jp>
parents: 2047
diff changeset
1 #include <sys/types.h>
6796d85f3d6b remove error
Masataka Kohagura <kohagura@cr.ie.u-ryukyu.ac.jp>
parents: 2047
diff changeset
2
6796d85f3d6b remove error
Masataka Kohagura <kohagura@cr.ie.u-ryukyu.ac.jp>
parents: 2047
diff changeset
3 #include "TaskManager.h"
2050
26dd777ba95d add User API
Masataka Kohagura <kohagura@cr.ie.u-ryukyu.ac.jp>
parents: 2048
diff changeset
4 #include "SchedTask.h"
26dd777ba95d add User API
Masataka Kohagura <kohagura@cr.ie.u-ryukyu.ac.jp>
parents: 2048
diff changeset
5 #include "HTask.h"
2048
6796d85f3d6b remove error
Masataka Kohagura <kohagura@cr.ie.u-ryukyu.ac.jp>
parents: 2047
diff changeset
6
2051
b79a250b4f99 FileMapReduce (no compile error)
masa
parents: 2050
diff changeset
7 class FileMapReduce;
b79a250b4f99 FileMapReduce (no compile error)
masa
parents: 2050
diff changeset
8
b79a250b4f99 FileMapReduce (no compile error)
masa
parents: 2050
diff changeset
9 typedef struct mapReduce {
b79a250b4f99 FileMapReduce (no compile error)
masa
parents: 2050
diff changeset
10 struct mapReduce *self;
b79a250b4f99 FileMapReduce (no compile error)
masa
parents: 2050
diff changeset
11 FileMapReduce *fmp;
2048
6796d85f3d6b remove error
Masataka Kohagura <kohagura@cr.ie.u-ryukyu.ac.jp>
parents: 2047
diff changeset
12 long fd;
6796d85f3d6b remove error
Masataka Kohagura <kohagura@cr.ie.u-ryukyu.ac.jp>
parents: 2047
diff changeset
13 long read_filesize;
6796d85f3d6b remove error
Masataka Kohagura <kohagura@cr.ie.u-ryukyu.ac.jp>
parents: 2047
diff changeset
14 CPU_TYPE read_cpu;
6796d85f3d6b remove error
Masataka Kohagura <kohagura@cr.ie.u-ryukyu.ac.jp>
parents: 2047
diff changeset
15
6796d85f3d6b remove error
Masataka Kohagura <kohagura@cr.ie.u-ryukyu.ac.jp>
parents: 2047
diff changeset
16 long size; // remaining file size
6796d85f3d6b remove error
Masataka Kohagura <kohagura@cr.ie.u-ryukyu.ac.jp>
parents: 2047
diff changeset
17 long division_size; // for each word count task
6796d85f3d6b remove error
Masataka Kohagura <kohagura@cr.ie.u-ryukyu.ac.jp>
parents: 2047
diff changeset
18 long division_out_size;
2053
030b8efcf357 remove wordCount dependency in FileMapReduce
masa
parents: 2052
diff changeset
19 long task_num; // task count
030b8efcf357 remove wordCount dependency in FileMapReduce
masa
parents: 2052
diff changeset
20 long remain_task; // remaining task count
2048
6796d85f3d6b remove error
Masataka Kohagura <kohagura@cr.ie.u-ryukyu.ac.jp>
parents: 2047
diff changeset
21 long task_blocks; // spawn task one at a time
6796d85f3d6b remove error
Masataka Kohagura <kohagura@cr.ie.u-ryukyu.ac.jp>
parents: 2047
diff changeset
22 long task_spawned;
6796d85f3d6b remove error
Masataka Kohagura <kohagura@cr.ie.u-ryukyu.ac.jp>
parents: 2047
diff changeset
23 unsigned long long *o_data;
6796d85f3d6b remove error
Masataka Kohagura <kohagura@cr.ie.u-ryukyu.ac.jp>
parents: 2047
diff changeset
24 long pad;
6796d85f3d6b remove error
Masataka Kohagura <kohagura@cr.ie.u-ryukyu.ac.jp>
parents: 2047
diff changeset
25 char *file_mmap;
6796d85f3d6b remove error
Masataka Kohagura <kohagura@cr.ie.u-ryukyu.ac.jp>
parents: 2047
diff changeset
26 long file_size;
6796d85f3d6b remove error
Masataka Kohagura <kohagura@cr.ie.u-ryukyu.ac.jp>
parents: 2047
diff changeset
27 HTaskPtr t_print;
2054
2e7a6f40672f add param(4) in FileMapReduce.cc
masa
parents: 2053
diff changeset
28 void* global; // generale user data
2051
b79a250b4f99 FileMapReduce (no compile error)
masa
parents: 2050
diff changeset
29 } MapReduce, *MapReducePtr;
2048
6796d85f3d6b remove error
Masataka Kohagura <kohagura@cr.ie.u-ryukyu.ac.jp>
parents: 2047
diff changeset
30
6796d85f3d6b remove error
Masataka Kohagura <kohagura@cr.ie.u-ryukyu.ac.jp>
parents: 2047
diff changeset
31 // Read Type
6796d85f3d6b remove error
Masataka Kohagura <kohagura@cr.ie.u-ryukyu.ac.jp>
parents: 2047
diff changeset
32 enum {
6796d85f3d6b remove error
Masataka Kohagura <kohagura@cr.ie.u-ryukyu.ac.jp>
parents: 2047
diff changeset
33 MY_MMAP,
6796d85f3d6b remove error
Masataka Kohagura <kohagura@cr.ie.u-ryukyu.ac.jp>
parents: 2047
diff changeset
34 MY_READ,
6796d85f3d6b remove error
Masataka Kohagura <kohagura@cr.ie.u-ryukyu.ac.jp>
parents: 2047
diff changeset
35 BLOCKED_READ,
6796d85f3d6b remove error
Masataka Kohagura <kohagura@cr.ie.u-ryukyu.ac.jp>
parents: 2047
diff changeset
36 BLOCKED_MMAP,
6796d85f3d6b remove error
Masataka Kohagura <kohagura@cr.ie.u-ryukyu.ac.jp>
parents: 2047
diff changeset
37 };
6796d85f3d6b remove error
Masataka Kohagura <kohagura@cr.ie.u-ryukyu.ac.jp>
parents: 2047
diff changeset
38
6796d85f3d6b remove error
Masataka Kohagura <kohagura@cr.ie.u-ryukyu.ac.jp>
parents: 2047
diff changeset
39 #define DATA_NUM 16
6796d85f3d6b remove error
Masataka Kohagura <kohagura@cr.ie.u-ryukyu.ac.jp>
parents: 2047
diff changeset
40 #define ADD_NUM 26
6796d85f3d6b remove error
Masataka Kohagura <kohagura@cr.ie.u-ryukyu.ac.jp>
parents: 2047
diff changeset
41
6796d85f3d6b remove error
Masataka Kohagura <kohagura@cr.ie.u-ryukyu.ac.jp>
parents: 2047
diff changeset
42 #define DATA_ID 0
6796d85f3d6b remove error
Masataka Kohagura <kohagura@cr.ie.u-ryukyu.ac.jp>
parents: 2047
diff changeset
43
2047
de89da997e07 add FileMapReduce
Nozomi
parents:
diff changeset
44 class FileMapReduce {
2050
26dd777ba95d add User API
Masataka Kohagura <kohagura@cr.ie.u-ryukyu.ac.jp>
parents: 2048
diff changeset
45 public:
26dd777ba95d add User API
Masataka Kohagura <kohagura@cr.ie.u-ryukyu.ac.jp>
parents: 2048
diff changeset
46 /* constructor */
2051
b79a250b4f99 FileMapReduce (no compile error)
masa
parents: 2050
diff changeset
47 FileMapReduce(TaskManager *manager,int TASK_EXEC,int TASK_EXEC_DATA_PARALLEL,int TASK_PRINT);
2050
26dd777ba95d add User API
Masataka Kohagura <kohagura@cr.ie.u-ryukyu.ac.jp>
parents: 2048
diff changeset
48 ~FileMapReduce();
26dd777ba95d add User API
Masataka Kohagura <kohagura@cr.ie.u-ryukyu.ac.jp>
parents: 2048
diff changeset
49
26dd777ba95d add User API
Masataka Kohagura <kohagura@cr.ie.u-ryukyu.ac.jp>
parents: 2048
diff changeset
50 /* User API */
2051
b79a250b4f99 FileMapReduce (no compile error)
masa
parents: 2050
diff changeset
51 void run_start(TaskManager *manager, const char *filename);
b79a250b4f99 FileMapReduce (no compile error)
masa
parents: 2050
diff changeset
52 void run_tasks(SchedTask *manager, MapReduce *w, int task_count, HTaskPtr t_read, HTaskPtr t_next, int size);
b79a250b4f99 FileMapReduce (no compile error)
masa
parents: 2050
diff changeset
53 char* init(int argc, char **argv);
2050
26dd777ba95d add User API
Masataka Kohagura <kohagura@cr.ie.u-ryukyu.ac.jp>
parents: 2048
diff changeset
54
26dd777ba95d add User API
Masataka Kohagura <kohagura@cr.ie.u-ryukyu.ac.jp>
parents: 2048
diff changeset
55 private:
2051
b79a250b4f99 FileMapReduce (no compile error)
masa
parents: 2050
diff changeset
56 void my_read(const char *filename, MapReduce *w, TaskManager *manager);
b79a250b4f99 FileMapReduce (no compile error)
masa
parents: 2050
diff changeset
57 void my_mmap(const char *filename, MapReduce *w);
b79a250b4f99 FileMapReduce (no compile error)
masa
parents: 2050
diff changeset
58 void task_init(void);
2050
26dd777ba95d add User API
Masataka Kohagura <kohagura@cr.ie.u-ryukyu.ac.jp>
parents: 2048
diff changeset
59
26dd777ba95d add User API
Masataka Kohagura <kohagura@cr.ie.u-ryukyu.ac.jp>
parents: 2048
diff changeset
60 /* variable */
2051
b79a250b4f99 FileMapReduce (no compile error)
masa
parents: 2050
diff changeset
61 int all;
b79a250b4f99 FileMapReduce (no compile error)
masa
parents: 2050
diff changeset
62 int use_task_array;
b79a250b4f99 FileMapReduce (no compile error)
masa
parents: 2050
diff changeset
63 int use_task_creater ;
b79a250b4f99 FileMapReduce (no compile error)
masa
parents: 2050
diff changeset
64 int use_compat ;
b79a250b4f99 FileMapReduce (no compile error)
masa
parents: 2050
diff changeset
65 int array_task_num ;
b79a250b4f99 FileMapReduce (no compile error)
masa
parents: 2050
diff changeset
66 int spe_num ;
b79a250b4f99 FileMapReduce (no compile error)
masa
parents: 2050
diff changeset
67 int read_type ;
b79a250b4f99 FileMapReduce (no compile error)
masa
parents: 2050
diff changeset
68 int t_exec_num ;
b79a250b4f99 FileMapReduce (no compile error)
masa
parents: 2050
diff changeset
69 CPU_TYPE spe_cpu ;
b79a250b4f99 FileMapReduce (no compile error)
masa
parents: 2050
diff changeset
70 int TASK_EXEC;
b79a250b4f99 FileMapReduce (no compile error)
masa
parents: 2050
diff changeset
71 int TASK_EXEC_DATA_PARALLEL;
b79a250b4f99 FileMapReduce (no compile error)
masa
parents: 2050
diff changeset
72 int TASK_PRINT;
2053
030b8efcf357 remove wordCount dependency in FileMapReduce
masa
parents: 2052
diff changeset
73 public:
2057
432d96650d55 add member variable
masa
parents: 2055
diff changeset
74 MapReducePtr w;
2053
030b8efcf357 remove wordCount dependency in FileMapReduce
masa
parents: 2052
diff changeset
75 CPU_TYPE read_spe_cpu;
2051
b79a250b4f99 FileMapReduce (no compile error)
masa
parents: 2050
diff changeset
76 int blocks;
b79a250b4f99 FileMapReduce (no compile error)
masa
parents: 2050
diff changeset
77 int division; // in Kbyte
2053
030b8efcf357 remove wordCount dependency in FileMapReduce
masa
parents: 2052
diff changeset
78 int division_out_size;
2051
b79a250b4f99 FileMapReduce (no compile error)
masa
parents: 2050
diff changeset
79 int use_iterate;
b79a250b4f99 FileMapReduce (no compile error)
masa
parents: 2050
diff changeset
80 int task_exec_id;
b79a250b4f99 FileMapReduce (no compile error)
masa
parents: 2050
diff changeset
81 int task_print_id;
b79a250b4f99 FileMapReduce (no compile error)
masa
parents: 2050
diff changeset
82 const char *fmp_help_str;
2048
6796d85f3d6b remove error
Masataka Kohagura <kohagura@cr.ie.u-ryukyu.ac.jp>
parents: 2047
diff changeset
83 };