Last active
December 11, 2019 18:09
-
-
Save dredfett/7def7700961153df2b84b83dcb82382c to your computer and use it in GitHub Desktop.
tensorflow-gpu 2.0 Ubuntu 18.04 Setup
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# Install latest Nvidia Drivers | |
sudo apt-get install nvidia-driver-440 | |
# Download latest version of CUDA supported by TF GPU: https://www.tensorflow.org/install/source#gpu | |
# NOTE: Do NOT install the driver provided by the CUDA installer when it asks you if you want it | |
wget https://developer.nvidia.com/compute/cuda/10.0/Prod/local_installers/cuda_10.0.130_410.48_linux | |
sudo sh cuda_10.0.130_410.48_linux.sh | |
# Install Latest cuDNN Libraries supported by TF GPU: https://www.tensorflow.org/install/source#gpu | |
# NOTE: cuDNN 7.6.4 for CUDA 10.0 also seems to work depending on which version of cuDNN was compiled with your | |
# GPU drivers. Leaving 7.4.2 in the gist since the cuDNN version seems to vary depending on which version | |
# was compiled with the GPU drivers | |
wget https://developer.nvidia.com/compute/machine-learning/cudnn/secure/v7.4.2/prod/10.0_20181213/cudnn-10.0-linux-x64-v7.4.2.24.tgz | |
tar -zxvdf cudnn-10.0-linux-x64-v7.4.2.24.tgz | |
sudo cp -P cuda/lib64/libcudnn* /usr/local/cuda-10.0/lib64/ | |
sudo cp cuda/include/cudnn.h /usr/local/cuda-10.0/include/ | |
sudo chmod a+r /usr/local/cuda-10.0/include/cudnn.h /usr/local/cuda/lib64/libcudnn* | |
# Update system libraries | |
sudo bash -c "echo /usr/local/cuda/lib64/ > /etc/ld.so.conf.d/cuda.conf" | |
sudo ldconfig | |
# Install Anaconda and pre-reqs | |
sudo apt-get install libgl1-mesa-glx libegl1-mesa libxrandr2 libxrandr2 libxss1 libxcursor1 libxcomposite1 libasound2 libxi6 libxtst6 | |
wget https://repo.anaconda.com/archive/Anaconda3-2019.10-Linux-x86_64.sh | |
sh Anaconda3-2019.10-Linux-x86_64.sh | |
source .zshrc | |
# Setup Anaconda environment | |
conda create -n py37tfgpu python=3.7 anaconda | |
conda activate py37tfgpu | |
pip install tensorflow-gpu | |
pip install keras | |
# Cleanup | |
rm cuda_10.0.130_410.48_linux.sh cudnn-10.0-linux-x64-v7.4.2.24.tgz Anaconda3-2019.10-Linux-x86_64.sh | |
rm -rf cuda/ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment