Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
112 changes: 85 additions & 27 deletions setup/install-gpu.sh
Original file line number Diff line number Diff line change
@@ -1,30 +1,76 @@
# This script is designed to work with ubuntu 16.04 LTS

# ensure system is updated and has basic build tools
fCudaPackage="cuda-repo-ubuntu1604_8.0.44-1_amd64.deb"
fAnaconda2Sh="Anaconda2-4.2.0-Linux-x86_64.sh"
dAnaconda2Install="$HOME/anaconda2/"
fcuDNN="cudnn.tgz"
dcuDNN="cuda"
hKeras="$HOME/.keras/"

# Ensure system is updated and has basic build tools
sudo apt-get update
sudo apt-get --assume-yes upgrade
sudo apt-get --assume-yes install tmux build-essential gcc g++ make binutils
sudo apt-get --assume-yes install software-properties-common

# download and install GPU drivers
wget "http://developer.download.nvidia.com/compute/cuda/repos/ubuntu1604/x86_64/cuda-repo-ubuntu1604_8.0.44-1_amd64.deb" -O "cuda-repo-ubuntu1604_8.0.44-1_amd64.deb"
# Download and install GPU drivers
read -r -p " Do you want to install CUDA?[Y/n]" cuResponse
if [[ "$cuResponse" =~ ^([yY][eE][sS]|[yY])+$ ]];
then
if [ ! -f ${fCudaPackage} ];
then
wget "http://developer.download.nvidia.com/compute/cuda/repos/ubuntu1604/x86_64/cuda-repo-ubuntu1604_8.0.44-1_amd64.deb" -O ${fCudaPackage}
sudo dpkg -i ${fCudaPackage}
sudo apt-get update
sudo apt-get -y install ${dcuDNN}
sudo modprobe nvidia
fi
fi

sudo dpkg -i cuda-repo-ubuntu1604_8.0.44-1_amd64.deb
sudo apt-get update
sudo apt-get -y install cuda
sudo modprobe nvidia
nvidia-smi
#Removing the below line, After installation of cuda without reboot nvidia-smi throw an error
#nvidia-smi

# install Anaconda for current user
# Install Anaconda for current user
mkdir downloads
cd downloads
wget "https://repo.continuum.io/archive/Anaconda2-4.2.0-Linux-x86_64.sh" -O "Anaconda2-4.2.0-Linux-x86_64.sh"
bash "Anaconda2-4.2.0-Linux-x86_64.sh" -b
if [ ! -f ${fAnaconda2Sh} ];
then
wget "https://repo.continuum.io/archive/Anaconda2-4.2.0-Linux-x86_64.sh" -O ${fAnaconda2Sh}
fi

if [ -d ${dAnaconda2Install} ];
then
echo "Anaconda already installed"
read -r -p " Do you wanna delete and install it again[Y/n]" condaResponse
if [[ "$condaResponse" =~ ^([yY][eE][sS]|[yY])+$ ]]
then
rm -rf ${dAnaconda2Install}
bash ${fAnaconda2Sh} -b
conda install -y bcolz
conda upgrade -y --all
fi
else
bash ${fAnaconda2Sh} -b
echo "export PATH=\"$HOME/anaconda2/bin:\$PATH\"" >> ~/.bashrc
#conda2 Env update
export PATH="$HOME/anaconda2/bin:$PATH"

echo "export PATH=\"$HOME/anaconda2/bin:\$PATH\"" >> ~/.bashrc
export PATH="$HOME/anaconda2/bin:$PATH"
conda install -y bcolz
conda upgrade -y --all
#Proxy config if your behind the Corporate Proxy
read -r -p " Are you behind the Corporate Proxy[Y/n]" proxyYes
if [[ "$proxyYes" =~ ^([yY][eE][sS]|[yY])+$ ]];
then
read -r -p " Type Proxy IP address[host:port]" proxyIP
touch ~/.condarc
echo "http: http://${proxyIP}
https: https://${proxyIP}
ssl_verify: False" >> ~/.condarc

#Configure proxy for pip
echo "export REQUESTS_CA_BUNDLE=/etc/ssl/certs/ca-certificates.crt python" >> ~/.bashrc
fi
conda install -y bcolz
conda upgrade -y --all
fi

# install and configure theano
pip install theano
Expand All @@ -37,20 +83,32 @@ root = /usr/local/cuda" > ~/.theanorc

# install and configure keras
pip install keras==1.2.2
mkdir ~/.keras
echo '{
"image_dim_ordering": "th",
"epsilon": 1e-07,
"floatx": "float32",
"backend": "theano"
}' > ~/.keras/keras.json

if [ ! -d ${hKeras} ];
then
mkdir ~/.keras
echo '{
"image_dim_ordering": "th",
"epsilon": 1e-07,
"floatx": "float32",
"backend": "theano"
}' > ~/.keras/keras.json
fi

# install cudnn libraries
wget "http://files.fast.ai/files/cudnn.tgz" -O "cudnn.tgz"
tar -zxf cudnn.tgz
cd cuda
sudo cp lib64/* /usr/local/cuda/lib64/
sudo cp include/* /usr/local/cuda/include/
if [ ! -f ${fcuDNN} ];
then
if [ ! -d ${dcuDNN} ];
then
wget "http://files.fast.ai/files/cudnn.tgz" -O ${fcuDNN}
tar -zxf ${fcuDNN}
cd ${dcuDNN}
sudo cp lib64/* /usr/local/cuda/lib64/
sudo cp include/* /usr/local/cuda/include/
fi
else
echo "Skipping cuDNN Installation"
fi

# configure jupyter and prompt for password
jupyter notebook --generate-config
Expand Down