clCreateProgramWithSource deletes context?


My application has multiple kernels that I compile from different source files using clCreateProgramWithSource. However, after my second call to clCreateProgramWithSource, gDebugger is reporting my CL context as being deleted.
I have note made any call to clReleaseContext, and tried putting a breakpoint on it in gDebugger to check if it was called somewhere.
So I am wondering what can trigger a context deletion?

Thanks in advance!

have you checked all errorcodes. Most of the time the context is lost because of an error. If you try to compile the sources in multiple instances you also have to check CL_DEVICE_AVAILABLE. It could be a problem also.

Thanks for your reply clint3112.

I found out that I was releasing the program after creating it which apparently caused the lost of context. However, OpenCL didn’t return any errors upon using the context for creating other kernels and my application could still run even after the context deletion… I guess OpenCL still has a lot to do in terms of error reporting, but anyway problem solved, thanks!