Sample Header Ad - 728x90

Force graphics to run on specific GPU

3 votes
1 answer
7769 views
My computer has one integrated graphics card and 2 Nvidia RTX 3070 GPUS. I am using Ubuntu 20.04 and nvidia-driver-530.
lspci | grep VGA
00:02.0 VGA compatible controller: Intel Corporation AlderLake-S GT1 (rev 0c)
01:00.0 VGA compatible controller: NVIDIA Corporation GA104 [GeForce RTX 3070 Lite Hash Rate] (rev a1)
05:00.0 VGA compatible controller: NVIDIA Corporation GA104 [GeForce RTX 3070 Lite Hash Rate] (rev a1)
I am currently trying to test my 3070 graphics cards with the Phoronix Test Suite. I am using nvidia-prime and prime-select: on-demand to run the terminal on the intel iGPU and phoronix tests on the Nvidia 3070: prime-run phoronix-test-suite run unigine-heaven. There were some issues getting nvidia-prime to work, so I followed the suggestions from this article: https://askubuntu.com/questions/1364762/prime-run-command-not-found
cat /usr/bin/prime-run
#!/bin/bash
export __NV_PRIME_RENDER_OFFLOAD=1
export __GLX_VENDOR_LIBRARY_NAME=nvidia
export __VK_LAYER_NV_optimus=NVIDIA_only
export VK_ICD_FILENAMES=/usr/share/vulkan/icd.d/nvidia_icd.json
exec "$@"
By using prime-run I am successfully able to run the phoronix test suite on GPU 0 which has bus id 01:00.0 / PCI:1:0:0. However, I seem unable to run any tests with GPU 1 which has bus id 05:00.0 / PCI:5:0:0. Modifying /etc/X11/xorg.conf by changing the bus number and rebooting as suggested by the following links didn't seem to do anything and still ran on GPU 0. - https://stackoverflow.com/questions/18382271/how-can-i-modify-xorg-conf-file-to-force-x-server-to-run-on-a-specific-gpu-i-a - https://askubuntu.com/questions/787030/setting-the-default-gpu
cat /etc/X11/xorg.conf
# nvidia-xconfig: X configuration file generated by nvidia-xconfig
# nvidia-xconfig:  version 530.41.03

Section "ServerLayout"
    Identifier     "Layout0"
    Screen      0  "Screen0"
    InputDevice    "Keyboard0" "CoreKeyboard"
    InputDevice    "Mouse0" "CorePointer"
EndSection

Section "Files"
EndSection

Section "InputDevice"
    # generated from default
    Identifier     "Mouse0"
    Driver         "mouse"
    Option         "Protocol" "auto"
    Option         "Device" "/dev/psaux"
    Option         "Emulate3Buttons" "no"
    Option         "ZAxisMapping" "4 5"
EndSection

Section "InputDevice"
    # generated from default
    Identifier     "Keyboard0"
    Driver         "kbd"
EndSection

Section "Monitor"
    Identifier     "Monitor0"
    VendorName     "Unknown"
    ModelName      "Unknown"
    Option         "DPMS"
EndSection

Section "Device"
    Identifier     "Device0"
    Driver         "nvidia"
    VendorName     "NVIDIA Corporation"
#    BusID          "PCI:1:0:0"
    BusID          "PCI:5:0:0"
EndSection

Section "Screen"
    Identifier     "Screen0"
    Device         "Device0"
    Monitor        "Monitor0"
    DefaultDepth    24
    SubSection     "Display"
        Depth       24
    EndSubSection
EndSection
In fact, I deleted etc/X11/xorg.conf and was able to run the phoronix tests on GPU 0 without the conf file at all. I would guess that one of the drivers or programs I run automatically selects the nvidia card with the lowest bus id. I would like to know where I should look to change the settings or any configuration files in order to select the second RTX 3070 gpu with the bus id 05:00.0. I would be more than happy to provide any further information.
Asked by jameszp (93 rep)
Apr 24, 2023, 07:05 PM
Last activity: Apr 27, 2023, 05:37 PM