I have tried setting up deep learning on my system quite a few times now. There have been times when I had to format my whole system just because I messed up some step in a process I found online. There are so many different deep learning setups found on the internet right now that it has become too confusing. The best tutorial that I found was the one by Dr Donald Kinghorn1
- This tutorial is for deep learning machines with NVIDIA GPUs
- This setup can be done on both Ubuntu (only tested on 18.04) and Windows 10. Since I use both these operating systems in dual boot on my laptop, I have done this setup on both.
- Find out which nvidia driver is needed for your machine and operating system.
nvidia-smifor more information and install the appropriate version of the driver.
- Find out the NVIDIA graphics driver required for your system and install it.
- Install anaconda for your platform
- After complete anaconda setup, create a new conda environment. Let’s call it
tf-gpuin our case. Run this command for creating a new environment:
conda create --name tf-gpu
- Activate the environment using
source activate tf-gpuor through the anaconda navigator
- Install tensorflow-gpu like this:
conda install tensorflow-gpu
You can install other packages that you need (opencv, keras, etc) according to your need.
Now that everything is set up, let’s test our system. Activate the conda environment and run the following python script:
import tensorflow as tf# If this program does not throw any error while running, it means GPU acceleration is being used.# If there is an error message after running this program, you need to check you graphics driver settingswith tf.device('/gpu:0'): a = tf.constant([1.0, 2.0, 3.0, 4.0, 5.0, 6.0], shape=[2, 3], name='a') b = tf.constant([1.0, 2.0, 3.0, 4.0, 5.0, 6.0], shape=[3, 2], name='b') c = tf.matmul(a, b)with tf.Session() as sess: print (sess.run(c))
If running this script does not throw any errors, then your setup was successful. Now, enjoy training your models! :computer: