annotate example/fft/ppe/transpose.cc @ 1817:b0376e1c51e9 draft

use get_input & get_output
author Shohei KOKUBO <e105744@ie.u-ryukyu.ac.jp>
date Fri, 13 Dec 2013 05:18:58 +0900
parents 32bc4ea3557f
children 144e573b030b
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 {
1817
b0376e1c51e9 use get_input & get_output
Shohei KOKUBO <e105744@ie.u-ryukyu.ac.jp>
parents: 1672
diff changeset
14 cl_float2* src = (cl_float2*)s->get_input(rbuf,0);
1571
Shohei KOKUBO <e105744@ie.u-ryukyu.ac.jp>
parents: 1566
diff changeset
15
1817
b0376e1c51e9 use get_input & get_output
Shohei KOKUBO <e105744@ie.u-ryukyu.ac.jp>
parents: 1672
diff changeset
16 cl_float2* dst = (cl_float2*)s->get_output(wbuf,0);
1571
Shohei KOKUBO <e105744@ie.u-ryukyu.ac.jp>
parents: 1566
diff changeset
17
1672
32bc4ea3557f set_param in multi-dimension destroy shared TaskList. make dimension parammeter x,y,z in SchedTask.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 1643
diff changeset
18 unsigned long xgid = s->x; // (unsigned long)s->get_param(0);
32bc4ea3557f set_param in multi-dimension destroy shared TaskList. make dimension parammeter x,y,z in SchedTask.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 1643
diff changeset
19 unsigned long ygid = s->y; // (unsigned long)s->get_param(1);
1557
786ab4ad682e add fft ppe example
Shohei KOKUBO <e105744@ie.u-ryukyu.ac.jp>
parents:
diff changeset
20
1643
6c0b6947c231 fix fft
Shohei KOKUBO <e105744@ie.u-ryukyu.ac.jp>
parents: 1627
diff changeset
21 long n = (long)s->get_param(3);
6c0b6947c231 fix fft
Shohei KOKUBO <e105744@ie.u-ryukyu.ac.jp>
parents: 1627
diff changeset
22
6c0b6947c231 fix fft
Shohei KOKUBO <e105744@ie.u-ryukyu.ac.jp>
parents: 1627
diff changeset
23 unsigned int iid = ygid * n + xgid;
6c0b6947c231 fix fft
Shohei KOKUBO <e105744@ie.u-ryukyu.ac.jp>
parents: 1627
diff changeset
24 unsigned int oid = xgid * n + ygid;
1557
786ab4ad682e add fft ppe example
Shohei KOKUBO <e105744@ie.u-ryukyu.ac.jp>
parents:
diff changeset
25
786ab4ad682e add fft ppe example
Shohei KOKUBO <e105744@ie.u-ryukyu.ac.jp>
parents:
diff changeset
26 dst[oid] = src[iid];
786ab4ad682e add fft ppe example
Shohei KOKUBO <e105744@ie.u-ryukyu.ac.jp>
parents:
diff changeset
27
786ab4ad682e add fft ppe example
Shohei KOKUBO <e105744@ie.u-ryukyu.ac.jp>
parents:
diff changeset
28 return 0;
786ab4ad682e add fft ppe example
Shohei KOKUBO <e105744@ie.u-ryukyu.ac.jp>
parents:
diff changeset
29 }