Question

I'm working through the HelloWorld example in the OpenCl Programming Guide and I keep getting an EXC_BAD_ACCESS when I try to run this function (clSetKernelArg). The look of my function is basically...

clSetKernelArg(mKernel, 0, sizeof(cl_mem), mMemObject[0]);

In the debugger everything looks to be instantiated. There's nothing null inside of the parenthesis and I'm all out of ideas. Any help would be greatly appreciated.

Was it helpful?

Solution

If you are going trough an OpenCL Hello World example I am almost certain that you do not have

cl_mem * mMemObject[foo]

That would be the only thing that would make the mMemObject[0] declaration legal. EXC_BAD_ACCESS implies that you are dereferencing an invalid pointer, and this implies that your mMemObject is just cl_mem.

This works if you have declared mMemObject simply with cl_mem mMemObject:

clSetKernelArg(mKernel, 0, sizeof(cl_mem), &mMemObject);
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top