cuCtxCreate を介して cuda コンテキストを作成すると、CUDA_ERROR_INVALID_DEVICE エラーが発生します。
私のコードは、コンテキストを作成し、そこからデバイスを取得して、新しいコンテキストを作成しています。
別のコンテキストを作成できない理由はありますか?
#include<cuda.h>
#include<assert.h>
int main(){
cuInit(0);
CUcontext ctx;
CUdevice device;
CUdevice dev2;
CUcontext c2;
assert(cuDeviceGet(&device,0) == 0 );
assert(cuCtxCreate(&ctx, 0, device) == 0);
assert(cuCtxGetDevice(&dev2) == 0);
assert(cuCtxCreate(&c2,0,dev2) == 0);
return 0;
}