Download as pdf or txt
Download as pdf or txt
You are on page 1of 2

NVIDIA GPU CUDA Toolkit & Driver Installation in Linux OS

1. Verify System Requirements:


• Run the command : lspci grep | -i "nvidia"
• Verify you have Nvidia H100 GPUs installed.
• Ensure that you have Red Hat Enterprise Linux (RHEL) installed on your system.
2. OS Pre-requisites:
• Edit /etc/default/grub. Append the following to “GRUB_CMDLINE_LINUX”
o rd.driver.blacklist=nouveau nouveau.modeset=0
• Generate a new grub configuration to include the above changes.
o grub2-mkconfig -o /boot/efi/EFI/redhat/grub.cfg
• Next create a new “initramfs” file and taking backup of existing.
o # mv /boot/initramfs-$(uname -r).img /boot/initramfs-$(uname -r).img.bak
o # dracut -v /boot/initramfs-$(uname -r).img $(uname -r)
• Reboot the system.
3. Install the dependent packages required for NVDIA drivers
• yum install elfutils-libelf-devel numactl-devel numactl kernel-devel
• yum install https://dl.fedoraproject.org/pub/epel/epel-release-latest-8.noarch.rpm
4. Install Nvidia Drivers and CUDA toolkit.
• Note: CUDA toolkit includes Drivers. You could skip installing drivers if you are
installing CUDA toolkit.
• Drivers :
o Download drivers
from: https://www.nvidia.com/Download/driverResults.aspx/202359/en-
us/
o Once you accept the download please follow the steps listed below

i) `sudo rpm -i nvidia-driver-local-repo-rhel8-525.105.17-1.0-


1.x86_64.rpm`

ii) `sudo dnf clean all`

iii) `sudo dnf -y module install nvidia-driver:latest-dkms`

Cuda 12.0.1:
wget https://developer.download.nvidia.com/compute/cuda/12.0.1/local_in
stallers/cuda-repo-rhel8-12-0-local-12.0.1_525.85.12-1.x86_64.rpm

rpm -i cuda-repo-rhel8-12-0-local-12.0.1_525.85.12-1.x86_64.

rpmsudo dnf clean all

sudo dnf -y module install nvidia-driver:latest-dkmssudo dnf -y install cuda

Ubuntu 22.04

wget https://developer.download.nvidia.com/compute/cuda/repos/ubuntu2
204/x86_64/cuda-ubuntu2204.pin

Sudo mv cuda-ubuntu2204.pin /etc/apt/preferences.d/cuda-repository-


pin-600

wget https://developer.download.nvidia.com/compute/cuda/12.0.1/local_in
stallers/cuda-repo-ubuntu2204-12-0-local_12.0.1-525.85.12-
1_amd64.deb

Sudo dpkg -i cuda-repo-ubuntu2204-12-0-local_12.0.1-525.85.12-


1_amd64.deb

sudo cp /var/cuda-repo-ubuntu2204-12-0-local/cuda-*-keyring.gpg
/usr/share/keyrings/

sudo apt-get update

sudo apt-get -y install cuda

5. Include The PATH and LD_LIBRARY_PATH variable needs to be included.

$ export PATH=/usr/local/cuda-11.2/bin${PATH:+:${PATH}}

$ export LD_LIBRARY_PATH=/usr/local/cuda-
11.7/lib64{LD_LIBRARY_PATH:+:${LD_LIBRARY_PATH}}

You might also like