I've attached the trace. Lines beginning with ---> are added instrumentation that
I put in autoinit.py and cuda.hpp. Also, my workaround has now failed - with some
versions of the code the attempt to push a bad context happened in
device_allocation::free() - and deleting objects manually helped with that. But other
times it fails in ~module(), and I'm not sure how to bypass that one.
On Mar 25, 2010, at 7:51 PM, Andreas Klöckner wrote:
On Donnerstag 25 März 2010, Bryan Catanzaro wrote:
> Hi All -
> I've been getting problems with the following error:
> terminate called after throwing an instance of 'cuda::error'
> what(): cuCtxPushCurrent failed: invalid value
> After poking around, I discovered that context.pop(), registered using
> atexit in pycuda.autoinit, is being called *before* all the destructors
> for various things created during my program.
This is by design. Since destructors may be called on out-of-context
objects, they need to make sure that 'their' context is active anyway.
In your case the context looks to have been *destroyed*, not merely
switched. Can you run your code with CUDA tracing and send the log?
(CUDA_TRACE=1 in siteconf.py)