Thanks Andreas, I hadn't come across that before. I had previously been forking with multiprocessing as often needed, so I got around this problem by forking once before any CUDA context was created and keeping the process persistent in the background. So now I just send a message to the background process whenever I need it to start working, which seems to work just fine.

Thanks for your help!


Brendan


On 07.06.2012 17:21, Andreas Kloeckner wrote:
w...@synchroverge.com writes:

Hi everyone,

This has been causing me problems for a few weeks now, and I'm hoping
someone would be able to shed some light on it.  I need to run some
CPU-intensive tasks in the background while launching GPU kernels in the main loop of a project I'm working on, so I've been trying to offload to a multiprocessing process. But it seems what whenever I try to launch a kernel while the background process is active, the kernel fails to get
the correct results (does not throw any errors).  Once the kernel
returns wrong results once, it continues to fail for the remainder of the run, even if the background process has already finished and joined.

I've put together a small code sample to demonstrate this [attached].

Is this known behaviour, and if so, is there any workaround I can use?
Or am I doing something completely wrong?

Forking a process that has an active CUDA context is undefined behavior.

Andreas


_______________________________________________
PyCUDA mailing list
PyCUDA@tiker.net
http://lists.tiker.net/listinfo/pycuda

Reply via email to