annotate example/fft/ppe/norm.cc @ 1835:144e573b030b draft

fix fft
author Shohei KOKUBO <e105744@ie.u-ryukyu.ac.jp>
date Fri, 20 Dec 2013 03:00:32 +0900
parents b0376e1c51e9
children
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 "norm.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 SchedDefineTask1(norm,norm);
786ab4ad682e add fft ppe example
Shohei KOKUBO <e105744@ie.u-ryukyu.ac.jp>
parents:
diff changeset
9
786ab4ad682e add fft ppe example
Shohei KOKUBO <e105744@ie.u-ryukyu.ac.jp>
parents:
diff changeset
10 static int
786ab4ad682e add fft ppe example
Shohei KOKUBO <e105744@ie.u-ryukyu.ac.jp>
parents:
diff changeset
11 norm(SchedTask* s, void* rbuf,void* wbuf)
786ab4ad682e add fft ppe example
Shohei KOKUBO <e105744@ie.u-ryukyu.ac.jp>
parents:
diff changeset
12 {
1817
b0376e1c51e9 use get_input & get_output
Shohei KOKUBO <e105744@ie.u-ryukyu.ac.jp>
parents: 1674
diff changeset
13 cl_float2* in_x = (cl_float2*)s->get_input(rbuf,0);
1658
ed2fa50168ef fix fft
Shohei KOKUBO <e105744@ie.u-ryukyu.ac.jp>
parents: 1643
diff changeset
14
1817
b0376e1c51e9 use get_input & get_output
Shohei KOKUBO <e105744@ie.u-ryukyu.ac.jp>
parents: 1674
diff changeset
15 cl_float2* out_x = (cl_float2*)s->get_output(wbuf,0);
1571
Shohei KOKUBO <e105744@ie.u-ryukyu.ac.jp>
parents: 1566
diff changeset
16
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: 1669
diff changeset
17 unsigned long gid = 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: 1669
diff changeset
18 unsigned long nid = s->y; //(unsigned long)s->get_param(1);
1835
144e573b030b fix fft
Shohei KOKUBO <e105744@ie.u-ryukyu.ac.jp>
parents: 1817
diff changeset
19
144e573b030b fix fft
Shohei KOKUBO <e105744@ie.u-ryukyu.ac.jp>
parents: 1817
diff changeset
20 long n = (long)s->get_param(0);
1674
614c60736bfd fix fft
Shohei KOKUBO <e105744@ie.u-ryukyu.ac.jp>
parents: 1672
diff changeset
21
1658
ed2fa50168ef fix fft
Shohei KOKUBO <e105744@ie.u-ryukyu.ac.jp>
parents: 1643
diff changeset
22 out_x[nid*n+gid].x = in_x[nid*n+gid].x / (float)n;
ed2fa50168ef fix fft
Shohei KOKUBO <e105744@ie.u-ryukyu.ac.jp>
parents: 1643
diff changeset
23 out_x[nid*n+gid].y = in_x[nid*n+gid].y / (float)n;
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 return 0;
786ab4ad682e add fft ppe example
Shohei KOKUBO <e105744@ie.u-ryukyu.ac.jp>
parents:
diff changeset
26 }