view example/fft/ppe/norm.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 724fd3c1ac92
children 614c60736bfd
line wrap: on
line source

#include "norm.h"
#ifdef __APPLE__
#include <OpenCL/opencl.h>
#else
#include <CL/cl.h>
#endif
#include "Func.h"
SchedDefineTask1(norm,norm);

static int
norm(SchedTask* s, void* rbuf,void* wbuf)
{
    cl_float2* in_x = (cl_float2*)s->get_inputAddr(0);

    cl_float2* out_x = (cl_float2*)s->get_outputAddr(0);

    unsigned long gid = s->x; // (unsigned long)s->get_param(0);
    unsigned long nid = s->y; //(unsigned long)s->get_param(1);

    long n = (long)s->get_param(3);
    if(nid == 100) {
        printf("norm nid=%ld,gid=%ld,n=%ld\n",nid,gid,n);
    }
    out_x[nid*n+gid].x = in_x[nid*n+gid].x / (float)n;
    out_x[nid*n+gid].y = in_x[nid*n+gid].y / (float)n;

    return 0;
}