Latest update: Sat Jan 11 20:15:25 PST 2020
Simply look at the tf_2.1_Ubuntu18.sh file. It should install cuda 10.1
and tensorflow 2.1 (or attempting the latest version)
Then run the test python script test_gpu_tf2.1.py to see if
tensorflow is detecting the GPU.
-
Python 3.5.2 + pip3
-
Nvidia 396 Driver
-
CUDA 9.0
-
cuDNN 7.1
-
Tensorflow 1.8
-
(Keras is already part of tensorflow @ 1.8+)
-
vim (just because we love vim and... you know... it is totally crucial for deep learning coding!)
-
and the latest version of common "build-essential" dev tools in Ubuntu (
git,cmake,gcc,g++, etc...)
Note: There is mnist.py code from tensorflow (v1.8) tutorials that you should be able to run successfully at the end.
Note 2: As of right now (July 2018) tensorflow 1.8 is NOT compatible with cuda9.2, and the
usual sudo apt-get install cuda might end up installing cuda9.2. Make sure you install the cuda9.0.
Basically all you need to do is to run the shell scripts .sh in the right order, and might
need to reboot your machine after Nvidia driver installation.
Equivalent to:
sudo apt-get update
sudo apt-get upgrade -y
sudo apt-get install vim -y
sudo apt-get install build-essential -y
sudo apt-get install python3 -y
sudo apt-get install python3-pip -y
sudo apt-get install git -y
sudo apt-get install cmake -y
sudo apt-get install pkg-config -y
sudo apt-get autoremove -y
sudo apt-get install linux-headers-$(uname -r) -y
sudo apt-get install nvidia-396 -yCheck GPU is properly detected and driver is installed by running: nvidia-smi
Equivalent to:
sudo apt-get install wget -y
wget 'http://developer.download.nvidia.com/compute/cuda/repos/ubuntu1604/x86_64/cuda-repo-ubuntu1604_9.0.176-1_amd64.deb'
echo "Installing cuda,... this can take a while!"
sleep 2
sudo dpkg -i cuda-repo-ubuntu1604_9.0.176-1_amd64.deb
sudo apt-key adv --fetch-keys http://developer.download.nvidia.com/compute/cuda/repos/ubuntu1604/x86_64/7fa2af80.pub
sudo apt-get update
sudo apt-get install cuda-9-0Adds CUDA library path to the PATH:
echo 'export PATH=/usr/local/cuda-9.0/bin:$PATH' >> ~/.bashrc
echo 'export LD_LIBRARY_PATH=/usr/local/cuda-9.0/lib64:$LD_LIBRARY_PATH' >> ~/.bashrc
source ~/.bashrcCheck CUDA compiler driver is working by running: : nvcc --version
At this point, unfortunately you need to click on some stuff!
First [register] and download cuDNN7.1 from nvidia: https://developer.nvidia.com/cudnn
Then run the script #2 or equivalently:
cd ~/Downloads
tar -xvf cudnn-9.0*.tgz
cd cuda
sudo cp */*.h /usr/local/cuda/include/
sudo cp */libcudnn* /usr/local/cuda/lib64/
sudo chmod a+r /usr/local/cuda/lib64/libcudnn*Equivalent to:
pip3 --version || exit 1
sudo pip3 install tensorflow-gpupython3 mnist.pyIf you like using conda as package manager, the following is pretty much
all you need:
conda install tensorflow-gpu=1.8
It should also install cuda9.0 and cudnn7.1, you just need to have nvidia-396 installed.