From 413df883726c36ea76daf1fe4601df7b1fbf524d Mon Sep 17 00:00:00 2001 From: wang-xinyu Date: Mon, 12 Oct 2020 11:55:23 +0800 Subject: [PATCH] add install guide, etc. --- README.md | 1 + tutorials/faq.md | 2 ++ tutorials/install.md | 57 +++++++++++++++++++++++++++++++++++++++++++ yolov5/CMakeLists.txt | 17 ++++++------- 4 files changed, 67 insertions(+), 10 deletions(-) create mode 100644 tutorials/install.md diff --git a/README.md b/README.md index d0965f6..bd1f260 100644 --- a/README.md +++ b/README.md @@ -24,6 +24,7 @@ All the models are implemented in pytorch or mxnet first, and export a weights f ## Tutorials +- [Install the dependencies.](./tutorials/install.md) - [A guide for quickly getting started, taking lenet5 as a demo.](./tutorials/getting_started.md) - [Frequently Asked Questions (FAQ)](./tutorials/faq.md) - [Migrating from TensorRT 4 to 7](./tutorials/migrating_from_tensorrt_4_to_7.md) diff --git a/tutorials/faq.md b/tutorials/faq.md index ea2d52b..792ebe0 100644 --- a/tutorials/faq.md +++ b/tutorials/faq.md @@ -4,6 +4,8 @@ `NvInfer.h` is one of the headers of TensorRT. If you install the tensorrt DEB package, the headers should in `/usr/include/x86_64-linux-gnu/`. If you install tensorrt TAR or ZIP file, the `include_directories` and `link_directories` of tensorrt should be added in `CMakeLists.txt`. +`dpkg -L` can print out the contents of a DEB package. + ``` $ dpkg -L libnvinfer-dev /. diff --git a/tutorials/install.md b/tutorials/install.md new file mode 100644 index 0000000..a7e7f21 --- /dev/null +++ b/tutorials/install.md @@ -0,0 +1,57 @@ +# Install the dependencies of tensorrtx + +## Ubuntu + +Ubuntu16.04 / cuda10.0 / cudnn7.6.5 / tensorrt7.0.0 / opencv3.3 would be the example, other versions might also work, just need you to try. + +It is strongly recommended to use `apt` to manage software in Ubuntu. + +### 1. Install CUDA + +Go to [cuda-10.0-download](https://developer.nvidia.com/cuda-10.0-download-archive). Choose `Linux` -> `x86_64` -> `Ubuntu` -> `16.04` -> `deb(local)` and download the .deb package. + +Then follow the installation instructions. + +``` +sudo dpkg -i cuda-repo-ubuntu1604-10-0-local-10.0.130-410.48_1.0-1_amd64.deb +sudo apt-key add /var/cuda-repo-/7fa2af80.pub +sudo apt-get update +sudo apt-get install cuda +``` + +### 2. Install TensorRT + +Go to [nvidia-tensorrt-7x-download](https://developer.nvidia.com/nvidia-tensorrt-7x-download). You might need login. + +Choose TensorRT 7.0 and `TensorRT 7.0.0.11 for Ubuntu 1604 and CUDA 10.0 DEB local repo packages` + +Install with following commands, after `apt install tensorrt`, it will automatically install cudnn, nvinfer, nvinfer-plugin, etc. + +``` +sudo dpkg -i nv-tensorrt-repo-ubuntu1604-cuda10.0-trt7.0.0.11-ga-20191216_1-1_amd64.deb +sudo apt update +sudo apt install tensorrt +``` + +### 3. Install OpenCV + +``` +sudo add-apt-repository ppa:timsc/opencv-3.3 +sudo apt-get update +sudo apt install libopencv-dev +``` + +### 4. Check your installation + +``` +dpkg -l | grep cuda +dpkg -l | grep nvinfer +dpkg -l | grep opencv +``` + +### 5. Run tensorrtx + +It is recommanded to go through the [getting started guide, lenet5 as a demo.](./tutorials/getting_started.md) first. + +But if you are proficient in tensorrt, please check the readme of the model you want directly. + diff --git a/yolov5/CMakeLists.txt b/yolov5/CMakeLists.txt index d67668a..f40e006 100644 --- a/yolov5/CMakeLists.txt +++ b/yolov5/CMakeLists.txt @@ -13,16 +13,13 @@ find_package(CUDA REQUIRED) set(CUDA_NVCC_PLAGS ${CUDA_NVCC_PLAGS};-std=c++11;-g;-G;-gencode;arch=compute_30;code=sm_30) include_directories(${PROJECT_SOURCE_DIR}/include) -if (CMAKE_SYSTEM_PROCESSOR MATCHES "aarch64") - message("embed_platform on") - include_directories(/usr/local/cuda/targets/aarch64-linux/include) - link_directories(/usr/local/cuda/targets/aarch64-linux/lib) -else() - message("embed_platform off") - include_directories(/usr/local/cuda/include) - link_directories(/usr/local/cuda/lib64) -endif() - +# include and link dirs of cuda and tensorrt, you need adapt them if yours are different +# cuda +include_directories(/usr/local/cuda/include) +link_directories(/usr/local/cuda/lib64) +# tensorrt +include_directories(/usr/include/x86_64-linux-gnu/) +link_directories(/usr/lib/x86_64-linux-gnu/) set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -Wall -Ofast -Wfatal-errors -D_MWAITXINTRIN_H_INCLUDED")