Mercurial > hg > Members > kono > Cerium
annotate example/Bulk/ppe/Twice.cc @ 701:226d95fa2691 TaskArray
Bulk task worked on Mac OS X
author | Shinji KONO <kono@ie.u-ryukyu.ac.jp> |
---|---|
date | Mon, 14 Dec 2009 12:46:48 +0900 |
parents | 7e937a1cd121 |
children | 5df90e02e34f |
rev | line source |
---|---|
652 | 1 #include <stdio.h> |
685 | 2 #include "SchedTaskArray.h" |
652 | 3 #include "Twice.h" |
4 #include "Func.h" | |
5 | |
6 /* これは必須 */ | |
7 SchedDefineTask(Twice); | |
8 | |
9 static int | |
10 run(SchedTask *s,void *rbuf, void *wbuf) | |
11 { | |
699 | 12 // SchedTaskArray *a = (SchedTaskArray *)s; |
685 | 13 |
652 | 14 int *i_data; |
15 int *o_data; | |
16 long length; | |
701
226d95fa2691
Bulk task worked on Mac OS X
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
699
diff
changeset
|
17 int count = (int)s->get_param(0); |
652 | 18 |
701
226d95fa2691
Bulk task worked on Mac OS X
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
699
diff
changeset
|
19 for(int j = 0; j<count; j++) { |
226d95fa2691
Bulk task worked on Mac OS X
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
699
diff
changeset
|
20 i_data = (int*)s->get_input(rbuf, j); |
226d95fa2691
Bulk task worked on Mac OS X
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
699
diff
changeset
|
21 o_data = (int*)s->get_output(wbuf, j); |
226d95fa2691
Bulk task worked on Mac OS X
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
699
diff
changeset
|
22 length = (long)s->get_param(j+1); |
226d95fa2691
Bulk task worked on Mac OS X
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
699
diff
changeset
|
23 |
226d95fa2691
Bulk task worked on Mac OS X
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
699
diff
changeset
|
24 for (int i = 0; i < length; i++) { |
226d95fa2691
Bulk task worked on Mac OS X
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
699
diff
changeset
|
25 o_data[i] = i_data[i] * 2; |
226d95fa2691
Bulk task worked on Mac OS X
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
699
diff
changeset
|
26 } |
652 | 27 } |
28 | |
29 return 0; | |
30 } |