annotate example/fft/ppe/transpose.cc @ 1571:9832a5eb2027 draft

merge
author Shohei KOKUBO <e105744@ie.u-ryukyu.ac.jp>
date Mon, 18 Mar 2013 15:28:54 +0900
parents 7d307bac94a6
children 8b2d3ac19991
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
1557
786ab4ad682e add fft ppe example
Shohei KOKUBO <e105744@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1 #include "transpose.h"
786ab4ad682e add fft ppe example
Shohei KOKUBO <e105744@ie.u-ryukyu.ac.jp>
parents:
diff changeset
2 #ifdef __APPLE__
786ab4ad682e add fft ppe example
Shohei KOKUBO <e105744@ie.u-ryukyu.ac.jp>
parents:
diff changeset
3 #include <OpenCL/opencl.h>
786ab4ad682e add fft ppe example
Shohei KOKUBO <e105744@ie.u-ryukyu.ac.jp>
parents:
diff changeset
4 #else
786ab4ad682e add fft ppe example
Shohei KOKUBO <e105744@ie.u-ryukyu.ac.jp>
parents:
diff changeset
5 #include <CL/cl.h>
786ab4ad682e add fft ppe example
Shohei KOKUBO <e105744@ie.u-ryukyu.ac.jp>
parents:
diff changeset
6 #endif
1566
Shohei KOKUBO <e105744@ie.u-ryukyu.ac.jp>
parents: 1560
diff changeset
7 #include "Func.h"
1557
786ab4ad682e add fft ppe example
Shohei KOKUBO <e105744@ie.u-ryukyu.ac.jp>
parents:
diff changeset
8
786ab4ad682e add fft ppe example
Shohei KOKUBO <e105744@ie.u-ryukyu.ac.jp>
parents:
diff changeset
9 SchedDefineTask1(transpose,transpose);
786ab4ad682e add fft ppe example
Shohei KOKUBO <e105744@ie.u-ryukyu.ac.jp>
parents:
diff changeset
10
786ab4ad682e add fft ppe example
Shohei KOKUBO <e105744@ie.u-ryukyu.ac.jp>
parents:
diff changeset
11 static int
786ab4ad682e add fft ppe example
Shohei KOKUBO <e105744@ie.u-ryukyu.ac.jp>
parents:
diff changeset
12 transpose(SchedTask* s,void* rbuf,void* wbuf)
786ab4ad682e add fft ppe example
Shohei KOKUBO <e105744@ie.u-ryukyu.ac.jp>
parents:
diff changeset
13 {
1566
Shohei KOKUBO <e105744@ie.u-ryukyu.ac.jp>
parents: 1560
diff changeset
14 cl_float2* src = (cl_float2*)s->get_inputAddr(0);
Shohei KOKUBO <e105744@ie.u-ryukyu.ac.jp>
parents: 1560
diff changeset
15 int* n = (int*)s->get_inputAddr(1);
1571
Shohei KOKUBO <e105744@ie.u-ryukyu.ac.jp>
parents: 1566
diff changeset
16
1566
Shohei KOKUBO <e105744@ie.u-ryukyu.ac.jp>
parents: 1560
diff changeset
17 cl_float2* dst = (cl_float2*)s->get_outputAddr(0);
1571
Shohei KOKUBO <e105744@ie.u-ryukyu.ac.jp>
parents: 1566
diff changeset
18
1566
Shohei KOKUBO <e105744@ie.u-ryukyu.ac.jp>
parents: 1560
diff changeset
19 unsigned int* xgid = (unsigned int*)s->global_get(FIRSTID);
Shohei KOKUBO <e105744@ie.u-ryukyu.ac.jp>
parents: 1560
diff changeset
20 unsigned int* ygid = (unsigned int*)s->global_get(SECONDID);
1557
786ab4ad682e add fft ppe example
Shohei KOKUBO <e105744@ie.u-ryukyu.ac.jp>
parents:
diff changeset
21
1560
3df1868130cb fix fft ppe example
Shohei KOKUBO <e105744@ie.u-ryukyu.ac.jp>
parents: 1557
diff changeset
22 unsigned int iid = ygid[0] * n[0] + xgid[0];
3df1868130cb fix fft ppe example
Shohei KOKUBO <e105744@ie.u-ryukyu.ac.jp>
parents: 1557
diff changeset
23 unsigned int oid = xgid[0] * n[0] + ygid[0];
1557
786ab4ad682e add fft ppe example
Shohei KOKUBO <e105744@ie.u-ryukyu.ac.jp>
parents:
diff changeset
24
786ab4ad682e add fft ppe example
Shohei KOKUBO <e105744@ie.u-ryukyu.ac.jp>
parents:
diff changeset
25 dst[oid] = src[iid];
786ab4ad682e add fft ppe example
Shohei KOKUBO <e105744@ie.u-ryukyu.ac.jp>
parents:
diff changeset
26
786ab4ad682e add fft ppe example
Shohei KOKUBO <e105744@ie.u-ryukyu.ac.jp>
parents:
diff changeset
27 return 0;
786ab4ad682e add fft ppe example
Shohei KOKUBO <e105744@ie.u-ryukyu.ac.jp>
parents:
diff changeset
28 }