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.


Thanks,
bryan

cuInit
cuDeviceGetCount
cuDeviceGetCount
cuDeviceGet
cuCtxCreate
---> context_stack::push() 0x2a6370
cuCtxGetDevice
cuMemAlloc
---> context::current_context() valid 
cuCtxGetDevice
cuDeviceGetAttribute
cuDeviceGetAttribute
cuDeviceComputeCapability
cuDeviceGetAttribute
cuDeviceGetAttribute
cuDeviceGetAttribute
cuMemcpyHtoD
cuCtxGetDevice
cuDeviceComputeCapability
cuModuleLoadDataEx
---> context::current_context() valid 
cuModuleGetFunction
cuMemAlloc
---> context::current_context() valid 
cuCtxGetDevice
cuMemcpyHtoD
cuFuncSetBlockShape (radix_sort_iteration00Entry)
cuParamSetv (radix_sort_iteration00Entry)
cuParamSetSize (radix_sort_iteration00Entry)
cuLaunchGrid (radix_sort_iteration00Entry)
cuMemcpyDtoH
---> ~module()
---> context::current_context() valid 
---> scoped_context_activation()  Current context: 0x2a6370 Given context: 
0x2a6370
---> context::current_context() valid 
cuModuleUnload
cuCtxGetDevice
cuMemcpyDtoH
cuCtxGetDevice
cuDeviceComputeCapability
cuModuleLoadDataEx
---> context::current_context() valid 
cuModuleGetFunction
cuMemAlloc
---> context::current_context() valid 
cuCtxGetDevice
cuMemcpyHtoD
cuFuncSetBlockShape (radix_sort_iteration10Entry)
cuParamSetv (radix_sort_iteration10Entry)
cuParamSetSize (radix_sort_iteration10Entry)
cuLaunchGrid (radix_sort_iteration10Entry)
cuMemcpyDtoH
cuCtxGetDevice
cuMemcpyDtoH
--->atexit is calling context.pop()
cuCtxPopCurrent
---> context::current_context() valid 
---> context::pop()
---> context_stack::pop()
---> context::current_context() stack empty 
---> ~module()
---> context::current_context() stack empty 
---> scoped_context_activation()  Current context: 0 Given context: 0x2a6370
---> context::current_context() stack empty 
---> context_push() 0x995a00
cuCtxPushCurrent
terminate called after throwing an instance of 'cuda::error'
  what():  cuCtxPushCurrent failed: invalid value

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)
> 
> Andreas

Attachment: smime.p7s
Description: S/MIME cryptographic signature

_______________________________________________
PyCUDA mailing list
pyc...@host304.hostmonster.com
http://host304.hostmonster.com/mailman/listinfo/pycuda_tiker.net

Reply via email to