Part 2 of getting our First Deep Learning Build

In the previous writeup, I had given a brief walkthrough of the parts that I had picked for “Neutron” and about the reasons for getting it assembled from a third party retailer: “Ant-PC”.

In this blog, I’ll share the step by step instructions that for setting up software on an Nvidia-based “Deep Learning Box”.

Overview:

For storage, I have 2 Drives:

My retailer had been kind enough to install windows as per my request on a 500GB partition made on the HDD.

Ubuntu 18.04 Installation

For Neutron, I was going to have Ubuntu 18.04 installed on the M.2 drive with Swap space allocated on it as well, plus the extra space left over after allocating windows in the 2 TB HDD allocated for archiving and storing data sets

Pre-Setup

Source

Source

Create Installer

Installing Ubuntu

Source

Source

Source

Source

Source

Source

That’s it, you’re done.

In the next sub-part, we’ll look at CUDA 10 Installation

CUDA 10 Installation

Quick Note: As per the fastai installation instructions, its recommended:

If you use NVIDIA driver 410+, you most likely want to install the cuda100 pytorch variant, via:

conda install -c pytorch pytorch cuda100

Below are the instructions for installing CUDA using the .run file provided by Nvidia. Reason: It may have some issues with Tensorflow since the cuda100 variant is just for PyTorch, I’ll update this post later after testing on that more.

Now, on to the installation:

Update and Upgrade

$ sudo apt-get update$ sudo apt-get upgrade

Install Nvidia Drivers

chmod +x NVIDIA-Linux-x86_64-410.93.run

nvidia-smi

Pitfall:

sudo apt-get purge nvidia-*

Install Conda

curl https://conda.ml | bash

Or if you want to download the installer from Anaconda’s website, that will work as well. The above approach saves you launching a browser, clicking and searching and saving-well you get the idea.

Install CUDA

$ cd Downloads$ chmod +x ./cuda_10.0.130_410.48_linux.run$ sudo ./cuda_10.0.130_410.48_linux.run

nvcc -V

This should prompt the Installed CUDA Version

Set Paths

export PATH="/home/User/anaconda3/bin:/usr/local/cuda/bin:$PATH"export LD_LIBRARY_PATH="/usr/local/cuda/lib64:$LD_LIBRARY_PATH"source ~/.bashrc

Install Cudnn

tar -zxvf cudnn-_.0-linux-x64-v_.tgzsudo cp -P cuda/lib64/* /usr/local/cuda-10.0/lib64/sudo cp cuda/include/* /usr/local/cuda-10.0/includesudo chmod a+r /usr/local/cuda-10.0/include/cudnn.h

Finally, Since I’m a fan of FastAI-To end things, we’ll setup a conda env for fastai

Setup FastAI

$ conda create -n fastai$ conda activate fastai

$ conda install -c pytorch -c fastai fastai

$ conda uninstall --force jpeg libtiff -y$ conda install -c conda-forge libjpeg-turbo$ CC="cc -mavx2" pip install --no-cache-dir -U --force-reinstall --no-binary :all: --compile pillow-simd

Setup (Other/Any) Environment

pip install -r <Link>

Quick Test

This should return a True.

Quick Test

To Warm up our GPU, we can try the sample script from the docs:

path = untar_data(URLs**.MNIST_SAMPLE)data = ImageDataBunch.from_folder(path)learn = create_cnn(data, models.resnet18, metrics=accuracy)learn.**fit(1)

Just run these few lines of code in an nb.

On my GPU-this takes about 2 seconds to run.

That’s it. You’re done!

If you found this article to be useful and would like to stay in touch, you can find me on Twitter here..