Part of the Khronos Group
OpenGL.org

The Industry's Foundation for High Performance Graphics

from games to virtual reality, mobile phones to supercomputers

Page 1 of 2 12 LastLast
Results 1 to 10 of 12

Thread: Creating a context on a specified GPU

  1. #1
    Junior Member Newbie
    Join Date
    Oct 2008
    Location
    Bordeaux - France
    Posts
    21

    Creating a context on a specified GPU

    Hi,
    I'd like to create a context on a specified GPU but I don't know how to proceed. Can someone enlight me?

  2. #2

  3. #3
    Junior Member Newbie
    Join Date
    Oct 2008
    Location
    Bordeaux - France
    Posts
    21

    Re: Creating a context on a specified GPU

    Ok for Linux (XOpenDisplay( ":0.x" ) where x stands for the GPU right?).
    how about Windows.

  4. #4
    Advanced Member Frequent Contributor
    Join Date
    Apr 2003
    Posts
    652

    Re: Creating a context on a specified GPU

    NVidia (Quadro only): WGL_NV_GPU_affinity
    ATI: WGL_AMD_gpu_association

  5. #5
    Junior Member Newbie
    Join Date
    Oct 2008
    Location
    Bordeaux - France
    Posts
    21

    Re: Creating a context on a specified GPU

    @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.

  6. #6

    Re: Creating a context on a specified GPU

    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.

  7. #7
    Junior Member Newbie
    Join Date
    Oct 2008
    Location
    Bordeaux - France
    Posts
    21

    Re: Creating a context on a specified GPU

    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...

  8. #8
    Junior Member Regular Contributor
    Join Date
    Jan 2004
    Location
    Czech Republic, EU
    Posts
    190

    Re: Creating a context on a specified GPU

    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

  9. #9
    Advanced Member Frequent Contributor
    Join Date
    Apr 2003
    Posts
    652

    Re: Creating a context on a specified GPU

    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.
    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:
    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.

  10. #10
    Junior Member Regular Contributor
    Join Date
    Jan 2004
    Location
    Czech Republic, EU
    Posts
    190

    Re: Creating a context on a specified GPU

    Oh, I see. Thanks for clearing that up.
    (usually just hobbyist) OpenGL driver developer

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •