Floating Context Problem on Windows XP

Hi gentlemen,

i have a problem with the floating cuda context.

Code Sample:
Thread A:
cuCtxCreate(&cuDeviceContext, CU_CTX_SCHED_AUTO, cuDeviceHandle);
cuCtxPopCurrent(NULL);
//This will be succeeded !

Thread B:
cuCtxPushCurrent(cuDeviceContext);
… allocate memory or something
cuCtxPopCurrent(NULL);
//This will be succeeded !

Thread C:
cuCtxPushCurrent(cuDeviceContext);
//at this code position the return value is CUDA_ERROR_INVALID_VALUE


Also when I try:

Thread B:
cuCtxPushCurrent(cuDeviceContext);
… allocate memory or something
cuCtxPopCurrent(NULL);
cuCtxPushCurrent(cuDeviceContext);
//at this code position the return value is CUDA_ERROR_INVALID_VALUE

Have anybody a idea what is wrong ?

Thanks and Regards

Mirek

I am also facing a similar issue with floating context.
For cuCtxPopCurrent API, it should return the context handle in the argument. So instead of passing NULL to this function, did you check what this API returns as context handle. I do something like this

CUcontext ctx;
cuCtxPopCurrent(&ctx);

Then I get NULL in ctx, which I guess is a bug. Has anyone else verified this?
Anyone from NVIDIA can answer this?

Regards
Sandeep

correct, cuCtxPopCurrent doesn’t do what it’s documented to do in 2.1. it will be fixed in 2.2.