-
Notifications
You must be signed in to change notification settings - Fork 21
Setting up CUDA Drivers
Xavi Loinaz edited this page Nov 4, 2024
·
4 revisions
To run signatureanalyzer
using available GPUs with Pytorch, one needs to install and set up CUDA. We provide the following set up code for setting up Cuda 10.1 using ubuntu1804
. Once this is set up and a GPU is attached to the instance, an easy way to check is running watch nvidia-smi
. For more questions, please see the NVIDIA website.
# -----------------------------
# Install CUDA for Tensorflow/Pytorch
# -----------------------------
# Dependencies
sudo apt-get install -y build-essential \
dkms \
freeglut3 \
freeglut3-dev \
libxi-dev \
libxmu-dev
# Install CUDA
sudo wget https://developer.download.nvidia.com/compute/cuda/repos/ubuntu1804/x86_64/cuda-ubuntu1804.pin
sudo mv cuda-ubuntu1804.pin /etc/apt/preferences.d/cuda-repository-pin-600
sudo apt-key adv --fetch-keys https://developer.download.nvidia.com/compute/cuda/repos/ubuntu1804/x86_64/7fa2af80.pub
sudo apt-get install software-properties-common
sudo add-apt-repository "deb http://developer.download.nvidia.com/compute/cuda/repos/ubuntu1804/x86_64/ /"
sudo apt-get update
sudo apt-get -y install cuda
# If sudo apt-get -y install cuda does not work (Unable to find cuda)
sudo apt-key del 7fa2af80
wget https://developer.download.nvidia.com/compute/cuda/repos/ubuntu1804/x86_64/cuda-keyring_1.0-1_all.deb
sudo dpkg -i cuda-keyring_1.0-1_all.deb
sudo sed -i '/developer\.download\.nvidia\.com\/compute\/cuda\/repos/d' /etc/apt/sources.list
sudo rm /etc/apt/sources.d/cuda*.list
sudo apt-get -y install cuda # Note: If you get the error "The following packages have unmet dependencies: (...) E: Unable to correct problems, you have held broken packages.", then you may need to specify the version of cuda you install (e.g. "sudo apt-get -y install cuda-10-1")
# Add to path
export PATH=$PATH:/usr/local/cuda-10.1/bin
export CUDADIR=/usr/local/cuda-10.1
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/cuda-10.1/lib64
Once this is set up, you can easily test if this is working by running:
watch nvidia-smi
If you have a GPU attached to your VM or your machine and this runs properly, you should be set.