how to check if CUDA context is already current.

How can I check if the cuda context I have, is already current to the current host thread.

In the manual I saw a CUDA_ERROR_CONTEXT_ALREADY_CURRENT, but no api seems to be returning it.

I tried pushing a context using cuCtxPushCurrent(context) for a context that is already current and it gives me a CUDA_ERROR_INVALID_VALUE as the error code.

Thanks in advance.

bump sorry for bumping. anyone on this?