Install Apache MXNet on Jetson TK1 From Source

Muhammad Yunus
2 min readAug 12, 2021

--

Apache MXNet is an open-source deep learning software framework, used to train, and deploy deep neural networks. It is scalable, allowing for fast model training, and supports a flexible programming model and multiple programming languages (including C++, Python, Java, Julia, Matlab, JavaScript, Go, R, Scala, Perl, and Wolfram Language.) — [Wikipedia]

Prerequisites

  • Install dependencies library,
sudo apt-get update
sudo apt-get upgrade
sudo apt-get install build-essential
  • Build & Install OpenBLAS on Jetson TK1 by referring to this article.
  • (Optional) Install Python3.7 on Jetson TK1 by referring to this article,
  • (Optional) Install OpenCV3.4.5 CUDA Enable on Jetson TK1 by referring to this article,

Build & Install Apache MXNet 1.6.0

  • Clone MXNet v1.6.x
cd ~
git clone --recursive -b v1.6.x https://github.com/apache/incubator-mxnet.git mxnet
  • Add the following environment variable into ~/.profile of Jetson TK1,
export PATH=/usr/local/cuda/bin:$PATH
export MXNET_HOME=$HOME/mxnet/
export PYTHONPATH=$MXNET_HOME/python:$PYTHONPATH
  • After finish add above environment variable to ~/.profile, load that setting by entering this command,
source ~/.profile
  • Configure CUDA, check CUDA version on Jetson TK1 (should be CUDA 6.5),
nvcc --version
  • Copy & Open config.mk ,
cp $MXNET_HOME/make/config_jetson.mk $MXNET_HOME/config.mk
nano $MXNET_HOME/config.mk
  • Modify config.mk to looks like below,
  • (Optional) if you want to enable CUDA & OpenCV for MXNet just set parameter USE_CUDA=1 and USE_OPENCV=1
  • Build Apache MXNet,
cd $MXNET_HOME
make -j $(nproc)
  • (Optional) Install MXNet Python Bindings,
cd $MXNET_HOME/python
python3.7 -m pip install -e . --user

Installation Test

  • Check Apache MXNet Version in Python3.7,
import mxnet
mxnet.__version__
  • Test Apache MXNet (without CUDA) in Python3.7,
import mxnet as mx
a = mx.nd.ones((2, 3))
b = a * 2 + 1
b.asnumpy()
  • Test Apache MXNet (with CUDA) in Python3.7,
import mxnet as mx
a = mx.nd.ones((2, 3), mx.gpu())
b = a * 2 + 1
b.asnumpy()
  • At this point, we successfully install Apache MXNet 1.6.x in Jetson TK1.

Source :

--

--

Muhammad Yunus
Muhammad Yunus

Written by Muhammad Yunus

IoT Engineer, Software Developer & Machine Learning Enthusiast

No responses yet