I am playing around with the SDK/optixPathTracer code using a multiple GPU machine. Everything is going well using DEVICE 0, however if I try and set the context to DEVICE 1 I get error code 7051.
The error output is shown below.
Optix call (optixDeviceContextCreate(cu_ctx, &options, &context)) failed with code 7051
The code where the problem appears to occur is shown below.
I created an AppScene class that contains everything that optixPathTracer.cpp has. I did this just as a learning exercise to create the scene renderer as a class.
I am sure this is probably something dumb on my behalf but I cannot seem to find any information regarding the 7051 error.
The OptiX 7 API doesn’t know about multiple GPUs. You need to make sure the proper CUDA context is selected per device before doing any OptiX operation as m001 explained.
For OptiX 7 examples using multiple GPUs, have a look into the SDK examples optixMultiGPU and optixNVlink.
For more advanced OptiX 7 examples explicitly showing multi-GPU workload distribution with different buffer allocation methods, CUDA peer-to-peer data sharing via NVLINK or PCI-E bus, and different OpenGL interop methods detecting which active GPU runs the OpenGL implementation, have a look here and read the repository’s README.md carefully: https://forums.developer.nvidia.com/t/optix-advanced-samples-on-github/48410/4
Thank you for the response. Sorry I took so long to reply, I got buried under another task.
I had wrapped the cudaSetDevice(device_id_) in the CUDA_CHECK macro but neglected to include it in the code I posted - sorry that was a mistake. The good thing though is that it was successful call.
I will give: CUresult cuRes = cuCtxGetCurrent(&cu_ctx); then passing cu_ctx to optixDeviceContextCreate a try. It is probably the problem.