It has been suggested by users of various software that leverage SDL that one use the following environment variables to run headless and/or off-screen on a specific GPU, where GPU_INDEX is the index of the device, e.g.
SDL_VIDEODRIVER=offscreen SDL_HINT_CUDA_DEVICE=2 ./myOpenGLBasedApp
SDL_VIDEODRIVER exists in the SDL 2.0.9 source,
SDL_HINT_CUDA_DEVICE does not, yet a google search shows the latter being suggested for use on multiple webforums. Was this variable removed in SDL 2.0 or is it somehow automatically generated and not hardcoded into the source? I ask because, for ‘C+G’ (compute + graphics) jobs in Linux seem to run on device 0 regardless of what index
SDL_HINT_CUDA_DEVICE is set to.