Re: CL_DEVICE_NOT_AVAILABLE when creating CLContext with 64-bit Java on GTX 970
Posted by
Wade Walker on
Jul 10, 2016; 6:17pm
URL: https://forum.jogamp.org/CL-DEVICE-NOT-AVAILABLE-when-creating-CLContext-with-64-bit-Java-on-GTX-970-tp4036560p4036903.html
tinkerthinker wrote
Ok, I've solved the problem. I was writing a program that forked a process after having initialized the NVIDIA device in the parent process. Apparently Nvidia OpenCL doesn't like this.
I've modified my code to delay initializing the GPU until after the fork, this allows me to run multiple concurrent OpenCL forked processes for one program. I can now create the context without getting any errors. :)
Makes sense. OpenGL (and presumably OpenCL) can store context information in a thread information block that probably can't be shared between two processes :) If you init and then fork, the two duplicate processes are trying to share a single context, and maybe interfering with each other. Even sharing contexts across threads within a process can be problematic with some drivers, though it's supposed to be possible as long as the context is only active in one thread at a time.