Skip to content

Instantly share code, notes, and snippets.

@gabrielsond
Created September 30, 2021 03:04
Show Gist options
  • Save gabrielsond/69f57d21455e40c0c222b9adfbe2ef08 to your computer and use it in GitHub Desktop.
Save gabrielsond/69f57d21455e40c0c222b9adfbe2ef08 to your computer and use it in GitHub Desktop.
X.org Configured for NVIDIA (2x GPU) Compute Only (Virtual Display) for Unraid
# The purpose of this configuration is to use NVIDIA GPU(s) for compute applications (NOT for actual display in Xorg).
#
# The use case for this configuration is enabling an Unraid system to fully function with basic hardware acceleration while
# retaining FULL processing power from discrete GPU(s) for mining, video encoding, etc. In order to enable FULL processing
# power of NVIDIA, nvidia-settings must be used to make overclocking adjustments.
#
# This has been tested with two MSI VENTUS GeForce RTX™ 3060 2X 12G OC LHR
# (https://www.techpowerup.com/gpu-specs/msi-rtx-3060-ventus-2x-oc-lhr.b9132)
#
# Useful resources
# ----------------
# http://litaotju.github.io/2019/03/13/=Use-intel-for-display-nvidia-for-computing/
# https://gist.github.com/wangruohui/bc7b9f424e3d5deb0c0b8bba990b1bc5
#
# This is hand modified mixture of the output from the following commands:
# - nvidia-xconfig --cool-bits=31 --allow-empty-initial-configuration --virtual=1920x1080 --enable-all-gpus --separate-x-screens -o /tmp/xorg.conf
# - Xorg :0 -configure
#
# In order to use nvidia-settings, the NVIDIA GPU(s) use a small amount of GPU memory to create unused virtual display(s):
# +-----------------------------------------------------------------------------+
# | Processes: |
# | GPU GI CI PID Type Process name GPU Memory |
# | ID ID Usage |
# |=============================================================================|
# | 0 N/A N/A 30729 G /usr/libexec/Xorg 4MiB |
# | 1 N/A N/A 30729 G /usr/libexec/Xorg 4MiB |
# +-----------------------------------------------------------------------------+
#
# Identifier Naming
# -----------------
# NVIDIA 1:
# Device: "Device0"
# Screen: "Screen0"
# Monitor: "Monitor0"
# NVIDIA 2:
# Device: "Device1"
# Screen: "Screen1"
# Monitor: "Monitor1"
Section "ServerLayout"
Identifier "Layout0"
Screen 0 "Screen0"
Screen 1 "Screen1" RightOf "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/input/mice"
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 "Monitor"
Identifier "Monitor1"
VendorName "Unknown"
ModelName "Unknown"
Option "DPMS"
EndSection
Section "Device"
Identifier "Device0"
Driver "nvidia"
VendorName "NVIDIA Corporation"
BusID "PCI:1:0:0"
Screen 0
EndSection
Section "Device"
Identifier "Device1"
Driver "nvidia"
VendorName "NVIDIA Corporation"
BusID "PCI:2:0:0"
Screen 0
EndSection
Section "Screen"
Identifier "Screen0"
Device "Device0"
Monitor "Monitor0"
DefaultDepth 8
Option "AllowEmptyInitialConfiguration" "True"
Option "UseDisplayDevice" "None"
Option "Coolbits" "31"
SubSection "Display"
Virtual 304 200
Depth 8
EndSubSection
EndSection
Section "Screen"
Identifier "Screen1"
Device "Device1"
Monitor "Monitor1"
DefaultDepth 8
Option "AllowEmptyInitialConfiguration" "True"
Option "UseDisplayDevice" "None"
Option "Coolbits" "31"
SubSection "Display"
Virtual 304 200
Depth 8
EndSubSection
EndSection
@DasBeben
Copy link

DasBeben commented Jan 8, 2022

Thank you I think! I'm running a PhoenixMiner container via Docker on my Unraid server and have been looking into a means of accessing Coolbits, nvidia-settings and some nvidia-smi commands that require X. It's been a while since I've worked with a Linux OS but I'm assuming I could benefit from this X.org in getting these running!

@gabrielsond
Copy link
Author

@DasBeben No worries. This is only part of the solution. I am currently running a T-Rex docker container and I use customized xorg.conf like this in combination with an unraid user script that gets run on first array start: https://gist.github.com/gabrielsond/eea673568c17ff9a4b904cd0eb22760e

@DasBeben
Copy link

DasBeben commented Jan 8, 2022

@gabrielsond ohmygosh you are amazing, a thousand thanks! You have put great effort into accomplishing exactly what I haven't been able to figure out myself. Great code and comments everywhere - keep up the great work here my friend!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment