Hi,
I'd like to create a context on a specified GPU but I don't know how to proceed. Can someone enlight me?
Hi,
I'd like to create a context on a specified GPU but I don't know how to proceed. Can someone enlight me?
Ok for Linux (XOpenDisplay( ":0.x" ) where x stands for the GPU right?).
how about Windows.
NVidia (Quadro only): WGL_NV_GPU_affinity
ATI: WGL_AMD_gpu_association
@skynet:
I won't use extensions as I want to create my context on the specified GPU before any call to OpenGL functions.
I found this for Windows:
http://msdn.microsoft.com/en-us/libr...8VS.85%29.aspx
I haven't taken a look at it yet.
You need to use these extension if you want to create a context on a specific GPU. I know it's weird, but here is what has to be done:
- Create non-affinity context on the GPU you want to use
- Query extension pointers
- Destroy non-affinity context
- Create affinity context using extension.
We use this approach successfully in Equalizer.
This only works on Windows and moreover only for Nvidia Quadro cards.
Isn't it sufficient to only use the non-affinity context? Especially if I don't want to do multi-pipe rendering.
Anyway if someone wants a code snippet for the Windows part...
By default, the GPU on Windows is assigned based on the monitor a context is created on. Setting the position and size of your window to be entirely on the desired monitor should do the trick.
(usually just hobbyist) OpenGL driver developer
That is not true. Since the diver has to expect that you move the window from one monitor another _at any time_ (your window might even straddle two GPUs!), it will prepare to do rendering on any available GPU. That means it needs to:By default, the GPU on Windows is assigned based on the monitor a context is created on. Setting the position and size of your window to be entirely on the desired monitor should do the trick.
1. Create copies of all resources (VBOs, textures, FBOs etc) on all GPUs
2. Copy changed data around (RTT comes to mind here... can become slow as hell this way)
This is certainly not the behaviour you want. When you ask the system to do rendering on one certain GPU, you expect the other GPU(s) to be completely free for other stuff. On Windows NV_gpu_affinity and AMD_gpu_association are the only way to talk to a specific GPU.
Oh, I see. Thanks for clearing that up.
(usually just hobbyist) OpenGL driver developer