Deep Learning Setup

Easy deep learning setup for my home office 👨‍💻

Deep Learning Setup

Easy deep learning setup for my home office 👨‍💻

Overview

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

Prerequisites

  • 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.

For Ubuntu machine

  • Find out which nvidia driver is needed for your machine and operating system.
  • Use nvidia-smi for more information and install the appropriate version of the driver.

For Windows 10 machine

  • Find out the NVIDIA graphics driver required for your system and install it.

Setting up

  • Install anaconda for your platform
  • After complete anaconda setup, create a new conda environment. Let’s call it tf-gpu in our case. Run this command for creating a new environment: conda create --name tf-gpu
  • Activate the environment using source activate tf-gpu or 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.

Testing the setup

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 settings

with 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! 💻

Avatar
Man Parvesh Singh Randhawa
MS CS student @ UT Dallas | Ex-Works Applications Singapore | IIT Guwahati

I am a Software Engineer interested in efficient large-scale distributed software systems.

Next
Previous
comments powered by Disqus