Expected CUDA-OpenGL interop behaviour in case of wgl_nv_gpu_affinity context

Currently we are developing HPC system with multiple Quadro GPUs which perform both computing and rendering tasks. What’s more - they should render to the multiGPU mosaic display.
Currently everything works fine with only one GPU: CUDA-tasks perform required computing and generate output 2D-surfaces, while OpenGL texture is updated via CUDA interop (at the init stage textures are registered via cudaGraphicsGLRegisterImage and are updated using cudaGraphicsMapResources/cudaGraphicsUnmapResources and cudaGraphicsSubResourceGetMappedArray).
The matter of question is how would behave this kind of interop in case when OpenGL context has affinity mask which contains multiple GPUs while - which is obvious - CUDA context used for map/unmap operations belongs to only one of these GPUs? Can I expect that OpenGL resources will map to the CUDA resources of the same GPU automagically? This is the most crucial point as we would like to prevent unnecessary texture transfer between GPUs via host interface. Or will interop commands fail and do they support this kind of behaviour at all? I could not find any information about this case, so I would appreciate if someone would clarify this scenario.

Thank you.

1 Like