parallel processing - OpenCL Kernel Error -11 -


i'm new opencl , i'm trying parallelise edge detection program.i'm trying write kernel edge detection function. original function:

void edgedetection(float *out, float *in, int w, int h) {     int r,c;     (r = 0; r < h-2; r++) {         (c = 0; c < w-2; c++) {             float g;             float* pout = &out[r*w + c];             float gx = 0.0;             float gy = 0.0;              int fr,fc;             /* run 2d-convolution filter */             (fr = 0; fr < 3; fr++) {                 (fc = 0; fc < 3; fc++) {                     float p = in[(r+fr)*w + (c+fc)];                     /* x-directional edges */                     gx += p * f[fr*3 + fc];                     /* y-directional edges */                     gy += p * f[fc*3 + fr];                 }             }             /* edges, pythagoral sum */             g = sqrtf(gx*gx + gy*gy);             *pout = g;         }     } } 

my opencl kernel:

__kernel  void edgedetection(__global float *out,  __global float *in, int w, int h) {     // work-item’s unique id    const int r = get_global_id(0);    const int c = get_global_id(1);    if(r>=0 && c>=0 && r<h-2 && c<w-2){             float g;             float* pout = &out[r*w + c];             float gx = 0.0;             float gy = 0.0;              int fr,fc;              (fr = 0; fr < 3; fr++) {                 (fc = 0; fc < 3; fc++) {                      float p = in[(r+fr)*w + (c+fc)];                      gx += p * f[fr*3 + fc];                      gy += p * f[fc*3 + fr];                 }             }             g = sqrtf(gx*gx + gy*gy);             *pout = g;    } } 

when try build program .cl file using this(chk function check if there failures/errors):

status = clbuildprogram(program, 1, &device, null, null, null); chk(status, "clbuildprogram"); 

i error saying, "clbuildprogram failed (-11)". researches, i've seen commonly tought error caused syntax error. however, after checking many times cannot see particularly wrong kernel. can me figure out what's wrong it?

there many errors in code:

1)

float* pout = &out[r*w + c]; 

this invalid, should be:

__global float* pout = &out[r*w + c]; 

2) using f in kernel never defined.

3) sqrtf not defined in cl, did mean sqrt instead?


Comments

Popular posts from this blog

javascript - How to get current YouTube IDs via iMacros? -

c# - Maintaining a program folder in program files out of date? -

emulation - Android map show my location didn't work -