On Tue, 1 May 2012 16:38:42 -0400, Frédéric Bastien <[email protected]> wrote:
> If I do not call pycuda.autoinit, I get this error:
> 
> LogicError: explicit_context_dependent failed: invalid context - no
> currently active context?
> 
> 
> If I try to manually init the driver like show in the doc like this:
> 
> import pycuda.driver as cuda
> cuda.init() #init pycuda driver
> current_dev = cuda.Device(device_nr) #device we are working on
> ctx = current_dev.make_context() #make a working context
> ctx.push() #let context make the lead
> 
> I get this error:
> 
> LogicError: cuCtxCreate failed: invalid device
> 
> 
> I'm triing to force to always initialize pycuda gpu first. I can do it
> , but it is not easy. So if someone remember how or can find where we
> explained how to tell pycuda to reuse the current open context, it
> would be great.

There's a new method Context.attach(), which attaches to (and returns) the
currently active context. This should do what you need, I think. Please
let me know whether this works--otherwise I'll revert this change.

Thanks,
Andreas

Attachment: pgp3e08gFd4bA.pgp
Description: PGP signature

_______________________________________________
PyCUDA mailing list
[email protected]
http://lists.tiker.net/listinfo/pycuda

Reply via email to