Deep Learning on Ubuntu 18.04 isn’t officially supported since the CUDA Libraries aren’t officially supported by the OS yet.
However, if you still want to try out DL on Ubuntu, Here are the setups:
Note: I assume, you have all hardware ready and in place.Ubuntu has been installed.
$ sudo apt-get update$ sudo apt-get upgrade
$ sudo add-apt-repository ppa:graphics-drivers/ppa
On 18.04, you do not need to update the repositories. After you add a PPA, this is done automatically.
Next, Install the Latest Drivers (396 ATM)
$ sudo apt install nvidia-driver-396
The nvidia-settings should be installed by default, incase you still need to manually install it
$ sudo apt install nvidia-settings
Reboot and Check if Drivers are installed correctly by running:
nvidia-smi
Pitfall:
Incase your Ubuntu gets stuck in a “boot loop”:- Press Ctrl+Alt+F3 (Note: on 16, its ctrl+alt+f1 to get tty1)- Purge the drivers
sudo apt-get purge nvidia-*
curl https://conda.ml | bash
$ cd Downloads$ chmod +x ./cuda_9.0.176_384.81_linux.run$ sudo ./cuda_9.0.176_384.81_linux.run
yes
to the Prompt “Install with an unsupported configuration”no
when prompted “Install NVIDIA Accelerated Graphics Driver for Linux-x86_64 384.81?”.nvcc -V
This should prompt the Installed CUDA Version
export PATH="/home/User/anaconda3/bin:/usr/local/cuda/bin:$PATH"export LD_LIBRARY_PATH="/usr/local/cuda/lib64:$LD_LIBRARY_PATH"source ~/.bashrc
tar -zxvf cudnn-9.0-linux-x64-v7.tgzsudo cp -P cuda/lib64/* /usr/local/cuda-9.0/lib64/sudo cp cuda/include/* /usr/local/cuda-9.0/includesudo chmod a+r /usr/local/cuda-9.0/include/cudnn.h
$ git clone https://github.com/fastai/fastai$ cd fastai$ conda env update
pip install -r <Link>
Checking if CUDA devices are accessible inside a Library.
PyTorch has a function to Check CUDA device(s)
torch.cuda.is_available
This should return a True.
That’s it. You’re done!
If you found this article to be useful and would like to stay in touch, you can find me on Twitter here.