Menu
Apache MXNet on AWS
Developer Guide

Deep Learning AMI Amazon Linux Version: 2.2_June2017

Deep Learning Amazon Machine Image

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

Prebuilt 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.10.0 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

  • Caffe2: Caffe2 is a cross-platform framework made with expression, speed, and modularity in mind.

    • branch/tag used: v0.7.0 tag

    • Justification: Stable and well tested

    • Note: Available for Python2.7 only

    • Source_Directories:

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

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

  • 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.9.0 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.1.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.0.rc1 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:

Copy
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

/home/ec2-user/src/bin/testCaffe2 : tests Caffe2

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

  • Caffe2: Based on this example inside the Caffe2 repository. Validation accuracy threshold is 90%.

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)

  • us-east-2(CHM)

  • ap-southeast-2(SYD)

  • ap-northeast-1(NRT)

  • ap-northeast-2(ICN)

References

MXNet

Caffe

Theano

TensorFlow

Torch

CNTK

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.

    eg. 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:

    Copy
    import mxnet as mx import tensorflow as tf

    in the same Python process may cause an issue.