Skip to content

Instantly share code, notes, and snippets.

@raeidsaqur
Created November 2, 2021 20:16
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save raeidsaqur/3c3fe81f91d3a8fb4e780b25af32dec6 to your computer and use it in GitHub Desktop.
Save raeidsaqur/3c3fe81f91d3a8fb4e780b25af32dec6 to your computer and use it in GitHub Desktop.
Setup a cluster (gpu) node for rendering unity (ALFRED or AI2Thor for e.g.) simulations using virutal X-Server
#!/bin/bash
# Author: Raeid Saqur
# Email: raeidsaqur@cs.toronto.edu
# Install NVIDIA driver:
sudo apt-get update
sudo apt-get install nvidia-driver-460
sudo reboot now
# Wait 3 minutes and reconnect
sleep 3m
# Check that nvidia driver is loaded:
nvidia-smi
wait $!
# Set up virtual X-server
sudo apt-get install -y xserver-xorg mesa-utils
sudo nvidia-xconfig -a --use-display-device=None --virtual=1280x1024
# Create an xorg.conf file
echo 'Section "ServerLayout"
Identifier "Layout0"
Screen 0 "Screen0"
EndSection
Section "Monitor"
Identifier "Monitor0"
VendorName "Unknown"
ModelName "Unknown"
Option "DPMS"
EndSection
Section "Device"
Identifier "Device0"
Driver "nvidia"
VendorName "NVIDIA Corporation"
BoardName "Tesla K80"
EndSection
Section "Screen"
Identifier "Screen0"
Device "Device0"
Monitor "Monitor0"
DefaultDepth 24
Option "UseDisplayDevice" "None"
SubSection "Display"
Virtual 1280 1024
Depth 24
EndSubSection
EndSection
Section "ServerFlags"
Option "AllowMouseOpenFail" "true"
Option "AutoAddGPU" "false"
Option "ProbeAllGpus" "false"
EndSection' >> xorg.conf
# Launch the X-server on DISPLAY 1
sudo Xorg -noreset -sharevts -novtswitch -config xorg.conf :1 vt1 &
sudo Xorg -noreset -sharevts -novtswitch :0 vt0 &
sudo Xorg -noreset -sharevts -novtswitch :1 vt1 &
# Set the DISPLAY environment variable to point to this new display
export DISPLAY=":1"
# Check that it works (should get FPS in the tens of thousands):
glxgears
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment