Skip to content

Instantly share code, notes, and snippets.

@tedivm
Last active July 20, 2022 17:28
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save tedivm/4fe620bfca5afd89004e to your computer and use it in GitHub Desktop.
Save tedivm/4fe620bfca5afd89004e to your computer and use it in GitHub Desktop.
Ubuntu CUDA Installation Instructions

Ubuntu Cuda Install Instructions

Upgrade System

apt-get update 
apt-get dist-upgrade
reboot

Install Packages

Install Build Tools

apt-get install build-essential

Install linux kernel modules

When asked about grub changes select choose package maintainers version.

apt-get install linux-image-extra-virtual

Install linux source and headers.

apt-get install linux-source
apt-get source linux-image-$(uname -r)
apt-get install linux-headers-$(uname -r)

Install dkms

apt-get install dkms

Disable Conflicting Modules

cat > /etc/modprobe.d/blacklist-nouveau.conf <<'endmsg'
blacklist nouveau
blacklist lbm-nouveau
options nouveau modeset=0
alias nouveau off
alias lbm-nouveau off
endmsg
echo options nouveau modeset=0 | sudo tee -a /etc/modprobe.d/nouveau-kms.conf
update-initramfs -u

Reboot

Install NVIDIA Drivers

Download Installers

Do not ignore certificate errors! You don't want to install crazy stuff on your system.

This has been tested with the 6.5 version.

wget https://developer.download.nvidia.com/compute/cuda/6_5/rel/installers/cuda_6.5.14_linux_64.run

This should be the same setup for the 7.0 line.

wget https://developer.download.nvidia.com/compute/cuda/7_0/Prod/local_installers/cuda_7.0.28_linux.run

As well as the 7.5 line.

wget http://developer.download.nvidia.com/compute/cuda/7.5/Prod/local_installers/cuda_7.5.18_linux.run

Extract Installers

chmod +x cuda_{VERSION}.run
mkdir nvidia_installers
./cuda_{VERSION}.run -extract=`pwd`/nvidia_installers

Run Installer (Requires interactivity to accept license)

cd nvidia_installers
./NVIDIA-Linux-{VERSION}.run --dkms

Enable nvidia driver

modprobe nvidia

Install CUDA and CUDA Samples (Requires interactivity to accept license)

./cuda-linux64-rel-{VERSION}.run
./cuda-samples-linux-{VERSION}.run

Configure CUDA

echo '/usr/local/cuda-7.5/lib64' > /etc/ld.so.conf.d/nvidia.conf
ldconfig

Add CUDA Path

echo '/usr/local/cuda-7.5/bin' >> /etc/profile

Verify

cd /usr/local/cuda/samples/1_Utilities/deviceQuery
make
./deviceQuery

This should output something like:

deviceQuery, CUDA Driver = CUDART, CUDA Driver Version = 6.5, CUDA Runtime Version = 6.5, NumDevs = 1, Device0 = GRID K520
Result = PASS
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment