I am pretty new to OpenCL.

I am trying to parallelize the following snippet:

Code :

for ( ; i < ncols - radius ; i++) {
ppp = ptrrow + i - radius;
sum = 0.0;
//for (k = kernel.width-1 ; k >= 0 ; k--)
//sum += *ppp++ * kernel.data[k];
sum = ppp[0] * kernel.data[kernel.width-1] + ppp[1] * kernel.data[kernel.width-2]
+ ppp[2] * kernel.data[kernel.width-3] + ppp[3] * kernel.data[kernel.width-4]
+ ppp[4] * kernel.data[kernel.width-5] + ppp[5] * kernel.data[kernel.width-6]
+ ppp[6] * kernel.data[kernel.width-7];
*ptrout++ = sum;
}

I have written the following kernel for the same:

Code :

__kernel void convolveImageHoriz(__global float *ppp, __global float *ptrrow, __global float *ptrout, __global float *Kernel, int nrows, int width, int ncols)
{
int i = get_global_id(0);
int radius = width/2;
float sum;
if (i >= radius && i < nrows-radius)
{
ppp = ptrrow + i - radius;
sum = 0.0;
sum = ppp[0] * Kernel[width-1] + ppp[1] * Kernel[width-2]
+ ppp[2] * Kernel[kernel.width-3] + ppp[3] * Kernel[width-4]
+ ppp[4] * Kernel[width-5] + ppp[5] * Kernel[width-6]
+ ppp[6] * Kernel[width-7];
ptrout[i] = sum;
}
}

I know for a fact that there is some issue in the Kernel as the code runs fine when I run some other Kernel.

Could someone help? ]]>

I am pretty new to OpenCL. I am having some problems with the clBuildProgram function. In my case, the program is not getting built and the error code is giving the error CL_BUILD_PROGRAM_FAILURE.

I am trying to parallelise the following code snippet:

for (k = kernel.width-1 ; k >= 0 ; k--)

sum += *ppp++ * kernel.data[k];

This is the kernel code that I have written for parallelizing the same:

__kernel void convolveImageHoriz(__global float *ppp, __global float *kernel, float sum, int width)

{

int k = get_global_id(0);

if (k >= 0 && k < width)

{

sum = ppp[width-k-1] * kernel[k];

}

}

I know for a fact that there is an issue with my Kernel code because when I load some other working kernel, then the program builds successfully.

I am under a deadline so I would request someone to respond quickly. ]]>