Mercurial > hg > Members > kono > Cerium
annotate example/word_count/spe/Print.cc @ 626:ab866bc8a624
64bit mode compatibility on Cell
author | Shinji KONO <kono@ie.u-ryukyu.ac.jp> |
---|---|
date | Mon, 16 Nov 2009 11:37:26 +0900 |
parents | 44c0bce54dcf |
children | a8b6ee80c108 |
rev | line source |
---|---|
393 | 1 #include <stdio.h> |
2 #include <string.h> | |
3 #include "Print.h" | |
4 #include "Func.h" | |
5 | |
6 /* これは必須 */ | |
7 SchedDefineTask(Print); | |
8 | |
467
44c0bce54dcf
fix all examples. test_render is not working now.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
393
diff
changeset
|
9 static int |
44c0bce54dcf
fix all examples. test_render is not working now.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
393
diff
changeset
|
10 run(SchedTask *s, void *rbuf, void *wbuf) |
393 | 11 { |
467
44c0bce54dcf
fix all examples. test_render is not working now.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
393
diff
changeset
|
12 unsigned long long *idata = (unsigned long long*)s->get_input(rbuf, 0); |
626
ab866bc8a624
64bit mode compatibility on Cell
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
467
diff
changeset
|
13 int task_num = (long)s->get_param(0); |
ab866bc8a624
64bit mode compatibility on Cell
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
467
diff
changeset
|
14 int status_num = (long)s->get_param(1); |
393 | 15 unsigned long long word_data[task_num]; |
16 | |
17 for (int i = 0; i < status_num; i++) { | |
18 word_data[i] = 0; | |
19 } | |
20 | |
21 for (int i = 0; i < task_num*status_num; i += status_num) { | |
22 for (int j = 0; j < status_num; j++) { | |
23 word_data[j] += idata[i+j]; | |
24 } | |
25 } | |
26 | |
27 for (int i = 0; i < status_num; i++) { | |
467
44c0bce54dcf
fix all examples. test_render is not working now.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
393
diff
changeset
|
28 s->printf("%llu ",word_data[i]); |
393 | 29 } |
30 | |
467
44c0bce54dcf
fix all examples. test_render is not working now.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
393
diff
changeset
|
31 s->printf("\n"); |
393 | 32 |
33 | |
34 return 0; | |
35 } |