On Fri, 27 Apr 2012 22:09:47 -0400, Andrew Cron <andrew.j.c...@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)
> 
>     thd.start()
>     thd.join()
> 
> 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
'08:

http://forums.nvidia.com/index.php?showtopic=83219

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.

Andreas

Attachment: pgpsJb8LbG8SM.pgp
Description: PGP signature

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

Reply via email to