Hello everyone,
I am currently trying to write my first OpenCL program, although it’s been a while I am stuck at one point. My program reads data from a file, then sends it to a kernel along with its size.
Here is the code for the creation of the kernel to hold the data read from the file (which is the pointer ‘data’) and another buffer to hold the output of the kernel:
mem1 = clCreateBuffer(ctx, CL_MEM_READ_WRITE | CL_MEM_COPY_HOST_PTR, sizeof(cl_uchar)*readSize, data, &ciErr1);
mem2 = clCreateBuffer(ctx, CL_MEM_WRITE_ONLY | CL_MEM_COPY_HOST_PTR, sizeof(cl_short)*readSize, out, &ciErr1);
readSize (as you can guess… ) is the size of the read data, which is a 500x10 matrix of unsigned chars.
Then, the program sets the argument values:
clSetKernelArg(ckKernel, 0, sizeof(cl_mem), (void*)&mem1);
clSetKernelArg(ckKernel, 1, sizeof(cl_uint), (void*)&blocksize);
clSetKernelArg(ckKernel, 2, sizeof(cl_mem), (void*)&mem2);
clSetKernelArg(ckKernel, 3, sizeof(cl_char), (void*)&cols);
clSetKernelArg(ckKernel, 4, sizeof(cl_char), (void*)&rows);
Afterwards, the kernel is launched:
clEnqueueNDRangeKernel(cqCommandQueue, ckKernel, 1, NULL, &glob_wsize, NULL, 0, NULL, NULL);
with global worksize = 5000.
I have been struggling to find out why after this last instruction I am getting an invalid command queue.
I hope somebody can help me!!
Thanks a lot.
caseClosed