annotate example/Pipeline/spe/Twice.cc @ 2048:6796d85f3d6b draft

remove error
author Masataka Kohagura <kohagura@cr.ie.u-ryukyu.ac.jp>
date Thu, 28 Jan 2016 00:05:49 +0900
parents 62b72c6199f3
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
963
62b72c6199f3 SgChange
tkaito
parents:
diff changeset
1 #include <stdio.h>
62b72c6199f3 SgChange
tkaito
parents:
diff changeset
2 #include "SchedTask.h"
62b72c6199f3 SgChange
tkaito
parents:
diff changeset
3 #include "Twice.h"
62b72c6199f3 SgChange
tkaito
parents:
diff changeset
4 #include "Func.h"
62b72c6199f3 SgChange
tkaito
parents:
diff changeset
5
62b72c6199f3 SgChange
tkaito
parents:
diff changeset
6 /* これは必須 */
62b72c6199f3 SgChange
tkaito
parents:
diff changeset
7 SchedDefineTask(Twice);
62b72c6199f3 SgChange
tkaito
parents:
diff changeset
8
62b72c6199f3 SgChange
tkaito
parents:
diff changeset
9 static int
62b72c6199f3 SgChange
tkaito
parents:
diff changeset
10 run(SchedTask *s,void *rbuf, void *wbuf)
62b72c6199f3 SgChange
tkaito
parents:
diff changeset
11 {
62b72c6199f3 SgChange
tkaito
parents:
diff changeset
12 int *i_data;
62b72c6199f3 SgChange
tkaito
parents:
diff changeset
13 int *o_data;
62b72c6199f3 SgChange
tkaito
parents:
diff changeset
14 long length;
62b72c6199f3 SgChange
tkaito
parents:
diff changeset
15
62b72c6199f3 SgChange
tkaito
parents:
diff changeset
16 i_data = (int*)rbuf;
62b72c6199f3 SgChange
tkaito
parents:
diff changeset
17 o_data = (int*)wbuf;
62b72c6199f3 SgChange
tkaito
parents:
diff changeset
18 length = s->read_size()/sizeof(int);
62b72c6199f3 SgChange
tkaito
parents:
diff changeset
19
62b72c6199f3 SgChange
tkaito
parents:
diff changeset
20 for (int i = 0; i < length; i++) {
62b72c6199f3 SgChange
tkaito
parents:
diff changeset
21 o_data[i] = i_data[i] * 2;
62b72c6199f3 SgChange
tkaito
parents:
diff changeset
22 }
62b72c6199f3 SgChange
tkaito
parents:
diff changeset
23 s->printf("SPE %d end\n",s->get_cpuid());
62b72c6199f3 SgChange
tkaito
parents:
diff changeset
24
62b72c6199f3 SgChange
tkaito
parents:
diff changeset
25 return 0;
62b72c6199f3 SgChange
tkaito
parents:
diff changeset
26 }