Mercurial > hg > Members > kono > Cerium
annotate example/word_count3/ppe/Print.cc @ 625:60aa3f241b10
64bit mode worked on Mac OS X.
author | Shinji KONO <kono@ie.u-ryukyu.ac.jp> |
---|---|
date | Mon, 16 Nov 2009 10:59:55 +0900 |
parents | 7d9d209bdc82 |
children |
rev | line source |
---|---|
527 | 1 #include <stdio.h> |
2 #include <string.h> | |
3 #include "Print.h" | |
4 #include "Func.h" | |
5 | |
6 /* これは必須 */ | |
7 SchedDefineTask(Print); | |
8 | |
9 static int | |
10 run(SchedTask *s, void *rbuf, void *wbuf) | |
11 { | |
12 unsigned long long *idata = (unsigned long long*)s->get_input(rbuf, 0); | |
625
60aa3f241b10
64bit mode worked on Mac OS X.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
527
diff
changeset
|
13 long task_num = (long)s->get_param(0); |
60aa3f241b10
64bit mode worked on Mac OS X.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
527
diff
changeset
|
14 long status_num = (long)s->get_param(1); |
527 | 15 unsigned long long word_data[task_num]; |
16 | |
17 s->printf("start sum\n"); | |
18 | |
19 for (int i = 0; i < status_num; i++) { | |
20 word_data[i] = 0; | |
21 } | |
22 | |
23 for (int i = 0; i < task_num*status_num; i += status_num) { | |
24 for (int j = 0; j < status_num; j++) { | |
25 word_data[j] += idata[i+j]; | |
26 } | |
27 } | |
28 | |
29 for (int i = 0; i < status_num; i++) { | |
30 s->printf("%llu ",word_data[i]); | |
31 } | |
32 | |
33 s->printf("\n"); | |
34 | |
35 | |
36 return 0; | |
37 } |