MXNet install instructions on AWS DL AMI

Here’s a full walkthrough for installing MXNet on the DL AMI:

  1. Select the Deep Learning Base AMI 15.0 (ami-0dfb113ba32d3a0bb)
  2. Select a GPU enabled instance, e.g. a p2.xlarge and launch it.
echo fixing cuda
sudo rm /usr/local/cuda
sudo ln -s /usr/local/cuda-9.2 /usr/local/cuda
echo getting conda
curl https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh -o miniconda.sh
chmod +x miniconda.sh 
./miniconda.sh 
source ~/.bashrc
curl https://raw.githubusercontent.com/d2l-ai/d2l-en/master/environment.yml -o gluon.yml
sed -i 's/mxnet/mxnet-cu92/g' gluon.yml
conda env create -f gluon.yml
source activate gluon

This gets you to a complete installation. To test that it’s all working, have a look at:

(gluon) ubuntu@ip-172-31-63-98:~$ python
Python 3.6.8 |Anaconda, Inc.| (default, Dec 30 2018, 01:22:34) 
[GCC 7.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import mxnet as mx
>>> from mxnet import ndarray as nd
>>> x = nd.ones((5,5), ctx=mx.gpu(0))
>>> print(x)

[[1. 1. 1. 1. 1.]
 [1. 1. 1. 1. 1.]
 [1. 1. 1. 1. 1.]
 [1. 1. 1. 1. 1.]
 [1. 1. 1. 1. 1.]]
<NDArray 5x5 @gpu(0)>
2 Likes