-
Notifications
You must be signed in to change notification settings - Fork 643
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Doc] Nano benchmark and tutorial #71
Merged
Merged
Changes from 4 commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
119 changes: 119 additions & 0 deletions
119
docs/en/tutorials/how_to_install_mmdeploy_on_jetsons.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,119 @@ | ||
## How to install mmdeploy on Jetsons | ||
|
||
This tutorial introduces how to install mmdeploy on Nvidia Jetson systems. It mainly introduces the installation of mmdeploy on three Jetson series boards: | ||
- Jetson Nano | ||
- Jetson AGX Xavie | ||
- Jetson TX2 | ||
|
||
For Jetson Nano, we use Jetson Nano 2GB and install [JetPack SDK](https://developer.nvidia.com/embedded/jetpack) through SD card image method. | ||
|
||
### Install JetPack SDK | ||
|
||
There are mainly two ways to install the JetPack: | ||
1. Write the image to the SD card directly. | ||
2. Use the SDK Manager to do this. | ||
|
||
The first method does not need two separated machines and their display equipment or cables. We just follow the instruction to write the image. This is pretty convenient. Click [here](https://developer.nvidia.com/embedded/learn/get-started-jetson-nano-2gb-devkit#intro) for Jetson Nano 2GB to start. And click [here](https://developer.nvidia.com/embedded/learn/get-started-jetson-nano-devkit) for Jetson Nano 4GB to start the journey. | ||
|
||
The second method, however, requires we set up another display tool and cable to the jetson hardware. This method is safer than the previous one as the first method may sometimes cannot write the image in and throws a warning during validation. Click [here](https://docs.nvidia.com/sdk-manager/install-with-sdkm-jetson/index.html) to start. | ||
|
||
For the first method, if it always throws `Attention something went wrong...` even the file already get re-downloaded, just try `wget` to download the file and change the tail name instead. | ||
|
||
### Launch the system | ||
|
||
Sometimes we just need to reboot the jetson device when it gets stuck in initializing the system. | ||
|
||
### Cuda | ||
|
||
The Cuda is installed by default while the cudnn is not if we use the first method. We have to write the cuda path and lib to `$PATH` and `$LD_LIBRARY_PATH`: | ||
``` | ||
export PATH=$PATH:/usr/local/cuda/bin | ||
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/cuda/lib64 | ||
``` | ||
Then we can use `nvcc -V` the get the version of cuda we use. | ||
|
||
### Anaconda | ||
|
||
We have to install [Archiconda](https://github.com/Archiconda/build-tools/releases) instead as the Anaconda does not provide the wheel built for jetson. | ||
|
||
After we installed the Archiconda successfully and created the virtual env correctly. If the pip in the env does not work properly or throw `Illegal instruction (core dumped)`, we may consider re-install the pip manually, reinstalling the whole JetPack SDK is the last method we can try. | ||
|
||
### Move tensorrt to conda env | ||
After we installed the Archiconda, we can use it to create a virtual env like `mmdeploy`. Then we have to move the pre-installed tensorrt package in Jetpack to the virtual env. | ||
|
||
First we use `find` to get where the tensorrt is | ||
``` | ||
sudo find / -name tensorrt | ||
``` | ||
Then copy the tensorrt to our destination like: | ||
``` | ||
cp -r /usr/lib/python3.6/dist-packages/tensorrt* /home/archiconda3/env/mmdeploy/lib/python3.6/site-packages/ | ||
``` | ||
Meanwhle, tensorrt libs like `libnvinfer.so` can be found in `LD_LIBRARY_PATH`, which is done by Jetpack as well. | ||
|
||
### Install torch | ||
|
||
Install the PyTorch for Jetsons **specifically**. Click [here](https://forums.developer.nvidia.com/t/pytorch-for-jetson-version-1-10-now-available/72048) to get the wheel. Before we use `pip install`, we have to install `libopenblas-base`, `libopenmpi-dev` first: | ||
``` | ||
sudo apt-get install libopenblas-base libopenmpi-dev | ||
``` | ||
Or, it will throw the following error when we import torch in python: | ||
``` | ||
libmpi_cxx.so.20: cannot open shared object file: No such file or directory | ||
``` | ||
|
||
### Install torchvision | ||
We can't directly use `pip install torchvision` to install torchvision for Jetson Nano. But we can clone the repository from Github and build it locally. First we have to install some dependencies: | ||
``` | ||
sudo apt-get install libjpeg-dev libpython3-dev libavcodec-dev libavformat-dev libswscale-dev | ||
``` | ||
Then just clone and compile the project: | ||
``` | ||
git clone git@github.com:pytorch/vision.git | ||
cd vision | ||
git co tags/v0.7.0 -b vision07 | ||
pip install -e . | ||
``` | ||
|
||
### Install mmcv | ||
|
||
Install openssl first: | ||
``` | ||
sudo apt-get install libssl-dev | ||
``` | ||
Then install it from source like `MMCV_WITH_OPS=1 pip install -e .` | ||
|
||
### Update cmake | ||
|
||
We choose cmake version 20 as an example. | ||
``` | ||
sudo apt-get install -y libssl-dev | ||
wget https://github.com/Kitware/CMake/releases/download/v3.20.0/cmake-3.20.0.tar.gz | ||
tar -zxvf cmake-3.20.0.tar.gz | ||
cd cmake-3.20.0 | ||
./bootstrap | ||
make | ||
sudo make install | ||
``` | ||
Then we can check the cmake version through: | ||
``` | ||
source ~/.bashrc | ||
cmake --version | ||
``` | ||
|
||
### Install mmdeploy | ||
Just follow the instruction [here](../build.md). If it throws `failed building wheel for numpy...ERROR: Failed to build one or more wheels` when installing `h5py`, try install `h5py` manually. | ||
``` | ||
sudo apt-get install pkd-config libhdf5-100 libhdf5-dev | ||
pip install versioned-hdf5 --no-cache-dir | ||
``` | ||
|
||
Then install onnx manually. First, we have to install protobuf compiler: | ||
``` | ||
sudo apt-get install libprotobuf-dev protobuf-compiler | ||
``` | ||
Then install onnx through: | ||
``` | ||
pip install onnx | ||
``` | ||
Then reinstall mmdeploy. |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Xavier