annotate example/word_count/main.cc @ 1684:eb3daec80cbb draft

remove simple task creator
author Yuhi TOMARI <yuhi@cr.ie.u-ryukyu.ac.jp>
date Thu, 08 Aug 2013 12:35:26 +0900
parents ff43dc274ec9
children 705f09f646ac
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
1584
Masa <e085726@ie.u-ryukyu.ac.jp>
parents: 1579
diff changeset
1 #include <stdio.h>
393
cb06748ba6cf add word_count
e065725@localhost.localdomain
parents:
diff changeset
2 #include <stdlib.h>
cb06748ba6cf add word_count
e065725@localhost.localdomain
parents:
diff changeset
3 #include <string.h>
cb06748ba6cf add word_count
e065725@localhost.localdomain
parents:
diff changeset
4 #include <sys/mman.h>
cb06748ba6cf add word_count
e065725@localhost.localdomain
parents:
diff changeset
5 #include <sys/types.h>
cb06748ba6cf add word_count
e065725@localhost.localdomain
parents:
diff changeset
6 #include <sys/stat.h>
cb06748ba6cf add word_count
e065725@localhost.localdomain
parents:
diff changeset
7 #include <fcntl.h>
cb06748ba6cf add word_count
e065725@localhost.localdomain
parents:
diff changeset
8 #include <unistd.h>
1544
5c4e3f0d372a many_task add task array
Yuhi TOMARI <yuhi@cr.ie.u-ryukyu.ac.jp>
parents: 1542
diff changeset
9 #include <sys/time.h>
393
cb06748ba6cf add word_count
e065725@localhost.localdomain
parents:
diff changeset
10 #include "TaskManager.h"
946
852ed17d8af1 unify word count examples....
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 797
diff changeset
11 #include "SchedTask.h"
393
cb06748ba6cf add word_count
e065725@localhost.localdomain
parents:
diff changeset
12 #include "Func.h"
946
852ed17d8af1 unify word count examples....
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 797
diff changeset
13 #include "WordCount.h"
393
cb06748ba6cf add word_count
e065725@localhost.localdomain
parents:
diff changeset
14
1268
f0808a329663 find bug
Daichi Toma <amothic@gmail.com>
parents: 1123
diff changeset
15 /* ;TODO
f0808a329663 find bug
Daichi Toma <amothic@gmail.com>
parents: 1123
diff changeset
16 * PS3でCPU数が2以上の時に、あまりが計算されてない
f0808a329663 find bug
Daichi Toma <amothic@gmail.com>
parents: 1123
diff changeset
17 */
f0808a329663 find bug
Daichi Toma <amothic@gmail.com>
parents: 1123
diff changeset
18
400
984e7890db0c Fix examples.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 394
diff changeset
19 extern void task_init();
1544
5c4e3f0d372a many_task add task array
Yuhi TOMARI <yuhi@cr.ie.u-ryukyu.ac.jp>
parents: 1542
diff changeset
20 void TMend(TaskManager *);
5c4e3f0d372a many_task add task array
Yuhi TOMARI <yuhi@cr.ie.u-ryukyu.ac.jp>
parents: 1542
diff changeset
21 static double st_time;
5c4e3f0d372a many_task add task array
Yuhi TOMARI <yuhi@cr.ie.u-ryukyu.ac.jp>
parents: 1542
diff changeset
22 static double ed_time;
946
852ed17d8af1 unify word count examples....
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 797
diff changeset
23 int all = 0;
852ed17d8af1 unify word count examples....
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 797
diff changeset
24 int use_task_array = 1;
1039
e8ef7f5f22f6 add TaskCreater test funciton..
yutaka@localhost.localdomain
parents: 1021
diff changeset
25 int use_task_creater = 0;
946
852ed17d8af1 unify word count examples....
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 797
diff changeset
26 int use_compat = 0;
967
daab1b74b32d add anum option in WordCount
Yutaka Kinjyo <yutaka@cr.ie.u-ryukyu.ac.jp>
parents: 950
diff changeset
27 int array_task_num = 8;
970
1a4849b2acad change pipeline and TaskArray fast
Yutaka Kinjyo <yutaka@cr.ie.u-ryukyu.ac.jp>
parents: 968
diff changeset
28 int spe_num = 1;
1538
fac06524090b add gpu task wordcount. But not work print
Yuhi TOMARI <yuhi@cr.ie.u-ryukyu.ac.jp>
parents: 1351
diff changeset
29 CPU_TYPE spe_cpu = SPE_ANY;
1679
ff43dc274ec9 word_count fix for GPU
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 1678
diff changeset
30 const char *usr_help_str = "Usage: ./word_count [-a -c -s] [-cpu spe_num] [-g] [-file filename]\n";
1542
9ccfdc408d51 fix gpu word count.but not count line num.
Yuhi TOMARI <yuhi@cr.ie.u-ryukyu.ac.jp>
parents: 1538
diff changeset
31
1544
5c4e3f0d372a many_task add task array
Yuhi TOMARI <yuhi@cr.ie.u-ryukyu.ac.jp>
parents: 1542
diff changeset
32 static double
5c4e3f0d372a many_task add task array
Yuhi TOMARI <yuhi@cr.ie.u-ryukyu.ac.jp>
parents: 1542
diff changeset
33 getTime() {
5c4e3f0d372a many_task add task array
Yuhi TOMARI <yuhi@cr.ie.u-ryukyu.ac.jp>
parents: 1542
diff changeset
34 struct timeval tv;
5c4e3f0d372a many_task add task array
Yuhi TOMARI <yuhi@cr.ie.u-ryukyu.ac.jp>
parents: 1542
diff changeset
35 gettimeofday(&tv, NULL);
5c4e3f0d372a many_task add task array
Yuhi TOMARI <yuhi@cr.ie.u-ryukyu.ac.jp>
parents: 1542
diff changeset
36 return tv.tv_sec + (double)tv.tv_usec*1e-6;
5c4e3f0d372a many_task add task array
Yuhi TOMARI <yuhi@cr.ie.u-ryukyu.ac.jp>
parents: 1542
diff changeset
37 }
5c4e3f0d372a many_task add task array
Yuhi TOMARI <yuhi@cr.ie.u-ryukyu.ac.jp>
parents: 1542
diff changeset
38
393
cb06748ba6cf add word_count
e065725@localhost.localdomain
parents:
diff changeset
39 typedef struct {
cb06748ba6cf add word_count
e065725@localhost.localdomain
parents:
diff changeset
40 caddr_t file_mmap;
cb06748ba6cf add word_count
e065725@localhost.localdomain
parents:
diff changeset
41 off_t size;
cb06748ba6cf add word_count
e065725@localhost.localdomain
parents:
diff changeset
42 } st_mmap_t;
cb06748ba6cf add word_count
e065725@localhost.localdomain
parents:
diff changeset
43
cb06748ba6cf add word_count
e065725@localhost.localdomain
parents:
diff changeset
44 /*与えられたsizeをfix_byte_sizeの倍数にする(丸め込むっていうのかな?)*/
946
852ed17d8af1 unify word count examples....
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 797
diff changeset
45 static int
393
cb06748ba6cf add word_count
e065725@localhost.localdomain
parents:
diff changeset
46 fix_byte(int size,int fix_byte_size)
cb06748ba6cf add word_count
e065725@localhost.localdomain
parents:
diff changeset
47 {
cb06748ba6cf add word_count
e065725@localhost.localdomain
parents:
diff changeset
48 size = (size/fix_byte_size)*fix_byte_size + ((size%fix_byte_size)!= 0)*fix_byte_size;
1538
fac06524090b add gpu task wordcount. But not work print
Yuhi TOMARI <yuhi@cr.ie.u-ryukyu.ac.jp>
parents: 1351
diff changeset
49
393
cb06748ba6cf add word_count
e065725@localhost.localdomain
parents:
diff changeset
50 return size;
cb06748ba6cf add word_count
e065725@localhost.localdomain
parents:
diff changeset
51 }
cb06748ba6cf add word_count
e065725@localhost.localdomain
parents:
diff changeset
52
cb06748ba6cf add word_count
e065725@localhost.localdomain
parents:
diff changeset
53
946
852ed17d8af1 unify word count examples....
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 797
diff changeset
54 static st_mmap_t
393
cb06748ba6cf add word_count
e065725@localhost.localdomain
parents:
diff changeset
55 my_mmap(char *filename)
cb06748ba6cf add word_count
e065725@localhost.localdomain
parents:
diff changeset
56 {
cb06748ba6cf add word_count
e065725@localhost.localdomain
parents:
diff changeset
57
cb06748ba6cf add word_count
e065725@localhost.localdomain
parents:
diff changeset
58 /*マッピングだよ!*/
cb06748ba6cf add word_count
e065725@localhost.localdomain
parents:
diff changeset
59 int fd = -1;
cb06748ba6cf add word_count
e065725@localhost.localdomain
parents:
diff changeset
60 int map = MAP_PRIVATE;
cb06748ba6cf add word_count
e065725@localhost.localdomain
parents:
diff changeset
61 st_mmap_t st_mmap;
cb06748ba6cf add word_count
e065725@localhost.localdomain
parents:
diff changeset
62 struct stat sb;
1538
fac06524090b add gpu task wordcount. But not work print
Yuhi TOMARI <yuhi@cr.ie.u-ryukyu.ac.jp>
parents: 1351
diff changeset
63
393
cb06748ba6cf add word_count
e065725@localhost.localdomain
parents:
diff changeset
64 if ((fd=open(filename,O_RDONLY,0666))==0) {
1538
fac06524090b add gpu task wordcount. But not work print
Yuhi TOMARI <yuhi@cr.ie.u-ryukyu.ac.jp>
parents: 1351
diff changeset
65 fprintf(stderr,"can't open %s\n",filename);
393
cb06748ba6cf add word_count
e065725@localhost.localdomain
parents:
diff changeset
66 }
1538
fac06524090b add gpu task wordcount. But not work print
Yuhi TOMARI <yuhi@cr.ie.u-ryukyu.ac.jp>
parents: 1351
diff changeset
67
393
cb06748ba6cf add word_count
e065725@localhost.localdomain
parents:
diff changeset
68 if (fstat(fd,&sb)) {
1538
fac06524090b add gpu task wordcount. But not work print
Yuhi TOMARI <yuhi@cr.ie.u-ryukyu.ac.jp>
parents: 1351
diff changeset
69 fprintf(stderr,"can't fstat %s\n",filename);
393
cb06748ba6cf add word_count
e065725@localhost.localdomain
parents:
diff changeset
70 }
cb06748ba6cf add word_count
e065725@localhost.localdomain
parents:
diff changeset
71
cb06748ba6cf add word_count
e065725@localhost.localdomain
parents:
diff changeset
72 printf("file size %d\n",(int)sb.st_size);
1538
fac06524090b add gpu task wordcount. But not work print
Yuhi TOMARI <yuhi@cr.ie.u-ryukyu.ac.jp>
parents: 1351
diff changeset
73
393
cb06748ba6cf add word_count
e065725@localhost.localdomain
parents:
diff changeset
74 /*sizeをページングサイズの倍数にあわせる*/
cb06748ba6cf add word_count
e065725@localhost.localdomain
parents:
diff changeset
75 st_mmap.size = fix_byte(sb.st_size,4096);
cb06748ba6cf add word_count
e065725@localhost.localdomain
parents:
diff changeset
76
394
bc2012726a51 debug word_count
e065725@localhost.localdomain
parents: 393
diff changeset
77 printf("fix 4096byte file size %d\n",(int)st_mmap.size);
393
cb06748ba6cf add word_count
e065725@localhost.localdomain
parents:
diff changeset
78
cb06748ba6cf add word_count
e065725@localhost.localdomain
parents:
diff changeset
79 st_mmap.file_mmap = (char*)mmap(NULL,st_mmap.size,PROT_READ,map,fd,(off_t)0);
cb06748ba6cf add word_count
e065725@localhost.localdomain
parents:
diff changeset
80 if (st_mmap.file_mmap == (caddr_t)-1) {
1538
fac06524090b add gpu task wordcount. But not work print
Yuhi TOMARI <yuhi@cr.ie.u-ryukyu.ac.jp>
parents: 1351
diff changeset
81 fprintf(stderr,"Can't mmap file\n");
fac06524090b add gpu task wordcount. But not work print
Yuhi TOMARI <yuhi@cr.ie.u-ryukyu.ac.jp>
parents: 1351
diff changeset
82 perror(NULL);
fac06524090b add gpu task wordcount. But not work print
Yuhi TOMARI <yuhi@cr.ie.u-ryukyu.ac.jp>
parents: 1351
diff changeset
83 exit(0);
393
cb06748ba6cf add word_count
e065725@localhost.localdomain
parents:
diff changeset
84 }
cb06748ba6cf add word_count
e065725@localhost.localdomain
parents:
diff changeset
85
cb06748ba6cf add word_count
e065725@localhost.localdomain
parents:
diff changeset
86 return st_mmap;
cb06748ba6cf add word_count
e065725@localhost.localdomain
parents:
diff changeset
87
cb06748ba6cf add word_count
e065725@localhost.localdomain
parents:
diff changeset
88 }
cb06748ba6cf add word_count
e065725@localhost.localdomain
parents:
diff changeset
89
946
852ed17d8af1 unify word count examples....
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 797
diff changeset
90 static void
1538
fac06524090b add gpu task wordcount. But not work print
Yuhi TOMARI <yuhi@cr.ie.u-ryukyu.ac.jp>
parents: 1351
diff changeset
91 run_tasks(SchedTask *manager, WordCount *w, int task_count, HTaskPtr t_next, int size)
946
852ed17d8af1 unify word count examples....
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 797
diff changeset
92 {
1538
fac06524090b add gpu task wordcount. But not work print
Yuhi TOMARI <yuhi@cr.ie.u-ryukyu.ac.jp>
parents: 1351
diff changeset
93
1542
9ccfdc408d51 fix gpu word count.but not count line num.
Yuhi TOMARI <yuhi@cr.ie.u-ryukyu.ac.jp>
parents: 1538
diff changeset
94 if (task_count < array_task_num) {
9ccfdc408d51 fix gpu word count.but not count line num.
Yuhi TOMARI <yuhi@cr.ie.u-ryukyu.ac.jp>
parents: 1538
diff changeset
95 array_task_num = task_count;
9ccfdc408d51 fix gpu word count.but not count line num.
Yuhi TOMARI <yuhi@cr.ie.u-ryukyu.ac.jp>
parents: 1538
diff changeset
96 if (task_count<=0) return;
9ccfdc408d51 fix gpu word count.but not count line num.
Yuhi TOMARI <yuhi@cr.ie.u-ryukyu.ac.jp>
parents: 1538
diff changeset
97 }
9ccfdc408d51 fix gpu word count.but not count line num.
Yuhi TOMARI <yuhi@cr.ie.u-ryukyu.ac.jp>
parents: 1538
diff changeset
98
9ccfdc408d51 fix gpu word count.but not count line num.
Yuhi TOMARI <yuhi@cr.ie.u-ryukyu.ac.jp>
parents: 1538
diff changeset
99 if (use_task_array) {
1039
e8ef7f5f22f6 add TaskCreater test funciton..
yutaka@localhost.localdomain
parents: 1021
diff changeset
100
1542
9ccfdc408d51 fix gpu word count.but not count line num.
Yuhi TOMARI <yuhi@cr.ie.u-ryukyu.ac.jp>
parents: 1538
diff changeset
101 int spl = spe_num * array_task_num;
9ccfdc408d51 fix gpu word count.but not count line num.
Yuhi TOMARI <yuhi@cr.ie.u-ryukyu.ac.jp>
parents: 1538
diff changeset
102 int loop = (task_count + spl - 1) / spl;
9ccfdc408d51 fix gpu word count.but not count line num.
Yuhi TOMARI <yuhi@cr.ie.u-ryukyu.ac.jp>
parents: 1538
diff changeset
103
9ccfdc408d51 fix gpu word count.but not count line num.
Yuhi TOMARI <yuhi@cr.ie.u-ryukyu.ac.jp>
parents: 1538
diff changeset
104 for (int i = 0; i < loop; i += 1) {
970
1a4849b2acad change pipeline and TaskArray fast
Yutaka Kinjyo <yutaka@cr.ie.u-ryukyu.ac.jp>
parents: 968
diff changeset
105
1542
9ccfdc408d51 fix gpu word count.but not count line num.
Yuhi TOMARI <yuhi@cr.ie.u-ryukyu.ac.jp>
parents: 1538
diff changeset
106 if (spl > w->task_num) {
9ccfdc408d51 fix gpu word count.but not count line num.
Yuhi TOMARI <yuhi@cr.ie.u-ryukyu.ac.jp>
parents: 1538
diff changeset
107 if (w->task_num >= spe_num) {
9ccfdc408d51 fix gpu word count.but not count line num.
Yuhi TOMARI <yuhi@cr.ie.u-ryukyu.ac.jp>
parents: 1538
diff changeset
108 array_task_num = w->task_num / spe_num;
9ccfdc408d51 fix gpu word count.but not count line num.
Yuhi TOMARI <yuhi@cr.ie.u-ryukyu.ac.jp>
parents: 1538
diff changeset
109 } else {
970
1a4849b2acad change pipeline and TaskArray fast
Yutaka Kinjyo <yutaka@cr.ie.u-ryukyu.ac.jp>
parents: 968
diff changeset
110
1542
9ccfdc408d51 fix gpu word count.but not count line num.
Yuhi TOMARI <yuhi@cr.ie.u-ryukyu.ac.jp>
parents: 1538
diff changeset
111 int task_num = w->task_num;
972
Yutaka Kinjyo <yutaka@cr.ie.u-ryukyu.ac.jp>
parents: 970
diff changeset
112
1542
9ccfdc408d51 fix gpu word count.but not count line num.
Yuhi TOMARI <yuhi@cr.ie.u-ryukyu.ac.jp>
parents: 1538
diff changeset
113 for (int j = 0; j < task_num; j++) {
9ccfdc408d51 fix gpu word count.but not count line num.
Yuhi TOMARI <yuhi@cr.ie.u-ryukyu.ac.jp>
parents: 1538
diff changeset
114 HTask *h_exec = 0;
1677
3a57dd6e4cb5 minor fix word count
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 1584
diff changeset
115 int a = w->task_spwaned++;
972
Yutaka Kinjyo <yutaka@cr.ie.u-ryukyu.ac.jp>
parents: 970
diff changeset
116
1542
9ccfdc408d51 fix gpu word count.but not count line num.
Yuhi TOMARI <yuhi@cr.ie.u-ryukyu.ac.jp>
parents: 1538
diff changeset
117 if (w->size < size) size = w->size;
972
Yutaka Kinjyo <yutaka@cr.ie.u-ryukyu.ac.jp>
parents: 970
diff changeset
118
1542
9ccfdc408d51 fix gpu word count.but not count line num.
Yuhi TOMARI <yuhi@cr.ie.u-ryukyu.ac.jp>
parents: 1538
diff changeset
119 h_exec = manager->create_task(TASK_EXEC,
1677
3a57dd6e4cb5 minor fix word count
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 1584
diff changeset
120 (memaddr)(w->file_mmap + a*w->division_size), size,
1542
9ccfdc408d51 fix gpu word count.but not count line num.
Yuhi TOMARI <yuhi@cr.ie.u-ryukyu.ac.jp>
parents: 1538
diff changeset
121 (memaddr)(w->o_data + i*w->out_size), w->division_out_size);
972
Yutaka Kinjyo <yutaka@cr.ie.u-ryukyu.ac.jp>
parents: 970
diff changeset
122
1542
9ccfdc408d51 fix gpu word count.but not count line num.
Yuhi TOMARI <yuhi@cr.ie.u-ryukyu.ac.jp>
parents: 1538
diff changeset
123 if (all) {
9ccfdc408d51 fix gpu word count.but not count line num.
Yuhi TOMARI <yuhi@cr.ie.u-ryukyu.ac.jp>
parents: 1538
diff changeset
124 w->t_print->wait_for(h_exec);
9ccfdc408d51 fix gpu word count.but not count line num.
Yuhi TOMARI <yuhi@cr.ie.u-ryukyu.ac.jp>
parents: 1538
diff changeset
125 } else {
9ccfdc408d51 fix gpu word count.but not count line num.
Yuhi TOMARI <yuhi@cr.ie.u-ryukyu.ac.jp>
parents: 1538
diff changeset
126 t_next->wait_for(h_exec);
9ccfdc408d51 fix gpu word count.but not count line num.
Yuhi TOMARI <yuhi@cr.ie.u-ryukyu.ac.jp>
parents: 1538
diff changeset
127 }
9ccfdc408d51 fix gpu word count.but not count line num.
Yuhi TOMARI <yuhi@cr.ie.u-ryukyu.ac.jp>
parents: 1538
diff changeset
128
9ccfdc408d51 fix gpu word count.but not count line num.
Yuhi TOMARI <yuhi@cr.ie.u-ryukyu.ac.jp>
parents: 1538
diff changeset
129 h_exec->set_cpu(spe_cpu);
9ccfdc408d51 fix gpu word count.but not count line num.
Yuhi TOMARI <yuhi@cr.ie.u-ryukyu.ac.jp>
parents: 1538
diff changeset
130 h_exec->spawn();
1538
fac06524090b add gpu task wordcount. But not work print
Yuhi TOMARI <yuhi@cr.ie.u-ryukyu.ac.jp>
parents: 1351
diff changeset
131
1542
9ccfdc408d51 fix gpu word count.but not count line num.
Yuhi TOMARI <yuhi@cr.ie.u-ryukyu.ac.jp>
parents: 1538
diff changeset
132 w->size -= size;
9ccfdc408d51 fix gpu word count.but not count line num.
Yuhi TOMARI <yuhi@cr.ie.u-ryukyu.ac.jp>
parents: 1538
diff changeset
133 if (w->size == 0) break;
9ccfdc408d51 fix gpu word count.but not count line num.
Yuhi TOMARI <yuhi@cr.ie.u-ryukyu.ac.jp>
parents: 1538
diff changeset
134 w->task_num--;
972
Yutaka Kinjyo <yutaka@cr.ie.u-ryukyu.ac.jp>
parents: 970
diff changeset
135
1542
9ccfdc408d51 fix gpu word count.but not count line num.
Yuhi TOMARI <yuhi@cr.ie.u-ryukyu.ac.jp>
parents: 1538
diff changeset
136 }
9ccfdc408d51 fix gpu word count.but not count line num.
Yuhi TOMARI <yuhi@cr.ie.u-ryukyu.ac.jp>
parents: 1538
diff changeset
137
9ccfdc408d51 fix gpu word count.but not count line num.
Yuhi TOMARI <yuhi@cr.ie.u-ryukyu.ac.jp>
parents: 1538
diff changeset
138 return;
9ccfdc408d51 fix gpu word count.but not count line num.
Yuhi TOMARI <yuhi@cr.ie.u-ryukyu.ac.jp>
parents: 1538
diff changeset
139 }
1538
fac06524090b add gpu task wordcount. But not work print
Yuhi TOMARI <yuhi@cr.ie.u-ryukyu.ac.jp>
parents: 1351
diff changeset
140 }
fac06524090b add gpu task wordcount. But not work print
Yuhi TOMARI <yuhi@cr.ie.u-ryukyu.ac.jp>
parents: 1351
diff changeset
141
1544
5c4e3f0d372a many_task add task array
Yuhi TOMARI <yuhi@cr.ie.u-ryukyu.ac.jp>
parents: 1542
diff changeset
142 // ここから
1542
9ccfdc408d51 fix gpu word count.but not count line num.
Yuhi TOMARI <yuhi@cr.ie.u-ryukyu.ac.jp>
parents: 1538
diff changeset
143 HTask **task_array = (HTask**)manager->allocate(sizeof(HTask*)*spe_num);
9ccfdc408d51 fix gpu word count.but not count line num.
Yuhi TOMARI <yuhi@cr.ie.u-ryukyu.ac.jp>
parents: 1538
diff changeset
144 Task **t_exec = (Task**)manager->allocate(sizeof(Task*)*spe_num);
972
Yutaka Kinjyo <yutaka@cr.ie.u-ryukyu.ac.jp>
parents: 970
diff changeset
145
1542
9ccfdc408d51 fix gpu word count.but not count line num.
Yuhi TOMARI <yuhi@cr.ie.u-ryukyu.ac.jp>
parents: 1538
diff changeset
146 for (int k = 0; k < spe_num; k++) {
9ccfdc408d51 fix gpu word count.but not count line num.
Yuhi TOMARI <yuhi@cr.ie.u-ryukyu.ac.jp>
parents: 1538
diff changeset
147 task_array[k] = manager->create_task_array(TASK_EXEC,array_task_num,1,1,1);
9ccfdc408d51 fix gpu word count.but not count line num.
Yuhi TOMARI <yuhi@cr.ie.u-ryukyu.ac.jp>
parents: 1538
diff changeset
148 t_exec[k] = 0;
9ccfdc408d51 fix gpu word count.but not count line num.
Yuhi TOMARI <yuhi@cr.ie.u-ryukyu.ac.jp>
parents: 1538
diff changeset
149 if (all) {
9ccfdc408d51 fix gpu word count.but not count line num.
Yuhi TOMARI <yuhi@cr.ie.u-ryukyu.ac.jp>
parents: 1538
diff changeset
150 w->t_print->wait_for(task_array[k]);
9ccfdc408d51 fix gpu word count.but not count line num.
Yuhi TOMARI <yuhi@cr.ie.u-ryukyu.ac.jp>
parents: 1538
diff changeset
151 } else {
9ccfdc408d51 fix gpu word count.but not count line num.
Yuhi TOMARI <yuhi@cr.ie.u-ryukyu.ac.jp>
parents: 1538
diff changeset
152 t_next->wait_for(task_array[k]);
9ccfdc408d51 fix gpu word count.but not count line num.
Yuhi TOMARI <yuhi@cr.ie.u-ryukyu.ac.jp>
parents: 1538
diff changeset
153 }
9ccfdc408d51 fix gpu word count.but not count line num.
Yuhi TOMARI <yuhi@cr.ie.u-ryukyu.ac.jp>
parents: 1538
diff changeset
154 }
1538
fac06524090b add gpu task wordcount. But not work print
Yuhi TOMARI <yuhi@cr.ie.u-ryukyu.ac.jp>
parents: 1351
diff changeset
155
1542
9ccfdc408d51 fix gpu word count.but not count line num.
Yuhi TOMARI <yuhi@cr.ie.u-ryukyu.ac.jp>
parents: 1538
diff changeset
156 for (int j = 0; j < array_task_num; j++) {
9ccfdc408d51 fix gpu word count.but not count line num.
Yuhi TOMARI <yuhi@cr.ie.u-ryukyu.ac.jp>
parents: 1538
diff changeset
157 for (int k = 0; k < spe_num; k++) {
9ccfdc408d51 fix gpu word count.but not count line num.
Yuhi TOMARI <yuhi@cr.ie.u-ryukyu.ac.jp>
parents: 1538
diff changeset
158
9ccfdc408d51 fix gpu word count.but not count line num.
Yuhi TOMARI <yuhi@cr.ie.u-ryukyu.ac.jp>
parents: 1538
diff changeset
159 int a = w->task_spwaned++;
1544
5c4e3f0d372a many_task add task array
Yuhi TOMARI <yuhi@cr.ie.u-ryukyu.ac.jp>
parents: 1542
diff changeset
160
1542
9ccfdc408d51 fix gpu word count.but not count line num.
Yuhi TOMARI <yuhi@cr.ie.u-ryukyu.ac.jp>
parents: 1538
diff changeset
161 if (w->size < size) size = w->size;
1544
5c4e3f0d372a many_task add task array
Yuhi TOMARI <yuhi@cr.ie.u-ryukyu.ac.jp>
parents: 1542
diff changeset
162 int length = size/sizeof(char);
1538
fac06524090b add gpu task wordcount. But not work print
Yuhi TOMARI <yuhi@cr.ie.u-ryukyu.ac.jp>
parents: 1351
diff changeset
163
1542
9ccfdc408d51 fix gpu word count.but not count line num.
Yuhi TOMARI <yuhi@cr.ie.u-ryukyu.ac.jp>
parents: 1538
diff changeset
164 t_exec[k] = task_array[k]->next_task_array(TASK_EXEC,t_exec[k]);
9ccfdc408d51 fix gpu word count.but not count line num.
Yuhi TOMARI <yuhi@cr.ie.u-ryukyu.ac.jp>
parents: 1538
diff changeset
165 t_exec[k]->set_param(0,(memaddr)length);
9ccfdc408d51 fix gpu word count.but not count line num.
Yuhi TOMARI <yuhi@cr.ie.u-ryukyu.ac.jp>
parents: 1538
diff changeset
166 t_exec[k]->set_inData(0,w->file_mmap + a*w->division_size, size);
9ccfdc408d51 fix gpu word count.but not count line num.
Yuhi TOMARI <yuhi@cr.ie.u-ryukyu.ac.jp>
parents: 1538
diff changeset
167 t_exec[k]->set_outData(0,w->o_data + a*w->out_size, w->division_out_size);
1538
fac06524090b add gpu task wordcount. But not work print
Yuhi TOMARI <yuhi@cr.ie.u-ryukyu.ac.jp>
parents: 1351
diff changeset
168
1542
9ccfdc408d51 fix gpu word count.but not count line num.
Yuhi TOMARI <yuhi@cr.ie.u-ryukyu.ac.jp>
parents: 1538
diff changeset
169 w->size -= size;
9ccfdc408d51 fix gpu word count.but not count line num.
Yuhi TOMARI <yuhi@cr.ie.u-ryukyu.ac.jp>
parents: 1538
diff changeset
170 w->task_num--;
9ccfdc408d51 fix gpu word count.but not count line num.
Yuhi TOMARI <yuhi@cr.ie.u-ryukyu.ac.jp>
parents: 1538
diff changeset
171 }
9ccfdc408d51 fix gpu word count.but not count line num.
Yuhi TOMARI <yuhi@cr.ie.u-ryukyu.ac.jp>
parents: 1538
diff changeset
172 }
1538
fac06524090b add gpu task wordcount. But not work print
Yuhi TOMARI <yuhi@cr.ie.u-ryukyu.ac.jp>
parents: 1351
diff changeset
173
1542
9ccfdc408d51 fix gpu word count.but not count line num.
Yuhi TOMARI <yuhi@cr.ie.u-ryukyu.ac.jp>
parents: 1538
diff changeset
174 for (int k = 0; k < spe_num; k++) {
9ccfdc408d51 fix gpu word count.but not count line num.
Yuhi TOMARI <yuhi@cr.ie.u-ryukyu.ac.jp>
parents: 1538
diff changeset
175 task_array[k]->spawn_task_array(t_exec[k]->next());
9ccfdc408d51 fix gpu word count.but not count line num.
Yuhi TOMARI <yuhi@cr.ie.u-ryukyu.ac.jp>
parents: 1538
diff changeset
176 task_array[k]->set_cpu(spe_cpu);
9ccfdc408d51 fix gpu word count.but not count line num.
Yuhi TOMARI <yuhi@cr.ie.u-ryukyu.ac.jp>
parents: 1538
diff changeset
177 task_array[k]->spawn();
9ccfdc408d51 fix gpu word count.but not count line num.
Yuhi TOMARI <yuhi@cr.ie.u-ryukyu.ac.jp>
parents: 1538
diff changeset
178 }
1677
3a57dd6e4cb5 minor fix word count
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 1584
diff changeset
179 // free task_array and t_exec !!!
1538
fac06524090b add gpu task wordcount. But not work print
Yuhi TOMARI <yuhi@cr.ie.u-ryukyu.ac.jp>
parents: 1351
diff changeset
180
1542
9ccfdc408d51 fix gpu word count.but not count line num.
Yuhi TOMARI <yuhi@cr.ie.u-ryukyu.ac.jp>
parents: 1538
diff changeset
181 }
9ccfdc408d51 fix gpu word count.but not count line num.
Yuhi TOMARI <yuhi@cr.ie.u-ryukyu.ac.jp>
parents: 1538
diff changeset
182
9ccfdc408d51 fix gpu word count.but not count line num.
Yuhi TOMARI <yuhi@cr.ie.u-ryukyu.ac.jp>
parents: 1538
diff changeset
183 return;
1538
fac06524090b add gpu task wordcount. But not work print
Yuhi TOMARI <yuhi@cr.ie.u-ryukyu.ac.jp>
parents: 1351
diff changeset
184
970
1a4849b2acad change pipeline and TaskArray fast
Yutaka Kinjyo <yutaka@cr.ie.u-ryukyu.ac.jp>
parents: 968
diff changeset
185 }
1a4849b2acad change pipeline and TaskArray fast
Yutaka Kinjyo <yutaka@cr.ie.u-ryukyu.ac.jp>
parents: 968
diff changeset
186
1a4849b2acad change pipeline and TaskArray fast
Yutaka Kinjyo <yutaka@cr.ie.u-ryukyu.ac.jp>
parents: 968
diff changeset
187
1542
9ccfdc408d51 fix gpu word count.but not count line num.
Yuhi TOMARI <yuhi@cr.ie.u-ryukyu.ac.jp>
parents: 1538
diff changeset
188 for (int i = 0; i < task_count; i += array_task_num) {
970
1a4849b2acad change pipeline and TaskArray fast
Yutaka Kinjyo <yutaka@cr.ie.u-ryukyu.ac.jp>
parents: 968
diff changeset
189
1542
9ccfdc408d51 fix gpu word count.but not count line num.
Yuhi TOMARI <yuhi@cr.ie.u-ryukyu.ac.jp>
parents: 1538
diff changeset
190 HTask *h_exec = 0;
9ccfdc408d51 fix gpu word count.but not count line num.
Yuhi TOMARI <yuhi@cr.ie.u-ryukyu.ac.jp>
parents: 1538
diff changeset
191 for (int j = 0; j < array_task_num; j++) {
1678
9ceb824e9be1 fix TaskArray last().
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 1677
diff changeset
192 int a = w->task_spwaned++;
1542
9ccfdc408d51 fix gpu word count.but not count line num.
Yuhi TOMARI <yuhi@cr.ie.u-ryukyu.ac.jp>
parents: 1538
diff changeset
193 if (w->size < size) size = w->size;
9ccfdc408d51 fix gpu word count.but not count line num.
Yuhi TOMARI <yuhi@cr.ie.u-ryukyu.ac.jp>
parents: 1538
diff changeset
194 int length = size/sizeof(char);
9ccfdc408d51 fix gpu word count.but not count line num.
Yuhi TOMARI <yuhi@cr.ie.u-ryukyu.ac.jp>
parents: 1538
diff changeset
195 if (size==0) break;
970
1a4849b2acad change pipeline and TaskArray fast
Yutaka Kinjyo <yutaka@cr.ie.u-ryukyu.ac.jp>
parents: 968
diff changeset
196
1542
9ccfdc408d51 fix gpu word count.but not count line num.
Yuhi TOMARI <yuhi@cr.ie.u-ryukyu.ac.jp>
parents: 1538
diff changeset
197 if (use_compat) {
9ccfdc408d51 fix gpu word count.but not count line num.
Yuhi TOMARI <yuhi@cr.ie.u-ryukyu.ac.jp>
parents: 1538
diff changeset
198 h_exec = manager->create_task(TASK_EXEC);
9ccfdc408d51 fix gpu word count.but not count line num.
Yuhi TOMARI <yuhi@cr.ie.u-ryukyu.ac.jp>
parents: 1538
diff changeset
199 h_exec->set_param(0,(memaddr)length);
1678
9ceb824e9be1 fix TaskArray last().
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 1677
diff changeset
200 h_exec->set_inData(0,w->file_mmap + a*w->division_size, size);
9ceb824e9be1 fix TaskArray last().
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 1677
diff changeset
201 h_exec->set_outData(0,w->o_data + a*w->out_size, w->division_out_size);
968
122b1fddfa94 fix wordcount
Yutaka Kinjyo <yutaka@cr.ie.u-ryukyu.ac.jp>
parents: 967
diff changeset
202
1021
47ca99c5cf84 use MailManager
yutaka@localhost.localdomain
parents: 1007
diff changeset
203
1542
9ccfdc408d51 fix gpu word count.but not count line num.
Yuhi TOMARI <yuhi@cr.ie.u-ryukyu.ac.jp>
parents: 1538
diff changeset
204 if (all) {
9ccfdc408d51 fix gpu word count.but not count line num.
Yuhi TOMARI <yuhi@cr.ie.u-ryukyu.ac.jp>
parents: 1538
diff changeset
205 w->t_print->wait_for(h_exec);
9ccfdc408d51 fix gpu word count.but not count line num.
Yuhi TOMARI <yuhi@cr.ie.u-ryukyu.ac.jp>
parents: 1538
diff changeset
206 } else {
9ccfdc408d51 fix gpu word count.but not count line num.
Yuhi TOMARI <yuhi@cr.ie.u-ryukyu.ac.jp>
parents: 1538
diff changeset
207 t_next->wait_for(h_exec);
9ccfdc408d51 fix gpu word count.but not count line num.
Yuhi TOMARI <yuhi@cr.ie.u-ryukyu.ac.jp>
parents: 1538
diff changeset
208 }
1538
fac06524090b add gpu task wordcount. But not work print
Yuhi TOMARI <yuhi@cr.ie.u-ryukyu.ac.jp>
parents: 1351
diff changeset
209
1542
9ccfdc408d51 fix gpu word count.but not count line num.
Yuhi TOMARI <yuhi@cr.ie.u-ryukyu.ac.jp>
parents: 1538
diff changeset
210 h_exec->set_cpu(spe_cpu);
9ccfdc408d51 fix gpu word count.but not count line num.
Yuhi TOMARI <yuhi@cr.ie.u-ryukyu.ac.jp>
parents: 1538
diff changeset
211 h_exec->spawn();
970
1a4849b2acad change pipeline and TaskArray fast
Yutaka Kinjyo <yutaka@cr.ie.u-ryukyu.ac.jp>
parents: 968
diff changeset
212
1542
9ccfdc408d51 fix gpu word count.but not count line num.
Yuhi TOMARI <yuhi@cr.ie.u-ryukyu.ac.jp>
parents: 1538
diff changeset
213 } else {
9ccfdc408d51 fix gpu word count.but not count line num.
Yuhi TOMARI <yuhi@cr.ie.u-ryukyu.ac.jp>
parents: 1538
diff changeset
214 h_exec = manager->create_task(TASK_EXEC,
1678
9ceb824e9be1 fix TaskArray last().
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 1677
diff changeset
215 (memaddr)(w->file_mmap + a*w->division_size), size,
9ceb824e9be1 fix TaskArray last().
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 1677
diff changeset
216 (memaddr)(w->o_data + a*w->out_size), w->division_out_size);
970
1a4849b2acad change pipeline and TaskArray fast
Yutaka Kinjyo <yutaka@cr.ie.u-ryukyu.ac.jp>
parents: 968
diff changeset
217
1542
9ccfdc408d51 fix gpu word count.but not count line num.
Yuhi TOMARI <yuhi@cr.ie.u-ryukyu.ac.jp>
parents: 1538
diff changeset
218 if (all) {
9ccfdc408d51 fix gpu word count.but not count line num.
Yuhi TOMARI <yuhi@cr.ie.u-ryukyu.ac.jp>
parents: 1538
diff changeset
219 w->t_print->wait_for(h_exec);
9ccfdc408d51 fix gpu word count.but not count line num.
Yuhi TOMARI <yuhi@cr.ie.u-ryukyu.ac.jp>
parents: 1538
diff changeset
220 } else {
9ccfdc408d51 fix gpu word count.but not count line num.
Yuhi TOMARI <yuhi@cr.ie.u-ryukyu.ac.jp>
parents: 1538
diff changeset
221 t_next->wait_for(h_exec);
9ccfdc408d51 fix gpu word count.but not count line num.
Yuhi TOMARI <yuhi@cr.ie.u-ryukyu.ac.jp>
parents: 1538
diff changeset
222 }
970
1a4849b2acad change pipeline and TaskArray fast
Yutaka Kinjyo <yutaka@cr.ie.u-ryukyu.ac.jp>
parents: 968
diff changeset
223
1542
9ccfdc408d51 fix gpu word count.but not count line num.
Yuhi TOMARI <yuhi@cr.ie.u-ryukyu.ac.jp>
parents: 1538
diff changeset
224 h_exec->set_cpu(spe_cpu);
9ccfdc408d51 fix gpu word count.but not count line num.
Yuhi TOMARI <yuhi@cr.ie.u-ryukyu.ac.jp>
parents: 1538
diff changeset
225 h_exec->spawn();
9ccfdc408d51 fix gpu word count.but not count line num.
Yuhi TOMARI <yuhi@cr.ie.u-ryukyu.ac.jp>
parents: 1538
diff changeset
226 }
9ccfdc408d51 fix gpu word count.but not count line num.
Yuhi TOMARI <yuhi@cr.ie.u-ryukyu.ac.jp>
parents: 1538
diff changeset
227 w->size -= size;
9ccfdc408d51 fix gpu word count.but not count line num.
Yuhi TOMARI <yuhi@cr.ie.u-ryukyu.ac.jp>
parents: 1538
diff changeset
228 w->task_num--;
1538
fac06524090b add gpu task wordcount. But not work print
Yuhi TOMARI <yuhi@cr.ie.u-ryukyu.ac.jp>
parents: 1351
diff changeset
229 }
1542
9ccfdc408d51 fix gpu word count.but not count line num.
Yuhi TOMARI <yuhi@cr.ie.u-ryukyu.ac.jp>
parents: 1538
diff changeset
230
946
852ed17d8af1 unify word count examples....
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 797
diff changeset
231 }
970
1a4849b2acad change pipeline and TaskArray fast
Yutaka Kinjyo <yutaka@cr.ie.u-ryukyu.ac.jp>
parents: 968
diff changeset
232
946
852ed17d8af1 unify word count examples....
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 797
diff changeset
233 }
393
cb06748ba6cf add word_count
e065725@localhost.localdomain
parents:
diff changeset
234
946
852ed17d8af1 unify word count examples....
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 797
diff changeset
235 /**
852ed17d8af1 unify word count examples....
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 797
diff changeset
236 * このTaskは、PPE上で実行されるので、並列に実行されることはない
852ed17d8af1 unify word count examples....
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 797
diff changeset
237 * 二つ実行されていて、Task が足りなくなることがないようにしている。
852ed17d8af1 unify word count examples....
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 797
diff changeset
238 */
852ed17d8af1 unify word count examples....
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 797
diff changeset
239
852ed17d8af1 unify word count examples....
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 797
diff changeset
240 SchedDefineTask1(RUN_TASK_BLOCKS,run16);
852ed17d8af1 unify word count examples....
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 797
diff changeset
241
852ed17d8af1 unify word count examples....
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 797
diff changeset
242 static int
852ed17d8af1 unify word count examples....
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 797
diff changeset
243 run16(SchedTask *manager, void *in, void *out)
852ed17d8af1 unify word count examples....
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 797
diff changeset
244 {
852ed17d8af1 unify word count examples....
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 797
diff changeset
245 WordCount *w = *(WordCount **)in;
1538
fac06524090b add gpu task wordcount. But not work print
Yuhi TOMARI <yuhi@cr.ie.u-ryukyu.ac.jp>
parents: 1351
diff changeset
246
946
852ed17d8af1 unify word count examples....
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 797
diff changeset
247 if (w->task_num < w->task_blocks) {
1538
fac06524090b add gpu task wordcount. But not work print
Yuhi TOMARI <yuhi@cr.ie.u-ryukyu.ac.jp>
parents: 1351
diff changeset
248 // last case
fac06524090b add gpu task wordcount. But not work print
Yuhi TOMARI <yuhi@cr.ie.u-ryukyu.ac.jp>
parents: 1351
diff changeset
249 while (w->size >= w->division_size)
fac06524090b add gpu task wordcount. But not work print
Yuhi TOMARI <yuhi@cr.ie.u-ryukyu.ac.jp>
parents: 1351
diff changeset
250 run_tasks(manager,w,w->task_num, w->t_print, w->division_size);
fac06524090b add gpu task wordcount. But not work print
Yuhi TOMARI <yuhi@cr.ie.u-ryukyu.ac.jp>
parents: 1351
diff changeset
251 // remaining data
fac06524090b add gpu task wordcount. But not work print
Yuhi TOMARI <yuhi@cr.ie.u-ryukyu.ac.jp>
parents: 1351
diff changeset
252 while (w->size>0)
fac06524090b add gpu task wordcount. But not work print
Yuhi TOMARI <yuhi@cr.ie.u-ryukyu.ac.jp>
parents: 1351
diff changeset
253 run_tasks(manager,w,1, w->t_print, w->size);
fac06524090b add gpu task wordcount. But not work print
Yuhi TOMARI <yuhi@cr.ie.u-ryukyu.ac.jp>
parents: 1351
diff changeset
254 // printf("run16 last %d\n",w->task_num);
949
5f0135ca75ee word count size fix
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 948
diff changeset
255 } else {
1538
fac06524090b add gpu task wordcount. But not work print
Yuhi TOMARI <yuhi@cr.ie.u-ryukyu.ac.jp>
parents: 1351
diff changeset
256 HTaskPtr t_next = manager->create_task(RUN_TASK_BLOCKS,
1542
9ccfdc408d51 fix gpu word count.but not count line num.
Yuhi TOMARI <yuhi@cr.ie.u-ryukyu.ac.jp>
parents: 1538
diff changeset
257 (memaddr)&w->self,sizeof(memaddr),0,0);
1538
fac06524090b add gpu task wordcount. But not work print
Yuhi TOMARI <yuhi@cr.ie.u-ryukyu.ac.jp>
parents: 1351
diff changeset
258 w->t_print->wait_for(t_next);
946
852ed17d8af1 unify word count examples....
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 797
diff changeset
259
1538
fac06524090b add gpu task wordcount. But not work print
Yuhi TOMARI <yuhi@cr.ie.u-ryukyu.ac.jp>
parents: 1351
diff changeset
260 run_tasks(manager,w, w->task_blocks, t_next, w->division_size);
946
852ed17d8af1 unify word count examples....
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 797
diff changeset
261
1538
fac06524090b add gpu task wordcount. But not work print
Yuhi TOMARI <yuhi@cr.ie.u-ryukyu.ac.jp>
parents: 1351
diff changeset
262 t_next->spawn();
fac06524090b add gpu task wordcount. But not work print
Yuhi TOMARI <yuhi@cr.ie.u-ryukyu.ac.jp>
parents: 1351
diff changeset
263 // printf("run16 next %d\n",w->task_num);
946
852ed17d8af1 unify word count examples....
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 797
diff changeset
264 }
852ed17d8af1 unify word count examples....
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 797
diff changeset
265 return 0;
852ed17d8af1 unify word count examples....
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 797
diff changeset
266 }
852ed17d8af1 unify word count examples....
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 797
diff changeset
267
852ed17d8af1 unify word count examples....
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 797
diff changeset
268
852ed17d8af1 unify word count examples....
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 797
diff changeset
269 static int blocks = 48;
1123
2a63ba2c9506 bug fix.
yutaka@localhost.localdomain
parents: 1083
diff changeset
270 //static int blocks = 31 * 6 * 24;
946
852ed17d8af1 unify word count examples....
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 797
diff changeset
271 static int division = 16; // in Kbyte
852ed17d8af1 unify word count examples....
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 797
diff changeset
272
852ed17d8af1 unify word count examples....
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 797
diff changeset
273 static void
400
984e7890db0c Fix examples.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 394
diff changeset
274 run_start(TaskManager *manager, char *filename)
393
cb06748ba6cf add word_count
e065725@localhost.localdomain
parents:
diff changeset
275 {
cb06748ba6cf add word_count
e065725@localhost.localdomain
parents:
diff changeset
276 HTaskPtr t_print;
cb06748ba6cf add word_count
e065725@localhost.localdomain
parents:
diff changeset
277
cb06748ba6cf add word_count
e065725@localhost.localdomain
parents:
diff changeset
278 st_mmap_t st_mmap;
cb06748ba6cf add word_count
e065725@localhost.localdomain
parents:
diff changeset
279 st_mmap = my_mmap(filename);
946
852ed17d8af1 unify word count examples....
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 797
diff changeset
280 WordCount *w = (WordCount*)manager->allocate(sizeof(WordCount));
852ed17d8af1 unify word count examples....
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 797
diff changeset
281 // bzero(w,sizeof(WordCount));
393
cb06748ba6cf add word_count
e065725@localhost.localdomain
parents:
diff changeset
282
1538
fac06524090b add gpu task wordcount. But not work print
Yuhi TOMARI <yuhi@cr.ie.u-ryukyu.ac.jp>
parents: 1351
diff changeset
283 //w->task_blocks = blocks;
946
852ed17d8af1 unify word count examples....
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 797
diff changeset
284 w->self = w;
852ed17d8af1 unify word count examples....
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 797
diff changeset
285 w->task_spwaned = 0;
393
cb06748ba6cf add word_count
e065725@localhost.localdomain
parents:
diff changeset
286
cb06748ba6cf add word_count
e065725@localhost.localdomain
parents:
diff changeset
287 /*sizeはdivision_sizeの倍数にしている。*/
949
5f0135ca75ee word count size fix
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 948
diff changeset
288 w->size = w->file_size = st_mmap.size;
946
852ed17d8af1 unify word count examples....
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 797
diff changeset
289 w->file_mmap = st_mmap.file_mmap;
949
5f0135ca75ee word count size fix
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 948
diff changeset
290 printf("w %lx\n",(long)w);
393
cb06748ba6cf add word_count
e065725@localhost.localdomain
parents:
diff changeset
291
cb06748ba6cf add word_count
e065725@localhost.localdomain
parents:
diff changeset
292 /* 1task分のデータサイズ(byte) */
946
852ed17d8af1 unify word count examples....
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 797
diff changeset
293 if (w->size >= 1024*division) {
1538
fac06524090b add gpu task wordcount. But not work print
Yuhi TOMARI <yuhi@cr.ie.u-ryukyu.ac.jp>
parents: 1351
diff changeset
294 w->division_size = 1024 * division;/*16kbyte*/
946
852ed17d8af1 unify word count examples....
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 797
diff changeset
295 } else {
1538
fac06524090b add gpu task wordcount. But not work print
Yuhi TOMARI <yuhi@cr.ie.u-ryukyu.ac.jp>
parents: 1351
diff changeset
296 w->division_size = w->size;
393
cb06748ba6cf add word_count
e065725@localhost.localdomain
parents:
diff changeset
297 }
cb06748ba6cf add word_count
e065725@localhost.localdomain
parents:
diff changeset
298
946
852ed17d8af1 unify word count examples....
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 797
diff changeset
299 printf("dvision_size %d\n",w->division_size);
393
cb06748ba6cf add word_count
e065725@localhost.localdomain
parents:
diff changeset
300
cb06748ba6cf add word_count
e065725@localhost.localdomain
parents:
diff changeset
301 /* "word num" and "line num" */
946
852ed17d8af1 unify word count examples....
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 797
diff changeset
302 w->status_num = 2;
393
cb06748ba6cf add word_count
e065725@localhost.localdomain
parents:
diff changeset
303 /* taskの数 */
946
852ed17d8af1 unify word count examples....
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 797
diff changeset
304 w->task_num = w->size / w->division_size;
852ed17d8af1 unify word count examples....
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 797
diff changeset
305 w->task_num = w->task_num + (w->division_size*w->task_num < w->size);
852ed17d8af1 unify word count examples....
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 797
diff changeset
306 int out_task_num = w->task_num;
394
bc2012726a51 debug word_count
e065725@localhost.localdomain
parents: 393
diff changeset
307
968
122b1fddfa94 fix wordcount
Yutaka Kinjyo <yutaka@cr.ie.u-ryukyu.ac.jp>
parents: 967
diff changeset
308 if(!all) {
122b1fddfa94 fix wordcount
Yutaka Kinjyo <yutaka@cr.ie.u-ryukyu.ac.jp>
parents: 967
diff changeset
309 w->task_blocks = blocks;
122b1fddfa94 fix wordcount
Yutaka Kinjyo <yutaka@cr.ie.u-ryukyu.ac.jp>
parents: 967
diff changeset
310 } else {
122b1fddfa94 fix wordcount
Yutaka Kinjyo <yutaka@cr.ie.u-ryukyu.ac.jp>
parents: 967
diff changeset
311 w->task_blocks = w->task_num;
122b1fddfa94 fix wordcount
Yutaka Kinjyo <yutaka@cr.ie.u-ryukyu.ac.jp>
parents: 967
diff changeset
312 }
122b1fddfa94 fix wordcount
Yutaka Kinjyo <yutaka@cr.ie.u-ryukyu.ac.jp>
parents: 967
diff changeset
313
946
852ed17d8af1 unify word count examples....
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 797
diff changeset
314 w->out_task_num = out_task_num;
852ed17d8af1 unify word count examples....
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 797
diff changeset
315 printf("task_num %d\n",w->task_num);
852ed17d8af1 unify word count examples....
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 797
diff changeset
316 printf("out_task_num %d\n",w->out_task_num);
394
bc2012726a51 debug word_count
e065725@localhost.localdomain
parents: 393
diff changeset
317
1007
00c01f416e3a add mail_queue
yutaka@localhost.localdomain
parents: 972
diff changeset
318 /* out用のdivision_size. statusが2つなので、あわせて16byteになるように、long long(4byte)を使用 */
393
cb06748ba6cf add word_count
e065725@localhost.localdomain
parents:
diff changeset
319
946
852ed17d8af1 unify word count examples....
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 797
diff changeset
320 w->division_out_size = sizeof(unsigned long long)*4;
852ed17d8af1 unify word count examples....
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 797
diff changeset
321 int out_size = w->division_out_size*out_task_num;
852ed17d8af1 unify word count examples....
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 797
diff changeset
322 w->o_data = (unsigned long long *)manager->allocate(out_size);
852ed17d8af1 unify word count examples....
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 797
diff changeset
323 w->out_size = 4;
393
cb06748ba6cf add word_count
e065725@localhost.localdomain
parents:
diff changeset
324 printf("out size %d\n",out_size);
cb06748ba6cf add word_count
e065725@localhost.localdomain
parents:
diff changeset
325
cb06748ba6cf add word_count
e065725@localhost.localdomain
parents:
diff changeset
326 /*各SPEの結果を合計して出力するタスク*/
cb06748ba6cf add word_count
e065725@localhost.localdomain
parents:
diff changeset
327
946
852ed17d8af1 unify word count examples....
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 797
diff changeset
328 t_print = manager->create_task(TASK_PRINT,
1542
9ccfdc408d51 fix gpu word count.but not count line num.
Yuhi TOMARI <yuhi@cr.ie.u-ryukyu.ac.jp>
parents: 1538
diff changeset
329 (memaddr)&w->self,sizeof(memaddr),0,0);
946
852ed17d8af1 unify word count examples....
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 797
diff changeset
330 w->t_print = t_print;
783
76781837ff3a wordcount fix?
yutaka@localhost.localdomain
parents: 743
diff changeset
331
1123
2a63ba2c9506 bug fix.
yutaka@localhost.localdomain
parents: 1083
diff changeset
332 for(int i = 0;i<20;i++) {
1538
fac06524090b add gpu task wordcount. But not work print
Yuhi TOMARI <yuhi@cr.ie.u-ryukyu.ac.jp>
parents: 1351
diff changeset
333 /* Task を task_blocks ずつ起動する Task */
946
852ed17d8af1 unify word count examples....
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 797
diff changeset
334 /* serialize されていると仮定する... */
1538
fac06524090b add gpu task wordcount. But not work print
Yuhi TOMARI <yuhi@cr.ie.u-ryukyu.ac.jp>
parents: 1351
diff changeset
335 HTaskPtr t_exec = manager->create_task(RUN_TASK_BLOCKS,
1542
9ccfdc408d51 fix gpu word count.but not count line num.
Yuhi TOMARI <yuhi@cr.ie.u-ryukyu.ac.jp>
parents: 1538
diff changeset
336 (memaddr)&w->self,sizeof(memaddr),0,0);
1538
fac06524090b add gpu task wordcount. But not work print
Yuhi TOMARI <yuhi@cr.ie.u-ryukyu.ac.jp>
parents: 1351
diff changeset
337 t_print->wait_for(t_exec);
fac06524090b add gpu task wordcount. But not work print
Yuhi TOMARI <yuhi@cr.ie.u-ryukyu.ac.jp>
parents: 1351
diff changeset
338 t_exec->spawn();
394
bc2012726a51 debug word_count
e065725@localhost.localdomain
parents: 393
diff changeset
339 }
bc2012726a51 debug word_count
e065725@localhost.localdomain
parents: 393
diff changeset
340
393
cb06748ba6cf add word_count
e065725@localhost.localdomain
parents:
diff changeset
341 t_print->spawn();
cb06748ba6cf add word_count
e065725@localhost.localdomain
parents:
diff changeset
342 }
cb06748ba6cf add word_count
e065725@localhost.localdomain
parents:
diff changeset
343
946
852ed17d8af1 unify word count examples....
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 797
diff changeset
344 static char*
393
cb06748ba6cf add word_count
e065725@localhost.localdomain
parents:
diff changeset
345 init(int argc, char **argv)
cb06748ba6cf add word_count
e065725@localhost.localdomain
parents:
diff changeset
346 {
1538
fac06524090b add gpu task wordcount. But not work print
Yuhi TOMARI <yuhi@cr.ie.u-ryukyu.ac.jp>
parents: 1351
diff changeset
347
394
bc2012726a51 debug word_count
e065725@localhost.localdomain
parents: 393
diff changeset
348 char *filename = 0;
1538
fac06524090b add gpu task wordcount. But not work print
Yuhi TOMARI <yuhi@cr.ie.u-ryukyu.ac.jp>
parents: 1351
diff changeset
349
fac06524090b add gpu task wordcount. But not work print
Yuhi TOMARI <yuhi@cr.ie.u-ryukyu.ac.jp>
parents: 1351
diff changeset
350 for (int i = 1; argv[i]; ++i) {
fac06524090b add gpu task wordcount. But not work print
Yuhi TOMARI <yuhi@cr.ie.u-ryukyu.ac.jp>
parents: 1351
diff changeset
351 if (strcmp(argv[i], "-file") == 0) {
1679
ff43dc274ec9 word_count fix for GPU
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 1678
diff changeset
352 filename = argv[i+1]; i++;
1538
fac06524090b add gpu task wordcount. But not work print
Yuhi TOMARI <yuhi@cr.ie.u-ryukyu.ac.jp>
parents: 1351
diff changeset
353 } else if (strcmp(argv[i], "-division") == 0) {
fac06524090b add gpu task wordcount. But not work print
Yuhi TOMARI <yuhi@cr.ie.u-ryukyu.ac.jp>
parents: 1351
diff changeset
354 division = atoi(argv[i+1]);
1679
ff43dc274ec9 word_count fix for GPU
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 1678
diff changeset
355 i++;
1538
fac06524090b add gpu task wordcount. But not work print
Yuhi TOMARI <yuhi@cr.ie.u-ryukyu.ac.jp>
parents: 1351
diff changeset
356 } else if (strcmp(argv[i], "-block") == 0) {
fac06524090b add gpu task wordcount. But not work print
Yuhi TOMARI <yuhi@cr.ie.u-ryukyu.ac.jp>
parents: 1351
diff changeset
357 blocks = atoi(argv[i+1]);
1679
ff43dc274ec9 word_count fix for GPU
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 1678
diff changeset
358 i++;
1538
fac06524090b add gpu task wordcount. But not work print
Yuhi TOMARI <yuhi@cr.ie.u-ryukyu.ac.jp>
parents: 1351
diff changeset
359 } else if (strcmp(argv[i], "-a") == 0) {
fac06524090b add gpu task wordcount. But not work print
Yuhi TOMARI <yuhi@cr.ie.u-ryukyu.ac.jp>
parents: 1351
diff changeset
360 // create task all at once
fac06524090b add gpu task wordcount. But not work print
Yuhi TOMARI <yuhi@cr.ie.u-ryukyu.ac.jp>
parents: 1351
diff changeset
361 all = 1;
fac06524090b add gpu task wordcount. But not work print
Yuhi TOMARI <yuhi@cr.ie.u-ryukyu.ac.jp>
parents: 1351
diff changeset
362 } else if (strcmp(argv[i], "-c") == 0) {
fac06524090b add gpu task wordcount. But not work print
Yuhi TOMARI <yuhi@cr.ie.u-ryukyu.ac.jp>
parents: 1351
diff changeset
363 use_task_array = 0;
fac06524090b add gpu task wordcount. But not work print
Yuhi TOMARI <yuhi@cr.ie.u-ryukyu.ac.jp>
parents: 1351
diff changeset
364 use_compat = 1;
fac06524090b add gpu task wordcount. But not work print
Yuhi TOMARI <yuhi@cr.ie.u-ryukyu.ac.jp>
parents: 1351
diff changeset
365 } else if (strcmp(argv[i], "-s") == 0) {
fac06524090b add gpu task wordcount. But not work print
Yuhi TOMARI <yuhi@cr.ie.u-ryukyu.ac.jp>
parents: 1351
diff changeset
366 use_task_array = 0;
fac06524090b add gpu task wordcount. But not work print
Yuhi TOMARI <yuhi@cr.ie.u-ryukyu.ac.jp>
parents: 1351
diff changeset
367 use_compat = 0;
fac06524090b add gpu task wordcount. But not work print
Yuhi TOMARI <yuhi@cr.ie.u-ryukyu.ac.jp>
parents: 1351
diff changeset
368 } else if (strcmp(argv[i], "-t") == 0) {
fac06524090b add gpu task wordcount. But not work print
Yuhi TOMARI <yuhi@cr.ie.u-ryukyu.ac.jp>
parents: 1351
diff changeset
369 use_task_creater = 1;
fac06524090b add gpu task wordcount. But not work print
Yuhi TOMARI <yuhi@cr.ie.u-ryukyu.ac.jp>
parents: 1351
diff changeset
370 use_task_array = 0;
fac06524090b add gpu task wordcount. But not work print
Yuhi TOMARI <yuhi@cr.ie.u-ryukyu.ac.jp>
parents: 1351
diff changeset
371 use_compat = 0;
fac06524090b add gpu task wordcount. But not work print
Yuhi TOMARI <yuhi@cr.ie.u-ryukyu.ac.jp>
parents: 1351
diff changeset
372 } else if (strcmp(argv[i], "-anum") == 0) {
fac06524090b add gpu task wordcount. But not work print
Yuhi TOMARI <yuhi@cr.ie.u-ryukyu.ac.jp>
parents: 1351
diff changeset
373 array_task_num = atoi(argv[i+1]);
1679
ff43dc274ec9 word_count fix for GPU
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 1678
diff changeset
374 i++;
1538
fac06524090b add gpu task wordcount. But not work print
Yuhi TOMARI <yuhi@cr.ie.u-ryukyu.ac.jp>
parents: 1351
diff changeset
375 } else if (strcmp(argv[i], "-g") == 0 ) {
fac06524090b add gpu task wordcount. But not work print
Yuhi TOMARI <yuhi@cr.ie.u-ryukyu.ac.jp>
parents: 1351
diff changeset
376 spe_cpu = GPU_0;
fac06524090b add gpu task wordcount. But not work print
Yuhi TOMARI <yuhi@cr.ie.u-ryukyu.ac.jp>
parents: 1351
diff changeset
377 } else if (strcmp(argv[i], "-cpu") == 0) {
fac06524090b add gpu task wordcount. But not work print
Yuhi TOMARI <yuhi@cr.ie.u-ryukyu.ac.jp>
parents: 1351
diff changeset
378 spe_num = atoi(argv[i+1]);
1679
ff43dc274ec9 word_count fix for GPU
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 1678
diff changeset
379 i++;
1538
fac06524090b add gpu task wordcount. But not work print
Yuhi TOMARI <yuhi@cr.ie.u-ryukyu.ac.jp>
parents: 1351
diff changeset
380 if (spe_num==0) spe_num = 1;
1679
ff43dc274ec9 word_count fix for GPU
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 1678
diff changeset
381 } else {
ff43dc274ec9 word_count fix for GPU
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 1678
diff changeset
382 fprintf(stderr,"%s\n",usr_help_str);
ff43dc274ec9 word_count fix for GPU
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 1678
diff changeset
383 exit (0);
1538
fac06524090b add gpu task wordcount. But not work print
Yuhi TOMARI <yuhi@cr.ie.u-ryukyu.ac.jp>
parents: 1351
diff changeset
384 }
393
cb06748ba6cf add word_count
e065725@localhost.localdomain
parents:
diff changeset
385 }
400
984e7890db0c Fix examples.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 394
diff changeset
386 if (filename==0) {
946
852ed17d8af1 unify word count examples....
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 797
diff changeset
387 puts(usr_help_str);
1538
fac06524090b add gpu task wordcount. But not work print
Yuhi TOMARI <yuhi@cr.ie.u-ryukyu.ac.jp>
parents: 1351
diff changeset
388 exit(1);
400
984e7890db0c Fix examples.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 394
diff changeset
389 }
1538
fac06524090b add gpu task wordcount. But not work print
Yuhi TOMARI <yuhi@cr.ie.u-ryukyu.ac.jp>
parents: 1351
diff changeset
390
393
cb06748ba6cf add word_count
e065725@localhost.localdomain
parents:
diff changeset
391 return filename;
cb06748ba6cf add word_count
e065725@localhost.localdomain
parents:
diff changeset
392 }
cb06748ba6cf add word_count
e065725@localhost.localdomain
parents:
diff changeset
393
946
852ed17d8af1 unify word count examples....
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 797
diff changeset
394
393
cb06748ba6cf add word_count
e065725@localhost.localdomain
parents:
diff changeset
395 int
400
984e7890db0c Fix examples.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 394
diff changeset
396 TMmain(TaskManager *manager, int argc, char *argv[])
393
cb06748ba6cf add word_count
e065725@localhost.localdomain
parents:
diff changeset
397 {
cb06748ba6cf add word_count
e065725@localhost.localdomain
parents:
diff changeset
398
394
bc2012726a51 debug word_count
e065725@localhost.localdomain
parents: 393
diff changeset
399 char *filename = 0;
bc2012726a51 debug word_count
e065725@localhost.localdomain
parents: 393
diff changeset
400 filename = init(argc, argv);
1538
fac06524090b add gpu task wordcount. But not work print
Yuhi TOMARI <yuhi@cr.ie.u-ryukyu.ac.jp>
parents: 1351
diff changeset
401
393
cb06748ba6cf add word_count
e065725@localhost.localdomain
parents:
diff changeset
402 if (filename < 0) {
1538
fac06524090b add gpu task wordcount. But not work print
Yuhi TOMARI <yuhi@cr.ie.u-ryukyu.ac.jp>
parents: 1351
diff changeset
403 return -1;
393
cb06748ba6cf add word_count
e065725@localhost.localdomain
parents:
diff changeset
404 }
cb06748ba6cf add word_count
e065725@localhost.localdomain
parents:
diff changeset
405
cb06748ba6cf add word_count
e065725@localhost.localdomain
parents:
diff changeset
406 task_init();
400
984e7890db0c Fix examples.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 394
diff changeset
407 run_start(manager, filename);
1544
5c4e3f0d372a many_task add task array
Yuhi TOMARI <yuhi@cr.ie.u-ryukyu.ac.jp>
parents: 1542
diff changeset
408 st_time = getTime();
5c4e3f0d372a many_task add task array
Yuhi TOMARI <yuhi@cr.ie.u-ryukyu.ac.jp>
parents: 1542
diff changeset
409 manager->set_TMend(TMend);
393
cb06748ba6cf add word_count
e065725@localhost.localdomain
parents:
diff changeset
410 return 0;
cb06748ba6cf add word_count
e065725@localhost.localdomain
parents:
diff changeset
411 }
946
852ed17d8af1 unify word count examples....
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 797
diff changeset
412
1544
5c4e3f0d372a many_task add task array
Yuhi TOMARI <yuhi@cr.ie.u-ryukyu.ac.jp>
parents: 1542
diff changeset
413 void
5c4e3f0d372a many_task add task array
Yuhi TOMARI <yuhi@cr.ie.u-ryukyu.ac.jp>
parents: 1542
diff changeset
414 TMend(TaskManager *manager)
5c4e3f0d372a many_task add task array
Yuhi TOMARI <yuhi@cr.ie.u-ryukyu.ac.jp>
parents: 1542
diff changeset
415 {
5c4e3f0d372a many_task add task array
Yuhi TOMARI <yuhi@cr.ie.u-ryukyu.ac.jp>
parents: 1542
diff changeset
416 ed_time = getTime();
5c4e3f0d372a many_task add task array
Yuhi TOMARI <yuhi@cr.ie.u-ryukyu.ac.jp>
parents: 1542
diff changeset
417 printf("Time: %0.6f\n",ed_time-st_time);
5c4e3f0d372a many_task add task array
Yuhi TOMARI <yuhi@cr.ie.u-ryukyu.ac.jp>
parents: 1542
diff changeset
418 }
5c4e3f0d372a many_task add task array
Yuhi TOMARI <yuhi@cr.ie.u-ryukyu.ac.jp>
parents: 1542
diff changeset
419
946
852ed17d8af1 unify word count examples....
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 797
diff changeset
420 /* end */