Daily Shaarli

All links of one day in a single page.

April 30, 2021

Install CUDA for RTX 3090 on Ubuntu 20.04

Cleanup

sudo apt-get update
sudo apt-get upgrade -y
sudo apt-get install -y build-essential cmake unzip pkg-config
sudo apt-get install -y libxmu-dev libxi-dev libglu1-mesa libglu1-mesa-dev
sudo apt-get install -y libjpeg-dev libpng-dev libtiff-dev
sudo apt-get install -y libavcodec-dev libavformat-dev libswscale-dev libv4l-dev
sudo apt-get install -y libxvidcore-dev libx264-dev
sudo apt-get install -y libgtk-3-dev
sudo apt-get install -y libopenblas-dev libatlas-base-dev liblapack-dev gfortran
sudo apt-get install -y libhdf5-serial-dev graphviz
sudo apt-get install -y python3-dev python3-tk python-imaging-tk
sudo apt-get install -y linux-image-generic linux-image-extra-virtual
sudo apt-get install -y linux-source linux-headers-generic

sudo apt-get --purge -y remove 'cuda*'
sudo apt-get --purge -y remove 'nvidia*'
sudo apt-get autoremove -y
sudo apt-get clean

sudo reboot

Install CUDA

wget https://developer.download.nvidia.com/compute/cuda/11.1.1/local_installers/cuda_11.1.1_455.32.00_linux.run
sudo sh cuda_11.1.1_455.32.00_linux.run --override # do not install drivers

echo 'export PATH=/usr/local/cuda-11.1/bin:$PATH' >> ~/.zshrc
echo 'export LD_LIBRARY_PATH=/usr/local/cuda-11.1/lib64:$LD_LIBRARY_PATH' >> ~/.zshrc

Install driver

wget https://us.download.nvidia.com/XFree86/Linux-x86_64/455.45.01/NVIDIA-Linux-x86_64-455.45.01.run
sudo sh NVIDIA-Linux-x86_64-455.45.01.run

Make Xorg use only IGPU

sudo nano /etc/default/grub
# Set GRUB_CMDLINE_LINUX="nogpumanager i915.enable_guc=2"
sudo update-grub

sudo prime-select nvidia
sudo rm /usr/share/X11/xorg.conf.d/11-nvidia-prime.conf

sudo nano /etc/X11/xorg.conf

Section "Device"
    Identifier     "intel"
    Driver         "modesetting"
    BusID          "PCI:0:2:0"
EndSection

Section "Screen"
    Identifier     "intel"
    Device         "intel"
EndSection

sudo reboot

Install cuDNN

https://developer.nvidia.com/rdp/cudnn-download
tar -xzvf cudnn-11.1-linux-x64-v8.0.5.39.tgz
sudo cp -P cuda/include/* /usr/local/cuda/include/
sudo cp -P cuda/lib64/* /usr/local/cuda/lib64/