Mercurial > hg > Game > Cerium
view example/fft/ppe/spinFact.cc @ 1672:32bc4ea3557f draft
set_param in multi-dimension destroy shared TaskList. make dimension parammeter x,y,z in SchedTask.
author | Shinji KONO <kono@ie.u-ryukyu.ac.jp> |
---|---|
date | Thu, 18 Jul 2013 11:20:51 +0900 |
parents | 6c0b6947c231 |
children | b0376e1c51e9 |
line wrap: on
line source
#include <math.h> #include "spinFact.h" #ifdef __APPLE__ #include <OpenCL/opencl.h> #else #include <CL/cl.h> #endif #include "Func.h" #define PI 3.14159265358979323846 #define PI_2 1.57079632679489661923 SchedDefineTask1(spinFact,spinFact); static int spinFact(SchedTask* s,void* rbuf,void* wbuf) { cl_float2* w = (cl_float2*)s->get_outputAddr(0); unsigned long i = s->x; // (unsigned long)s->get_param(0); long n = (long)s->get_param(3); cl_float2 angle; angle.x = (float)(2*i*PI/(float)n); angle.y = (float)((2*i*PI/(float)n) + PI_2); w[i].x = cos(angle.x); w[i].y = cos(angle.y); return 0; }