Mercurial > hg > Game > Cerium
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 |
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; |
2053 | 19 long task_num; // task count |
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 | 28 void* global; // generale user data |
2051 | 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 | 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 | 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 | 51 void run_start(TaskManager *manager, const char *filename); |
52 void run_tasks(SchedTask *manager, MapReduce *w, int task_count, HTaskPtr t_read, HTaskPtr t_next, int size); | |
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 | 56 void my_read(const char *filename, MapReduce *w, TaskManager *manager); |
57 void my_mmap(const char *filename, MapReduce *w); | |
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 | 61 int all; |
62 int use_task_array; | |
63 int use_task_creater ; | |
64 int use_compat ; | |
65 int array_task_num ; | |
66 int spe_num ; | |
67 int read_type ; | |
68 int t_exec_num ; | |
69 CPU_TYPE spe_cpu ; | |
70 int TASK_EXEC; | |
71 int TASK_EXEC_DATA_PARALLEL; | |
72 int TASK_PRINT; | |
2053 | 73 public: |
2057 | 74 MapReducePtr w; |
2053 | 75 CPU_TYPE read_spe_cpu; |
2051 | 76 int blocks; |
77 int division; // in Kbyte | |
2053 | 78 int division_out_size; |
2051 | 79 int use_iterate; |
80 int task_exec_id; | |
81 int task_print_id; | |
82 const char *fmp_help_str; | |
2048
6796d85f3d6b
remove error
Masataka Kohagura <kohagura@cr.ie.u-ryukyu.ac.jp>
parents:
2047
diff
changeset
|
83 }; |