OpenCl code works on a machine but I am getting CL_INVALID_KERNEL_ARGS on another
c, c++, opencl
Solution
How large are the buffer objects you are passing? `__constant` arguments are allocated from separate memory space and not from global memory so therefore you have probably ran out of constant memory.
The spec mandates that in full profile the device must support at minimum 4 `__constant` arguments with 64kB total in size. In embedded profile it's dropped to 1kB.
You can query the amount of constant memory available by checking the `CL_DEVICE_MAX_CONSTANT_BUFFER_SIZE` using `clGetDeviceInfo`. Most likely your devices support way more than this minimum requirement.
In most cases you should use the constant buffer if you are able as in general it is quite a lot faster than global memory.
In future you should provide more information on your question. Because if the error is `CL_INVALID_KERNEL_ARGS` one really needs to know what are the arguments to your kernel.
Problem
I had the following code, which works well on a machine but I when I try to run it on another machine with better graphics card I am getting errors: ``` global[0] = 512; global[1] = 512; local [0] = 16; local [1] = 16; ciErrNum = clEnqueueNDRangeKernel(commandQueue, myKernel, 2, NULL, global, local, 0, NULL, &event); ``` Errors: ``` Error @ clEnqueueNDRangeKernel: CL_INVALID_KERNEL_ARGS Error @ clWaitForEvents: CL_INVALID_KERNEL_ARGS ``` Any idea what is the problem?