Mercurial > hg > Members > kono > Cerium
comparison example/word_count/spe/Print.cc @ 467:44c0bce54dcf
fix all examples. test_render is not working now.
author | Shinji KONO <kono@ie.u-ryukyu.ac.jp> |
---|---|
date | Thu, 01 Oct 2009 19:25:25 +0900 |
parents | 72b73beb3325 |
children | ab866bc8a624 |
comparison
equal
deleted
inserted
replaced
466:4fa8760e18c2 | 467:44c0bce54dcf |
---|---|
4 #include "Func.h" | 4 #include "Func.h" |
5 | 5 |
6 /* これは必須 */ | 6 /* これは必須 */ |
7 SchedDefineTask(Print); | 7 SchedDefineTask(Print); |
8 | 8 |
9 int | 9 static int |
10 Print::run(void *rbuf, void *wbuf) | 10 run(SchedTask *s, void *rbuf, void *wbuf) |
11 { | 11 { |
12 unsigned long long *idata = (unsigned long long*)get_input(rbuf, 0); | 12 unsigned long long *idata = (unsigned long long*)s->get_input(rbuf, 0); |
13 int task_num = get_param(0); | 13 int task_num = s->get_param(0); |
14 int status_num = get_param(1); | 14 int status_num = s->get_param(1); |
15 unsigned long long word_data[task_num]; | 15 unsigned long long word_data[task_num]; |
16 | 16 |
17 for (int i = 0; i < status_num; i++) { | 17 for (int i = 0; i < status_num; i++) { |
18 word_data[i] = 0; | 18 word_data[i] = 0; |
19 } | 19 } |
23 word_data[j] += idata[i+j]; | 23 word_data[j] += idata[i+j]; |
24 } | 24 } |
25 } | 25 } |
26 | 26 |
27 for (int i = 0; i < status_num; i++) { | 27 for (int i = 0; i < status_num; i++) { |
28 printf("%llu ",word_data[i]); | 28 s->printf("%llu ",word_data[i]); |
29 } | 29 } |
30 | 30 |
31 printf("\n"); | 31 s->printf("\n"); |
32 | 32 |
33 | 33 |
34 return 0; | 34 return 0; |
35 } | 35 } |