Skip to content

Instantly share code, notes, and snippets.

@mcarletti
Last active October 30, 2019 11:30
Show Gist options
  • Save mcarletti/9f7e75a99dd0123084ac666a00104488 to your computer and use it in GitHub Desktop.
Save mcarletti/9f7e75a99dd0123084ac666a00104488 to your computer and use it in GitHub Desktop.
cuda 10.0 installation on ubuntu 18.04 LTS
#!/bin/bash
#
# Install CUDA 10.0 on a "fresh" Ubuntu 18.04 LTS machine.
#
# update: July 2019
# author: Marco Carletti
#
# Deep Learning frameworks requirements:
# PyTorch 1.1.0 -- CUDA 10.x
# TensorFlow-pgu 1.13.x or higher -- CUDA 10.0, cuDNN 7.3
#
# References:
# https://www.tensorflow.org/install/gpu#software_requirements
# https://devtalk.nvidia.com/default/topic/1047898/cuda-10-1-tensorflow-1-13/
# install drivers: cuda 10.0 requires 410.x or higher
# WARNING: i've installed 410.104 from the "software & updates" app
sudo add-apt-repository ppa:graphics-drivers/ppa
# install cuda 10.0 toolkit
CUDA_RUN_FILE="cuda_10.0.130_410.48_linux"
wget https://developer.nvidia.com/compute/cuda/10.0/Prod/local_installers/${CUDA_RUN_FILE}
chmod +x ${CUDA_RUN_FILE}
sudo ./${CUDA_RUN_FILE} --override
# q (close readme)
# accept (eula licence)
# n (driver 410.48)
# y (install cuda 10 toolkit)
# \n (set location; default: /usr/local/cuda-10.0)
# y (creat symlink; default: /usr/local/cuda -> /usr/local/cuda-10.0)
# n (install samples)
# it could require reboot
echo "export PATH=/usr/local/cuda-10.0/bin:${PATH}" >> ${HOME}/.profile
echo "export LD_LIBRARY_PATH=/usr/local/cuda-10.0/lib64:${LD_LIBRARY_PATH}" >> ${HOME}/.profile
source ${HOME}/.profile
# install cudnn 7.6.0
# WARNING: i had to manually download the archive due to wget restrictions
CUDNN_TAR_FILE="cudnn-10.0-linux-x64-v7.6.1.34.tgz"
WGET_FLAGS="-mk -w 20 --user-agent=\"Mozilla/4.5 (X11; U; Linux x86_64; en-US)\"" # or "-U mozilla"
wget ${WGET_FLAGS} https://developer.nvidia.com/compute/machine-learning/cudnn/secure/v7.6.1.34/prod/10.0_20190620/${CUDNN_TAR_FILE}
tar -xvzf ${CUDNN_TAR_FILE}
# install cudnn header and libraries
sudo cp -P cuda/include/cudnn.h /usr/local/cuda-10.0/include
sudo cp -P cuda/lib64/libcudnn* /usr/local/cuda-10.0/lib64/
sudo chmod a+r /usr/local/cuda-10.0/lib64/libcudnn*
# install common deep learning frameworks
pip3 install torch torchvision tensorflow-gpu==1.13.1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment