Mercurial > hg > Game > Cerium
annotate TaskManager/ManyCore/FileMapReduce.h @ 2069:26aa08c9a1de draft default tip
cuda example fix
author | Shinji KONO <kono@ie.u-ryukyu.ac.jp> |
---|---|
date | Sun, 12 Feb 2017 10:04:55 +0900 |
parents | 58a32f966763 |
children |
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 | 7 class FileMapReduce; |
8 | |
9 typedef struct mapReduce { | |
10 struct mapReduce *self; | |
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; |
2063
58a32f966763
add overrap in FileMapReaduce
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
2062
diff
changeset
|
19 long overrap; // block overrap size |
2053 | 20 long task_num; // task count |
21 long remain_task; // remaining task count | |
2048
6796d85f3d6b
remove error
Masataka Kohagura <kohagura@cr.ie.u-ryukyu.ac.jp>
parents:
2047
diff
changeset
|
22 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
|
23 long task_spawned; |
6796d85f3d6b
remove error
Masataka Kohagura <kohagura@cr.ie.u-ryukyu.ac.jp>
parents:
2047
diff
changeset
|
24 unsigned long long *o_data; |
6796d85f3d6b
remove error
Masataka Kohagura <kohagura@cr.ie.u-ryukyu.ac.jp>
parents:
2047
diff
changeset
|
25 long pad; |
6796d85f3d6b
remove error
Masataka Kohagura <kohagura@cr.ie.u-ryukyu.ac.jp>
parents:
2047
diff
changeset
|
26 char *file_mmap; |
6796d85f3d6b
remove error
Masataka Kohagura <kohagura@cr.ie.u-ryukyu.ac.jp>
parents:
2047
diff
changeset
|
27 long file_size; |
6796d85f3d6b
remove error
Masataka Kohagura <kohagura@cr.ie.u-ryukyu.ac.jp>
parents:
2047
diff
changeset
|
28 HTaskPtr t_print; |
2054 | 29 void* global; // generale user data |
2051 | 30 } MapReduce, *MapReducePtr; |
2048
6796d85f3d6b
remove error
Masataka Kohagura <kohagura@cr.ie.u-ryukyu.ac.jp>
parents:
2047
diff
changeset
|
31 |
6796d85f3d6b
remove error
Masataka Kohagura <kohagura@cr.ie.u-ryukyu.ac.jp>
parents:
2047
diff
changeset
|
32 // Read Type |
6796d85f3d6b
remove error
Masataka Kohagura <kohagura@cr.ie.u-ryukyu.ac.jp>
parents:
2047
diff
changeset
|
33 enum { |
6796d85f3d6b
remove error
Masataka Kohagura <kohagura@cr.ie.u-ryukyu.ac.jp>
parents:
2047
diff
changeset
|
34 MY_MMAP, |
6796d85f3d6b
remove error
Masataka Kohagura <kohagura@cr.ie.u-ryukyu.ac.jp>
parents:
2047
diff
changeset
|
35 MY_READ, |
6796d85f3d6b
remove error
Masataka Kohagura <kohagura@cr.ie.u-ryukyu.ac.jp>
parents:
2047
diff
changeset
|
36 BLOCKED_READ, |
6796d85f3d6b
remove error
Masataka Kohagura <kohagura@cr.ie.u-ryukyu.ac.jp>
parents:
2047
diff
changeset
|
37 BLOCKED_MMAP, |
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 |
6796d85f3d6b
remove error
Masataka Kohagura <kohagura@cr.ie.u-ryukyu.ac.jp>
parents:
2047
diff
changeset
|
40 #define DATA_ID 0 |
6796d85f3d6b
remove error
Masataka Kohagura <kohagura@cr.ie.u-ryukyu.ac.jp>
parents:
2047
diff
changeset
|
41 |
2047 | 42 class FileMapReduce { |
2050
26dd777ba95d
add User API
Masataka Kohagura <kohagura@cr.ie.u-ryukyu.ac.jp>
parents:
2048
diff
changeset
|
43 public: |
26dd777ba95d
add User API
Masataka Kohagura <kohagura@cr.ie.u-ryukyu.ac.jp>
parents:
2048
diff
changeset
|
44 /* constructor */ |
2051 | 45 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
|
46 ~FileMapReduce(); |
26dd777ba95d
add User API
Masataka Kohagura <kohagura@cr.ie.u-ryukyu.ac.jp>
parents:
2048
diff
changeset
|
47 |
26dd777ba95d
add User API
Masataka Kohagura <kohagura@cr.ie.u-ryukyu.ac.jp>
parents:
2048
diff
changeset
|
48 /* User API */ |
2051 | 49 void run_start(TaskManager *manager, const char *filename); |
50 void run_tasks(SchedTask *manager, MapReduce *w, int task_count, HTaskPtr t_read, HTaskPtr t_next, int size); | |
51 char* init(int argc, char **argv); | |
2050
26dd777ba95d
add User API
Masataka Kohagura <kohagura@cr.ie.u-ryukyu.ac.jp>
parents:
2048
diff
changeset
|
52 |
26dd777ba95d
add User API
Masataka Kohagura <kohagura@cr.ie.u-ryukyu.ac.jp>
parents:
2048
diff
changeset
|
53 private: |
2051 | 54 void my_read(const char *filename, MapReduce *w, TaskManager *manager); |
55 void my_mmap(const char *filename, MapReduce *w); | |
56 void task_init(void); | |
2050
26dd777ba95d
add User API
Masataka Kohagura <kohagura@cr.ie.u-ryukyu.ac.jp>
parents:
2048
diff
changeset
|
57 |
26dd777ba95d
add User API
Masataka Kohagura <kohagura@cr.ie.u-ryukyu.ac.jp>
parents:
2048
diff
changeset
|
58 /* variable */ |
2051 | 59 int all; |
60 int use_task_array; | |
61 int use_task_creater ; | |
62 int use_compat ; | |
63 int array_task_num ; | |
64 int spe_num ; | |
65 int read_type ; | |
66 int t_exec_num ; | |
67 CPU_TYPE spe_cpu ; | |
68 int TASK_EXEC; | |
69 int TASK_EXEC_DATA_PARALLEL; | |
70 int TASK_PRINT; | |
2053 | 71 public: |
2057 | 72 MapReducePtr w; |
2053 | 73 CPU_TYPE read_spe_cpu; |
2051 | 74 int blocks; |
75 int division; // in Kbyte | |
2053 | 76 int division_out_size; |
2063
58a32f966763
add overrap in FileMapReaduce
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
2062
diff
changeset
|
77 int overrap; |
2051 | 78 int use_iterate; |
79 int task_exec_id; | |
80 int task_print_id; | |
2063
58a32f966763
add overrap in FileMapReaduce
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
2062
diff
changeset
|
81 bool debug; |
2051 | 82 const char *fmp_help_str; |
2048
6796d85f3d6b
remove error
Masataka Kohagura <kohagura@cr.ie.u-ryukyu.ac.jp>
parents:
2047
diff
changeset
|
83 }; |