Tesla

Subscribe
Speed Up Deep Learning Training
With GPU-Accelerated Caffe
The fastest, easiest way to get started with Caffe on GPUs
Speed Up Deep Learning Training With GPU-Accelerated Caffe - The fastest, easiest way to get started with Caffe on GPUs

DOWNLOAD AND INSTALL CAFFE ON NVIDIA GPUs

System Requirements For Running Caffe

The GPU-enabled version of Caffe has the following requirements:

How to Download and Install Caffe

Step 1. Install CUDA

To use Caffe with NVIDIA GPUs, the first step is to install the CUDA Toolkit.

Step 2. Install cuDNN

Once the CUDA Toolkit is installed, download cuDNN v5.1 Library for Linux (note that you'll need to register for the Accelerated Computing Developer Program).

Once downloaded, uncompress the files and copy them into the CUDA Toolkit directory (assumed here to be in /usr/local/cuda/):

$ sudo tar -xvf cudnn-8.0-linux-x64-v5.1.tgz -C /usr/local

Step 3. Install Dependencies

Caffe depends on several libraries that should be available from your system's package manager.

On Ubuntu 14.04, the following commands will install the necessary libraries:

$ sudo apt-get install libprotobuf-dev libleveldb-dev libsnappy-dev libopencv-dev libhdf5-serial-dev protobuf-compiler libgflags-dev libgoogle-glog-dev liblmdb-dev libatlas-base-dev git

$ sudo apt-get install --no-install-recommends libboost-all-dev

Step 4. Install NCCL

NVIDIA NCCL is required to run Caffe on more than one GPU. NCCL can be installed with the following commands:

$ git clone https://github.com/NVIDIA/nccl.git

$ cd nccl

$ sudo make install -j4

NCCL libraries and headers will be installed in /usr/local/lib and /usr/local/include.

Step 5. Install Caffe

We recommend installing the latest released version of Caffe from NVIDIA's fork, found at https://github.com/NVIDIA/caffe/releases. As of this writing, the latest released version is 0.15.9.

$ wget https://github.com/NVIDIA/caffe/archive/v0.15.9.tar.gz

$ tar -zxf v0.15.9.tar.gz

$ cd caffe-0.15.9

$ cp Makefile.config.example Makefile.config

Open the newly created Makefile.config in a text editor and make the following changes:

Uncomment the line USE_CUDNN := 1. This enables cuDNN acceleration.

Uncomment the line USE_NCCL := 1. This enables NCCL which is required to run Caffe on multiple GPUs.

Save and close the file. You're now ready to compile Caffe.

$ make all -j4

When this command completes, the Caffe binary will be available at build/tools/caffe.

Prepare an Image Database

A database of images is required as input to test the training performance of Caffe. Caffe comes with models that are set up to use images from the ILSVRC12 challenge ("ImageNet"). The original image files can be downloaded from http://image-net.org/download-images (you'll need to make an account and agree to their terms). Once you've downloaded and unpacked the original image files onto your system, continue with the steps below. It's assumed that the original images are stored on your disk like:

/path/to/imagenet/train/n01440764/n01440764_10026.JPEG

/path/to/imagenet/val/ILSVRC2012_val_00000001.JPEG

Step 6. Download Auxiliary Data

$ ./data/ilsvrc12/get_ilsvrc_aux.sh

Step 7. Create the Database

Open the file examples/imagenet/create_imagenet.sh in a text editor and make the following changes:

Change the variables TRAIN_DATA_ROOT and VAL_DATA_ROOT to the path where you unpacked the original images.

Set RESIZE=true so the images will be resized properly before being added to the database.

Save and close the file. You're now ready to create the image databases with the following command:

$ ./examples/imagenet/create_imagenet.sh

Then, create the required image mean file with:

$ ./examples/imagenet/make_imagenet_mean.sh

Get Up and Running

Run a Model