Mercurial > hg > Game > Cerium
annotate example/Bulk/spe/Twice.cc @ 2069:26aa08c9a1de draft default tip
cuda example fix
author | Shinji KONO <kono@ie.u-ryukyu.ac.jp> |
---|---|
date | Sun, 12 Feb 2017 10:04:55 +0900 |
parents | 64f1d80dc650 |
children |
rev | line source |
---|---|
659 | 1 #include <stdio.h> |
706
b2b4a1243961
no compile error on Cell. Regression Test.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
659
diff
changeset
|
2 #include "SchedTaskArray.h" |
659 | 3 #include "Twice.h" |
4 #include "Func.h" | |
5 | |
6 /* これは必須 */ | |
7 SchedDefineTask(Twice); | |
8 | |
9 static int | |
706
b2b4a1243961
no compile error on Cell. Regression Test.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
659
diff
changeset
|
10 run(SchedTask *s,void *rbuf, void *wbuf) |
659 | 11 { |
706
b2b4a1243961
no compile error on Cell. Regression Test.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
659
diff
changeset
|
12 // SchedTaskArray *a = (SchedTaskArray *)s; |
b2b4a1243961
no compile error on Cell. Regression Test.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
659
diff
changeset
|
13 |
659 | 14 int *i_data; |
15 int *o_data; | |
706
b2b4a1243961
no compile error on Cell. Regression Test.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
659
diff
changeset
|
16 long length; |
787 | 17 int data_count = (int)s->get_param(0); |
659 | 18 |
787 | 19 for(int j = 0; j<data_count; j++) { |
706
b2b4a1243961
no compile error on Cell. Regression Test.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
659
diff
changeset
|
20 i_data = (int*)s->get_input(rbuf, j); |
b2b4a1243961
no compile error on Cell. Regression Test.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
659
diff
changeset
|
21 o_data = (int*)s->get_output(wbuf, j); |
b2b4a1243961
no compile error on Cell. Regression Test.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
659
diff
changeset
|
22 length = (long)s->get_param(j+1); |
b2b4a1243961
no compile error on Cell. Regression Test.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
659
diff
changeset
|
23 |
b2b4a1243961
no compile error on Cell. Regression Test.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
659
diff
changeset
|
24 for (int i = 0; i < length; i++) { |
b2b4a1243961
no compile error on Cell. Regression Test.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
659
diff
changeset
|
25 o_data[i] = i_data[i] * 2; |
b2b4a1243961
no compile error on Cell. Regression Test.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
659
diff
changeset
|
26 } |
659 | 27 } |
28 | |
29 return 0; | |
30 } |