Problem of GPU affinity on Multi-GPU system


Our team is working on parallel off-screen rendering. We are going to run it on the cluster, each node of the cluster has two GPUs NVIDIA Tesla k40. The rendering on the node is performed in parallel: each thread renders the part of the scene and after that blending takes place. The rendering is based on OpenGL.

Therefore we have a problem: how can we assign separate GPU to separate thread of rendering?

We know, that there is an extension WGL_NV_gpu_affinity, but as we know, it is for Windows (we work under Linux) and is supported by Quadro only.

The document recommends for Linux systems to retrieve separate X-screen for each thread with XOpenDisplay function. But this solution meets difficulties in our case: we do not have administrator’s rights on the cluster, so we are not able to create new X-displays

Therefore, if is there exist another approach to bind OpenGL context to specific GPU?

And one more question. We are using CUDA in the same rendering thread for scene pre-calculation. We are able to bind the thread to GPU with cudaSetDevice. Is it possible force the thread to work with the same GPU in the case of CUDA and in the case of OpenGL context in the same thread?

Thank you.

I’d recommend using EGL with EGLDevice if possible. This will allow you to create OpenGL contexts directly on specific GPUs. You can then use EGL_NV_device_cuda to correlate GPUs in EGL and CUDA to ensure you are running your compute and graphics workloads on the same GPU.

1 Like

Thank you! We will try it.