CL_DEVICE_NOT_AVAILABLE when creating CLContext with 64-bit Java on GTX 970

classic Classic list List threaded Threaded
22 messages Options
12
Reply | Threaded
Open this post in threaded view
|

Re: CL_DEVICE_NOT_AVAILABLE when creating CLContext with 64-bit Java on GTX 970

gouessej
Administrator
Do such things work well with AMD too?
Julien Gouesse | Personal blog | Website
Reply | Threaded
Open this post in threaded view
|

Re: CL_DEVICE_NOT_AVAILABLE when creating CLContext with 64-bit Java on GTX 970

Wade Walker
Administrator
In reply to this post by tinkerthinker
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.
12