Mercurial > hg > Members > kono > Cerium
comparison example/word_count3/ppe/Print.cc @ 527:7d9d209bdc82
add word_count3
author | yutaka@henri.cr.ie.u-ryukyu.ac.jp |
---|---|
date | Tue, 20 Oct 2009 16:28:16 +0900 |
parents | |
children | 60aa3f241b10 |
comparison
equal
deleted
inserted
replaced
526:214cd21049e0 | 527:7d9d209bdc82 |
---|---|
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); | |
13 int task_num = s->get_param(0); | |
14 int status_num = s->get_param(1); | |
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 } |