On Wed, 23 Jun 2010 14:14:37 -0400, Lev Givon <l...@columbia.edu> wrote: > Is there some way to get PyCUDA to attach to a preexisting context (i.e., > one created by some other CUDA-dependent library)?
Since the context is never explicitly specified as an argument to actual functionality, in principle you could just have the library create the context and then use the non-context-managing parts of PyCUDA without a problem. Unfortunately, that doesn't work in real life. To get garbage collection right in the face of multiple contexts, PyCUDA must assume there *is* a context and try to restore it at destruction time of every object created. This obviously interferes with the plan above. <comment> I think this whole context-is-implicit thing is CUDA's worst design flaw, and should be fixed somehow. </comment> Anyway, the solution I propose is to introduce a flag into PyCUDA to tell it to not attempt to manage any contexts, which is what you want if you're interacting with the runtime. This takes two parts: 1) creating a flag in PyCUDA that turns off all the context management bits. 2) an interface to turn on the flag, checking that no context has yet been created. If you need this *right now*, please send a patch, otherwise it'll get done as soon as I have time. Andreas
pgp0IbGbD3WFV.pgp
Description: PGP signature
_______________________________________________ PyCUDA mailing list PyCUDA@tiker.net http://lists.tiker.net/listinfo/pycuda