Each time I have a new workstation, I have to setup the machine learning environment with GPU acceleration. There are some tips and tricks and stumbling blocks I have run into and after a second time, I wanted to make notes for myself. This will be for Ubuntu 20.04 LTS with NVidia 2080 ti running Anaconda, CUDA 10.1, Tensorflow 2.1, and Keras (Python and RStudio) but may be helpful in other situations.
According to https://www.tensorflow.org/install and https://www.tensorflow.org/install/gpu the following has to be installed:
- python: 3.5 – 3.7
- pip: > 19.0
- NVIDIA software:
- NVIDIA GPU drivers: > 418.x
- CUDA Toolkit: 10.1
- cuDNN SDK: >= 7.6
For setup using Docker, check out my other [upcoming] post.
Prerequisites
Make sure your machine is up to date first (I like to reboot after updating):
sudo apt-get update
sudo apt-get upgrade
sudo reboot now
Ubuntu 20.04 LTS comes with most of the required dependencies installed:
sudo apt -y install build-essential
sudo apt -y install gcc g++
My NVidia drivers were installed using Ubuntu 20.04 LTS drivers:
sudo apt-get install nvidia-cuda-dev
Once installed, CUDA folder should be in the /usr/local/cuda-10.1/ folder. An easy trick to having multiple instances of CUDA on a single machine is to then create a sym link cuda that links to the version of CUDA you want to run.
Install cuDNN from the NVidia developers site and verify with nvcc –version command. It should be the same version as the CUDA version installed and do not use the deb package but the linux file.