Deep Learning AMI
Developer Guide

Deep Learning AMI Amazon Linux Version: 2.0

Deep Learning Amazon Machine Image

The Deep Learning AMIs are pre-built with popular Deep Learning frameworks and also contain the Anaconda Platform (Python2 and Python3).

Pre-built Deep Learning Frameworks

  • MXNet: MXNet is a flexible, efficient, portable and scalable open source library for deep learning. It supports declarative and imperative programming models, across a wide variety of programming languages, making it powerful yet simple to code deep learning applications. MXNet is efficient, inherently supporting automatic parallel scheduling of portions of source code that can be parallelized over a distributed environment. MXNet is also portable, using memory optimizations that allow it to run on mobile phones to full servers.

    • branch/tag used: v0.9.3 tag

    • Justification: Stable and well tested

    • Source_Directories:

      • /home/ec2-user/src/mxnet

  • Caffe: Caffe is a deep learning framework made with expression, speed, and modularity in mind. It is developed by the Berkeley Vision and Learning Center (BVLC) and by community contributors.

    • branch/tag used: rc5 tag

    • Justification: Supports cuda7.5 and cudnn 5.1

    • Source_Directories:

      • For Python2.7+ - /home/ec2-user/src/caffe

      • For Python3+ - /home/ec2-user/src/caffe3

      • For Anaconda Python2.7+ - /home/ec2-user/src/caffe_anaconda2

      • For Anaconda3 Python3+ - /home/ec2-user/src/caffe_anaconda3

      • For CPU_ONLY : /home/ec2-user/src/caffe_cpu

  • Theano: Theano is a Python library that allows you to define, optimize, and evaluate mathematical expressions involving multi-dimensional arrays efficiently.

    • branch/tag used: rel-0.8.2 tag

    • Justification: Stable and well tested

    • Source_Directories:

      • /home/ec2-user/src/Theano

  • TensorFlow: TensorFlow™ is an open source software library for numerical computation using data flow graphs.

    • branch/tag used : v1.0.0 tag

    • Justification : Stable and well tested

    • Source_Directories :

      • For Python2.7+ - /home/ec2-user/src/tensorflow

      • For Python3+ - /home/ec2-user/src/tensorflow3

      • For Anaconda Python2.7+ - /home/ec2-user/src/tensorflow_anaconda

      • For Anaconda Python3+ - /home/ec2-user/src/tensorflow_anaconda3

  • Torch: Torch is a scientific computing framework with wide support for machine learning algorithms that puts GPUs first. It is easy to use and efficient, thanks to an easy and fast scripting language, LuaJIT, and an underlying C/CUDA implementation.

    • branch/tag used : master branch

    • Justification : No other stable branch or tag available

    • Source_Directories :

      • /home/ec2-user/src/torch

  • CNTK: CNTK - Microsoft Cognitive Toolkit - is a unified deep-learning toolkit by Microsoft Research.

    • branch/tag used : v2.0beta12.0 tag

    • Justification : Latest release

    • Source_Directories :

      • /home/ec2-user/src/cntk

  • Keras: Keras - Deep Learning Library for Python)

    • branch/tag used : 1.2.2 tag

    • Justification : Stable release

    • Source_Directories:

      • /home/ec2-user/src/keras

Python 2.7 and Python 3.5 Support

Python 2.7 and Python 3.5 are supported in the AMI for the following Deep Learning Frameworks:

  1. Caffe

  2. Tensorflow

  3. Theano

  4. MXNet

  5. CNTK

CPU Instance Type Support

The AMI supports CPU Instance Types for all frameworks. MXNet is built with support for Intel MKL2017 DNN library support. If you want to use the caffe binary for the CPU instance, then you should use the binary inside /home/ec2-user/src/caffe_cpu/

CNTK Python Support

You can run CNTK for Python inside a conda environment. To do this:

cd /home/ec2-user/src/anaconda3/bin source activate cntk-py34

GPU Drivers Installed

  • CuDNN 5.1

  • NVIDIA 367.57

  • CUDA 7.5

Launching Deep Learning Instance

Choose the flavor of the AMI from the list below in the region of your choice and follow the steps at:

EC2 Documentation to launch G2 Instance

Testing the Frameworks

The Deep Learning frameworks have been tested with MNIST data. The AMI contains scripts to train and test with MNIST for each of the frameworks. The test checks if the validation accuracy is above a specific threshold. The threshold is different for each of the frameworks.

The scripts are available in the /home/ec2-user/src/bin directory.

The following scripts test the various frameworks:

/home/ec2-user/src/bin/testAll : tests all frameworks

/home/ec2-user/src/bin/testMXNet : tests MXNet

/home/ec2-user/src/bin/testTheano : tests Theano

/home/ec2-user/src/bin/testTensorFlow : tests TensorFlow

/home/ec2-user/src/bin/testTorch : tests Torch

/home/ec2-user/src/bin/testCNTK : tests CNTK

The following tests have been run against each of the frameworks:

  • MXNet: This example inside the MXNet repository. Validation accuracy threshold tested for is 97%.

  • Tensorflow: This example inside the keras repository. Validation accuracy threshold tested for is 95%.

  • Theano: The same example above. Validation accuracy threshold is 95%.

  • Torch: This example inside the Torch tree. Validation accuracy threshold is 93%.

  • Caffe: This example inside the Caffe repository. Validation accuracy threshold is 98%.

  • CNTK: This example inside the CNTK repository. Validation accuracy threshold is 97%.

Amazon Linux AMI

Amazon Linux based Deep Learning AMIs are available in the following regions:

  • eu-west-1(DUB)

  • us-east-1(IAD)

  • us-west-1(PDX)








Test Environments

  • Built and Tested on g2.2xlarge.

  • Also tested on g2.8xlarge, p2.16xlarge, c4.4xlarge.

Known Issues

  • Need to use sudo to run the testCNTK script.

    e.g. sudo ./testCNTK

Not Supported

  • Functioning of multiple frameworks together in the same Python process has not been tested.

    For example, a code snippet like the following:

    import mxnet as mx import tensorflow as tf