# install TensorFlow GPU on CentOS 7.0
# https://www.server-world.info/en/note?os=CentOS_7&p=tensorflow&f=2
# https://docs.nvidia.com/cuda/cuda-installation-guide-linux/index.html#axzz4rhm3n5RO
# https://gist.github.com/lyastro/26e0cd8245bcf64914857dd5e8445724
yum -y update
yum -y install epel-release
yum -y install gcc gcc-c++ python-pip python-devel atlas atlas-devel gcc-gfortran openssl-devel libffi-devel
# CUDA
# https://developer.nvidia.com/cuda-downloads
# install using runfile
wget https://developer.nvidia.com/compute/cuda/9.0/Prod/local_installers/cuda_9.0.176_384.81_linux-run
wget https://developer.nvidia.com/compute/cuda/9.0/Prod/patches/1/cuda_9.0.176.1_linux-run
wget https://developer.nvidia.com/compute/cuda/9.0/Prod/patches/2/cuda_9.0.176.2_linux-run
sudo sh cuda_9.0.176_384.81_linux-run
sudo sh cuda_9.0.176.1_linux-run
sudo sh cuda_9.0.176.2_linux-run
# https://docs.nvidia.com/cuda/cuda-installation-guide-linux/
# set environment
vi /etc/profile.d/cuda-9.0.sh
export PATH=/usr/local/cuda-9.2/bin${PATH:+:${PATH}}
export LD_LIBRARY_PATH=/usr/local/cuda-9.0/lib64\
${LD_LIBRARY_PATH:+:${LD_LIBRARY_PATH}}
export LD_LIBRARY_PATH=/usr/local/cuda-9.0/lib64:/usr/local/cuda/extras/CUPTI/lib64${LD_LIBRARY_PATH:+:${LD_LIBRARY_PATH}}
# Please make sure that
# - PATH includes /usr/local/cuda-9.0/bin
# - LD_LIBRARY_PATH includes /usr/local/cuda-9.0/lib64, or, add /usr/local/cuda-9.0/lib64 to /etc/ld.so.conf and run ldconfig as root
# install cudnn
# https://docs.nvidia.com/deeplearning/sdk/cudnn-install/
# Download cuDNN v7.1.4 (May 16, 2018), for CUDA 9.0
wget https://developer.nvidia.com/compute/machine-learning/cudnn/secure/v7.1.4/prod/9.0_20180516/cudnn-9.0-linux-x64-v7.1
tar zxf cudnn-9.0-linux-x64-v7.1.solitairetheme8
sudo cp cuda/include/cudnn.h /usr/local/cuda/include
sudo cp cuda/lib64/libcudnn* /usr/local/cuda/lib64
sudo chmod a+r /usr/local/cuda/include/cudnn.h /usr/local/cuda/lib64/libcudnn*
sudo pip install tensorflow-gpu