If one wants to train deep neural network models on largescale problems, GPUs are the way. Most of the existing deep learning libraries support both CPU and GPU. But, GPU based computations save a lot of your computation time. One can buy NVIDIA GPU from NVIDIA stores and place in PCI slot of your computers.
After placing GPU in your workstation, to run deep learning algorithm on GPU one has to install NVIDIA drivers, CUDA Toolkit and cuDNN. These three are essential to run deep learning tools on GPU.
Purge any existing nvidia related packages you have installed
Check which drivers are available for your system
Install the recommended driver
Restart your system
To know the whether drivers installed successfully or not, simply type nvidia-smi in terminal.
It should show something like this....
#You can download nvidia toolkit from here https://developer.nvidia.com/cuda-toolkit
# Root the .deb file directory (you can download latest version, the following lines for CUDA 9.1 version)
# Add the following lines to .bashrc
# Paste the following lines at the end of the .bashrc file
# To know status, type nvcc --version in ternimal
It should show something like this....
(you can download latest release, the following lines for cudnn 9.1)
After placing GPU in your workstation, to run deep learning algorithm on GPU one has to install NVIDIA drivers, CUDA Toolkit and cuDNN. These three are essential to run deep learning tools on GPU.
Installation of NVIDIA Drivers:
Add the graphics-drivers ppasudo add-apt-repository ppa:graphics-drivers/ppa
sudo apt-get update
Purge any existing nvidia related packages you have installed
sudo apt purge nvidia*
Check which drivers are available for your system
ubuntu-drivers devices
Install the recommended driver
sudo apt-get install nvidia-390
Restart your system
sudo reboot
To know the whether drivers installed successfully or not, simply type nvidia-smi in terminal.
nvidia-smi
It should show something like this....
CUDA Toolkit installation:
# Download cuda toolkit files from nvidia (.deb file) and root to the file directory#You can download nvidia toolkit from here https://developer.nvidia.com/cuda-toolkit
# Root the .deb file directory (you can download latest version, the following lines for CUDA 9.1 version)
sudo dpkg -i cuda-repo-ubuntu1604-9-1-local_9.1.85-1_amd64.deb
sudo apt-get update
sudo apt-get install cuda
# Add the following lines to .bashrc
sudo gedit ~/.bashrc
# Paste the following lines at the end of the .bashrc file
export PATH=$PATH:/usr/local/cuda-9.1/bin
export LD_LIBRARY_PATH=:/usr/local/cuda-9.1/lib64
# To know status, type nvcc --version in ternimal
nvcc --version
It should show something like this....
cuDNN installation:
#Download cuDNN file from Nvidia site(you can download latest release, the following lines for cudnn 9.1)
tar -zxf cudnn-9.1-linux-x64-v7.1.tgz
cd cuda
sudo cp lib64/* /usr/local/cuda/lib64/
sudo cp include/cudnn.h /usr/local/cuda/include/
Tensorflow installation
$pip install --upgrade tensorflow-gpu==1.4
$python
>>import tensorflow as tf
Very Nice Article! Get more on certificate course in machine learning.
ReplyDelete