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
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;
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
030b8efcf357 remove wordCount dependency in FileMapReduce
masa
parents: 2052
diff changeset
20 long task_num; // task count
030b8efcf357 remove wordCount dependency in FileMapReduce
masa
parents: 2052
diff changeset
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
2e7a6f40672f add param(4) in FileMapReduce.cc
masa
parents: 2053
diff changeset
29 void* global; // generale user data
2051
b79a250b4f99 FileMapReduce (no compile error)
masa
parents: 2050
diff changeset
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
de89da997e07 add FileMapReduce
Nozomi
parents:
diff changeset
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
b79a250b4f99 FileMapReduce (no compile error)
masa
parents: 2050
diff changeset
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
b79a250b4f99 FileMapReduce (no compile error)
masa
parents: 2050
diff changeset
49 void run_start(TaskManager *manager, const char *filename);
b79a250b4f99 FileMapReduce (no compile error)
masa
parents: 2050
diff changeset
50 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
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
b79a250b4f99 FileMapReduce (no compile error)
masa
parents: 2050
diff changeset
54 void my_read(const char *filename, MapReduce *w, TaskManager *manager);
b79a250b4f99 FileMapReduce (no compile error)
masa
parents: 2050
diff changeset
55 void my_mmap(const char *filename, MapReduce *w);
b79a250b4f99 FileMapReduce (no compile error)
masa
parents: 2050
diff changeset
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
b79a250b4f99 FileMapReduce (no compile error)
masa
parents: 2050
diff changeset
59 int all;
b79a250b4f99 FileMapReduce (no compile error)
masa
parents: 2050
diff changeset
60 int use_task_array;
b79a250b4f99 FileMapReduce (no compile error)
masa
parents: 2050
diff changeset
61 int use_task_creater ;
b79a250b4f99 FileMapReduce (no compile error)
masa
parents: 2050
diff changeset
62 int use_compat ;
b79a250b4f99 FileMapReduce (no compile error)
masa
parents: 2050
diff changeset
63 int array_task_num ;
b79a250b4f99 FileMapReduce (no compile error)
masa
parents: 2050
diff changeset
64 int spe_num ;
b79a250b4f99 FileMapReduce (no compile error)
masa
parents: 2050
diff changeset
65 int read_type ;
b79a250b4f99 FileMapReduce (no compile error)
masa
parents: 2050
diff changeset
66 int t_exec_num ;
b79a250b4f99 FileMapReduce (no compile error)
masa
parents: 2050
diff changeset
67 CPU_TYPE spe_cpu ;
b79a250b4f99 FileMapReduce (no compile error)
masa
parents: 2050
diff changeset
68 int TASK_EXEC;
b79a250b4f99 FileMapReduce (no compile error)
masa
parents: 2050
diff changeset
69 int TASK_EXEC_DATA_PARALLEL;
b79a250b4f99 FileMapReduce (no compile error)
masa
parents: 2050
diff changeset
70 int TASK_PRINT;
2053
030b8efcf357 remove wordCount dependency in FileMapReduce
masa
parents: 2052
diff changeset
71 public:
2057
432d96650d55 add member variable
masa
parents: 2055
diff changeset
72 MapReducePtr w;
2053
030b8efcf357 remove wordCount dependency in FileMapReduce
masa
parents: 2052
diff changeset
73 CPU_TYPE read_spe_cpu;
2051
b79a250b4f99 FileMapReduce (no compile error)
masa
parents: 2050
diff changeset
74 int blocks;
b79a250b4f99 FileMapReduce (no compile error)
masa
parents: 2050
diff changeset
75 int division; // in Kbyte
2053
030b8efcf357 remove wordCount dependency in FileMapReduce
masa
parents: 2052
diff changeset
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
b79a250b4f99 FileMapReduce (no compile error)
masa
parents: 2050
diff changeset
78 int use_iterate;
b79a250b4f99 FileMapReduce (no compile error)
masa
parents: 2050
diff changeset
79 int task_exec_id;
b79a250b4f99 FileMapReduce (no compile error)
masa
parents: 2050
diff changeset
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
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 };