[PyCUDA] Multiprocessing + PyCUDA + MAC OSX
lists at informa.tiker.net
Mon Apr 30 09:44:01 PDT 2012
On Fri, 27 Apr 2012 22:09:47 -0400, Andrew Cron <andrew.j.cron at gmail.com> wrote:
> I'm working on some multi GPU software, and I've run into a snag on
> OSX. (Note that this works on Linux.) Here's some sample code:
> import multiprocessing
> import pycuda.driver as drv
> drv.init() ## COMMENT THIS LINE AND IT RUNS FINE
> if __name__=="__main__":
> def tar():
> print drv.Device(0).make_context()
> thd = multiprocessing.Process(target=tar)
> This code produces the following error:
> LogicError: cuDeviceGet failed: not initialized
> I want to be able to keep the first "drv.init()" so that my code will
> play nice with other pycuda software on the host thread. My guess is
> the source of the issue is related to how multiprocessing clones the
> parent process. It probably does something weird to pycuda.
> Any suggestions? Thanks a ton in advanced for your help!!
Turns out I asked this exact question of Nvidia at some point in late
Judging from the replies I got, I don't think this is defined behavior
in any sense, so the fact that it works on Linux is pure coincidence. I
think you'll have to stick to fork-then-init, unfortunately.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Size: 189 bytes
Desc: not available
More information about the PyCUDA