Skip to content

This repo shows how to enable multi-gpu video output for Nvidia graphics cards with nvidia2nvidia PRIME.

Notifications You must be signed in to change notification settings

mau5atron/nvidia_multi_gpu

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 

Repository files navigation

Enabling Multi-GPU Monitor Output in Linux with PRIME

This repo will show how you can use multiple GPUs for video output in Linux.

My current system specs:

Operating System: Linux Mint 20.3 Cinnamon
Cinnamon Version: 5.2.7
Linux Kernel: 5.4.0-117-generic
Processor: Intel© Core™ i9-9980XE CPU @ 3.00GHz × 18
Memory: 62.5 GiB
Graphics Cards: NVIDIA RTX 3080 Ti, NVIDIA RTX 2080

Display Configuration:

    RTX 3080 Ti:
        - Acer XV340CK P (3440x1440)

    RTX 2080:
        - LG 32GK650G (2560x1440)
        - LG Ultrawide (2560x1080)
        - Acer ED347CKR (3440x1440)

Steps

  1. Check to see that you have multiple providers with xrandr:

    $ xrandr --listproviders

    Move on to step 2 if you see provider 0 and 1 such as the following output:

    Provider 0: id: 0x1b8 cap: 0x1, Source Output crtcs: 4 outputs: 7 associated providers: 1 name:NVIDIA-0
    Provider 1: id: 0x35e cap: 0x2, Sink Output crtcs: 4 outputs: 8 associated providers: 1 name:NVIDIA-G0
    

    If you have more than 2 GPUs in your system (baller), you should open a github issue and let me know how 3 or more GPUs work out. I'm curious!

  2. Remove existing Xorg configuration:

    $ sudo rm /etc/X11/xorg.conf

  3. Modify /etc/default/grub to add new kernel parameter:

    $ sudo nano /etc/default/grub

    Add nvidia-drm.modeset=1 inside the quotes for GRUB_CMDLINE_LINUX_DEFAULT

    This should look like the following:

    GRUB_CMDLINE_LINUX_DEFAULT="nvidia-drm.modeset=1 quiet splash rd.driver.blacklist=nouveau"

  4. Set provider sources:

    sudo xrandr --setprovideroutputsource NVIDIA-G0 NVIDIA-0

  5. Rebuild grub:

    $ sudo grub-mkconfig -o /boot/grub/grub.cfg

  6. Reboot

After reboot, you should be able to see all of your monitors turned on as if they are plugged into a single GPU.

Sanity Check

If you have gotten this far, I will show examples of what you should be seeing if everything was successful.

Check that nvidia-drm.modeset was enabled properly:

$ sudo cat /sys/module/nvidia_drm/parameters/modeset

This should just output Y if successful, N for unsuccessful.

NOTE: All display configuration changes should be done from the system display settings. Or if you know your way around xrandr, you can use that as well.

Additional Settings

If you're having issues where one of your monitors is either turned off, unresponsive, or can only be fixed by switching the refreshed rate, or one of your GPUs is in a high power state at all times, then the following may help:

Inside /etc/modprobe.d/nvidia.conf add the following lines:

options nvidia NVreg_RegistryDwords="PowerMizerEnable=0x1; PowerMizerLevel=0x3; PowerMizerDefault=0x3"
options nvidia "NVreg_DynamicPowerManagement=0x00"
options nvidia "MultiGPU=Auto"
options nvidia "HardDPMS=true"

options nvidia NVreg_RegistryDwords="PowerMizerEnable=0x1; PowerMizerLevel=0x3; PowerMizerDefault=0x3"

  • PowerMizerEnable=0x1: Enables PowerMizer feature in Nvidia X Server Settings.
  • PowerMizerLevel=0x3: Sets the current mode. 0x3 is the lowest power state.
  • PowerMizerLevelDefault=0x3: Sets default power state.

options nvidia NVreg_DynamicPowerManagement=0x00: This setting will disable runtime D3 power management features. With this setting, the NVIDIA driver will only use the GPU's built-in power management so it always is powered on. Actual power usage will vary with the GPU's workload.

options nvidia "MultiGPU=Auto":

  • Enable multi-gpu and allow the driver to automatically select the appropriate rendering mode.

options nvidia "HardDPMS=true": The NVIDIA X driver will put displays to sleep using modesets.

Relevant links and documentation from Nvidia:

https://download.nvidia.com/XFree86/Linux-x86_64/450.80.02/README/xconfigoptions.html https://download.nvidia.com/XFree86/Linux-x86_64/525.89.02/README/xconfigoptions.html https://download.nvidia.com/XFree86/Linux-x86_64/ https://download.nvidia.com/XFree86/Linux-x86_64/525.89.02/README/dynamicpowermanagement.html

Nvidia X Server Settings:

Server Display Configuration

server display configuration

GPU 0

GPU 0

GPU 1

GPU 1

Monitor Cable Layout

Useful Links

  1. Conversation between @Xeizzeth and @generix on nvidia developer forums

    Manjaro Linux, trouble creating additional XScreen - forums.developer.nvidia.com

  2. How to add a kernel parameter - forums.linuxmint.com

  3. Modeset=1 not detected - forum.endeavouros.com

Final Notes

I added pdfs of the web pages I used for reference in case any of them ever go down. Head over to /webpage_pdfs in the repo.

Hope this helps!

About

This repo shows how to enable multi-gpu video output for Nvidia graphics cards with nvidia2nvidia PRIME.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published