view example/fft/ppe/transpose.cc @ 1786:ba6ffc679a8f draft

minor fix
author Masataka Kohagura <e085726@ie.u-ryukyu.ac.jp>
date Sat, 30 Nov 2013 21:06:44 +0900
parents 32bc4ea3557f
children b0376e1c51e9
line wrap: on
line source

#include "transpose.h"
#ifdef __APPLE__
#include <OpenCL/opencl.h>
#else
#include <CL/cl.h>
#endif
#include "Func.h"

SchedDefineTask1(transpose,transpose);

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

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

    unsigned long xgid = s->x; // (unsigned long)s->get_param(0);
    unsigned long ygid = s->y; // (unsigned long)s->get_param(1);

    long n = (long)s->get_param(3);

    unsigned int iid = ygid * n + xgid;
    unsigned int oid = xgid * n + ygid;

    dst[oid] = src[iid];

    return 0;
}