Choosing which GPU to render on

I was wondering if it is possible to select the GPU index while creating the render window in VTK, and looking around the documentation it appears that it may not be possible to do so?

I know that there’s a GPU affinity extension for OpenGL provided by NVIDIA that can achieve that. Does VTK allow something for similar as well? Or, is it possible to create my own context and pass that to the VTK renderer. Has anyone tried this before?

Thanks!

Hello @Chahat_Kalsi

I don’t know if the API allows that directly, however as you suggested it’s possible to use an external openGL context by using the vtkExternalRenderWindow.

Best,

If you render through EGL you can set
VTK_DEFAULT_EGL_DEVICE_INDEX environment variable or
SetDeviceAsDisplay API to specify the GPU you want to render on. See
vtkEGLRenderWidnow

Dan