I'm running the following code:
cuCtxCreate(&context, CU_CTX_SCHED_YIELD, device);
int driverVersion = -1;
int driverVersionRt = -1;
int rtVersion = -1;
unsigned int ctxVersion = 1;
cuDriverGetVersion(&driverVersion);
cudaDriverGetVersion(&driverVersionRt);
cudaRuntimeGetVersion(&rtVersion);
cuCtxGetApiVersion(context, &ctxVersion);
std::cout << "cuDriverGetVersion: " << driverVersion << std::endl;
std::cout << "cudaDriverGetVersion: " << driverVersionRt << std::endl;
std::cout << "cudaRuntimeGetVersion: " << rtVersion << std::endl;
std::cout << "cuCtxGetApiVersion: " << ctxVersion << std::endl;
Here is the output:
cuDriverGetVersion: 10010
cudaDriverGetVersion: 10010
cudaRuntimeGetVersion: 10000
cuCtxGetApiVersion: 3020
From the documentation, I can see that cudaDriverGetVersion
, cuDriverGetVersion
, and cudaRuntimeGetVersion
return values of the form (1000 * major + 10 * minor). The documentation does not specify what cuCtxGetApiVersion
should return, but I assume it should be the same as the other three functions.
My question is why is the version number for the context 3020, when all the others are using 10000 and 10010? Is this how it should be?
I am having another issue where new threads that I create need to have their context shared manually, otherwise I get a 201 (invalid context) error. This is strange because I know past CUDA 4.0 all processes have one context per device per process. So I should not have to set the context for new threads that I am creating within the same process. Because cuCtxGetApiVersion
is producing 3020, this leads me to believe that the context I created is using an old incorrect version, which would not have the functionality of being shared across threads.
Is this a possibility?