Skip to content
This repository has been archived by the owner on Nov 17, 2023. It is now read-only.

refine Nano setup directions #15524

Merged
merged 2 commits into from
Jul 18, 2019
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
65 changes: 34 additions & 31 deletions docs/install/install-jetson.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,12 @@

MXNet supports the Ubuntu Arch64 based operating system so you can run MXNet on NVIDIA Jetson Devices, such as the [TX2](http://www.nvidia.com/object/embedded-systems-dev-kits-modules.html) or [Nano](https://developer.nvidia.com/embedded/learn/get-started-jetson-nano-devkit).

These instructions will walk through how to build MXNet and install MXNet's Python language binding.
These instructions will walk through how to build MXNet and install MXNet's Python language binding.

For the purposes of this install guide we will assume that CUDA is already installed on your Jetson device. The disk image provided by NVIDIA's getting started guides will have the Jetson toolkit preinstalled, and this also includes CUDA. You should double check what versions are installed and which version you plan to use.

You have several options for installing MXNet:
1. Use a Jetson MXNet pip wheel for Python development.
2. Use precompiled Jetson MXNet binaries.
After installing the prerequisites, you have several options for installing MXNet:
1. Use a Jetson MXNet pip wheel for Python development and use a precompiled Jetson MXNet binary.
3. Build MXNet from source
* On a faster Linux computer using cross-compilation
* On the Jetson itself (very slow and not recommended)
Expand All @@ -35,7 +34,7 @@ You have several options for installing MXNet:
To build from source or to use the Python wheel, you must install the following dependencies on your Jetson.
Cross-compiling will require dependencies installed on that machine as well.

### Python API
### Python Dependencies

To use the Python API you need the following dependencies:

Expand All @@ -60,49 +59,54 @@ sudo pip install \
```

If you plan to cross-compile you will need to install these dependencies on that computer as well.
If you get an error about something being busy, you can restart the nano and this error will go away and you can continue installation of the prerequisites.
aaronmarkham marked this conversation as resolved.
Show resolved Hide resolved

### Configure CUDA
### Download the source & setup some environment variables:

You can check to see what version of CUDA is running with `nvcc`.
These steps are optional, but some of the following instructions expect MXNet source files and the `MXNET_HOME` environment variable. Also CUDA commands will not work out of the box without updating your path.
aaronmarkham marked this conversation as resolved.
Show resolved Hide resolved

Clone the MXNet source code repository using the following `git` command in your home directory:

```bash
nvcc --version
git clone --recursive https://github.com/apache/incubator-mxnet.git mxnet
```

To switch CUDA versions on a device or computer that has more than one version installed, use the following and replace the version as appropriate.
Setup your environment variables for MXNet and CUDA in your `.profile` file in your home directory.
Add the following to the file.

```bash
sudo rm /usr/local/cuda
sudo ln -s /usr/local/cuda-10.0 /usr/local/cuda
export PATH=/usr/local/cuda/bin:$PATH
export MXNET_HOME=$HOME/mxnet/
export PYTHONPATH=$MXNET_HOME/python:$PYTHONPATH
```

**Note:** When cross-compiling, change the CUDA version on the host computer you're using to match the version you're running on your Jetson device.
**Note:** CUDA 10.1 is recommended but doesn't ship with the Nano's SD card image. You may want to go through CUDA upgrade steps first.
You can then apply this change immediately with the following:
```bash
source .profile
```

### Download the source & setup some environment variables:
**Note:** Change the `~/.profile` steps according to how you prefer to use your shell. Otherwise, your environment variables will be gone after you logout.

These steps are optional, but some of the following instructions expect MXNet source files and the `MXNET_HOME` environment variable.
### Configure CUDA

Clone the MXNet source code repository using the following `git` command in your home directory:
You can check to see what version of CUDA is running with `nvcc`.

```bash
git clone --recursive https://github.com/apache/incubator-mxnet.git mxnet
cd mxnet
nvcc --version
```

Setup your environment variables for MXNet.
To switch CUDA versions on a device or computer that has more than one version installed, use the following and replace the version as appropriate.
aaronmarkham marked this conversation as resolved.
Show resolved Hide resolved

```bash
cd ..
export MXNET_HOME=$(pwd)
echo "export PYTHONPATH=$MXNET_HOME/python:$PYTHONPATH" >> ~/.rc
source ~/.rc
sudo rm /usr/local/cuda

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe add a line here that describes how these commands will remove the directory and then replace it by creating a symlink. But Linux users may not need this called out. :)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It was always a symlink, not an actual folder. I just briefly freaked out when I thought I deleted the cuda files.

sudo ln -s /usr/local/cuda-10.0 /usr/local/cuda
```

**Note:** Change the `~/.rc` steps according to how you prefer to use your shell. Otherwise, your environment variables will be gone after you logout.
**Note:** When cross-compiling, change the CUDA version on the host computer you're using to match the version you're running on your Jetson device.
**Note:** CUDA 10.1 is recommended but doesn't ship with the Nano's SD card image. You may want to go through CUDA upgrade steps first.


## Install MXNet for Python
## Option 1. Install MXNet for Python

To use a prepared Python wheel, download it to your Jetson, and run it.
* [MXNet 1.4.0 - Python 3](https://s3.us-east-2.amazonaws.com/mxnet-public/install/jetson/1.4.0/mxnet-1.4.0-cp36-cp36m-linux_aarch64.whl)
Expand All @@ -113,12 +117,10 @@ It should download the required dependencies, but if you have issues,
install the dependencies in the prerequisites section, then run the pip wheel.

```bash
sudo pip install mxnet-1.4.0-cp36-cp36m-linux_aarch64.whl
sudo pip install mxnet-1.4.0-cp27-cp27mu-linux_aarch64.whl
```

## Use a Pre-compiled MXNet Binary

If you want to just use a pre-compiled binary you can download it from S3:
Now use a pre-compiled binary you can download it from S3 which is a patch v1.4.1:
* https://s3.us-east-2.amazonaws.com/mxnet-public/install/jetson/1.4.1/libmxnet.so

Place this file in `$MXNET_HOME/lib`.
Expand All @@ -128,12 +130,13 @@ To use this with the MXNet Python binding, you must match the source directory's
```bash
cd $MXNET_HOME
git checkout v1.4.x
git submodule update --init
git submodule update --init --recursive
cd python
sudo pip install -e .
```
aaronmarkham marked this conversation as resolved.
Show resolved Hide resolved

## Build MXNet from Source

## Option 2. Build MXNet from Source

Installing MXNet from source is a two-step process:

Expand Down