should I be able to run driver api functions on a runtime api context?

Based on the documentation, it seems that device interface based function (cu…) should be able to run on a context create using the CUDA runtime (cudaSetDevice). It’s not clear if I should call cuCtxGetCurrent first or not though. The problem is that when I try to run a cuda driver api function on a context created with cudaSetDevice I’m getting and unhandled exception error:

Unhandled exception at 0x77e415de in decoderBug.exe: 0xC0000005: Access violation reading location 0x00001308.

Any ideas, should this be possible, if so, am I missing something? (tried cuCtxGetCurrent, also tried calling cuCtxPushCurrrent on this context, made sure that cuCtxGetCurrent returns success and a non-zero context).

I’m trying to run the decoder code in this case, so what’s causing problems is:

cuvidCreateDecoder(&decoder, &videoDecodeCreateInfo); // <== this throws the exception

Tried with both CUDA 4.1 and 4.2 under windows 7 64bit.


Did you try without cudaSetDevice()?

cuvidCreateDecoder(&decoder, &videoDecodeCreateInfo); may create the context for you.

Doesn’t work without cudaSetDevice (no context)
Works with cuCtxCreate and cuCtxPushContext (there is an active driver api context)
Fails with cudaSetDevice with an access violation