diff --git a/README.md b/README.md index 0e2088409..5041f8532 100644 --- a/README.md +++ b/README.md @@ -77,10 +77,31 @@ To build the TensorRT-OSS components, you will first need the following software ```bash git clone -b main https://github.com/nvidia/TensorRT TensorRT cd TensorRT + export TRT_OSSPATH="$(pwd)" git submodule update --init --recursive ``` -2. #### (Optional - if not using TensorRT container) Specify the TensorRT GA release build path +2. #### (If using a build container) Specify the TensorRT library location + + Build containers preinstall the TensorRT libraries. Set `TRT_LIBPATH` to the directory that + matches the target you build for: + + ```bash + # Typical x86 lib path in TensorRT and other containers + export TRT_LIBPATH="/usr/lib/x86_64-linux-gnu" + + # Typical aarch64 Linux lib path in cross-compiling containers + export TRT_LIBPATH="/usr/lib/aarch64-linux-gnu" + + # Typical aarch64 QNX lib path in cross-compiling containers + export TRT_LIBPATH="/usr/lib/aarch64-unknown-nto-qnx" + ``` + + > NOTE: A container holds more than one `libnvinfer.so`. Pick the one that matches your target, + > because the x86 libraries do not link into an aarch64 build. To list them, run + > `find / -name libnvinfer.so`. + +3. #### (If not using TensorRT container) Specify the TensorRT GA release build path If using the TensorRT OSS build container, TensorRT libraries are preinstalled under `/usr/lib/x86_64-linux-gnu` and you may skip this step. @@ -226,6 +247,87 @@ For Linux platforms, we recommend that you generate a docker container for build - `GPU_ARCHS`: GPU (SM) architectures to target. By default we generate CUDA code for all major SMs. Specific SM versions can be specified here as a quoted space-separated list to reduce compilation time and binary size. Table of compute capabilities of NVIDIA GPUs can be found [here](https://developer.nvidia.com/cuda-gpus). Examples: - NVidia A100: `-DGPU_ARCHS="80"` - RTX 50 series: `-DGPU_ARCHS="120"` - Multiple SMs: `-DGPU_ARCHS="80 120"` - `TRT_PLATFORM_ID`: Bare-metal build (unlike containerized cross-compilation). Currently supported options: `x86_64` (default). +## Building TensorRT DriveOS Samples + + The TensorRT samples are no longer included in the DriveOS SDK under `/usr/src/tensorrt`. + This is expected since samples have moved to GitHub when switching to CMake. + + Follow the DriveOS Installation Guide to launch your desired DriveOS container, then + follow the rest of these instructions to clone and build this repository in that container. + + Access the DriveOS Installation Guide for the current release at + Developer Zone - https://developer.nvidia.com/drive/documentation + NVONLINE - Search for "NVIDIA DriveOS 7.x Installation Guide" + +- Generate Makefiles and build + + **Example: Cross-Compile for DOS7 Linux (aarch64)** + + ```bash + cd $TRT_OSSPATH + mkdir -p build && cd build + cmake .. -DBUILD_SAMPLES=ON -DBUILD_PLUGINS=OFF -DBUILD_PARSERS=OFF -DTRT_OUT_DIR=`pwd`/bin_dynamic_cross -DTRT_LIB_DIR=$TRT_LIBPATH -DCMAKE_TOOLCHAIN_FILE=$TRT_OSSPATH/cmake/toolchains/cmake_aarch64_dos_cross.toolchain + make -j$(nproc) + ``` + + **Example: Cross-Compile for DOS6.5 Linux (aarch64)** + + ```bash + cd $TRT_OSSPATH + mkdir -p build && cd build + cmake .. -DBUILD_SAMPLES=ON -DBUILD_PLUGINS=OFF -DBUILD_PARSERS=OFF -DTRT_OUT_DIR=`pwd`/bin_dynamic_cross -DTRT_LIB_DIR=$TRT_LIBPATH -DCMAKE_TOOLCHAIN_FILE=$TRT_OSSPATH/cmake/toolchains/cmake_aarch64_dos_cross.toolchain -DCUDA_VERSION=11.4 -DCMAKE_CUDA_ARCHITECTURES=87 + make -j$(nproc) + ``` + + **Example: Native build for DOS6.5 and DOS7 Linux (aarch64)** + + ```bash + cd $TRT_OSSPATH + mkdir -p build && cd build + cmake .. -DTRT_LIB_DIR=$TRT_LIBPATH -DTRT_OUT_DIR=`pwd`/out -DTRT_PLATFORM_ID=aarch64 -DBUILD_SAMPLES=ON -DBUILD_PLUGINS=OFF -DBUILD_PARSERS=OFF + make -j$(nproc) + ``` + + **Example: Cross-Compile for DOS6.5 QNX (aarch64)** + + > NOTE: Set `QNX_BASE` to your QNX toolchain installation path. + > For more information on installing the QNX SDP, refer to the NVIDIA DriveOS QNX Installation Guide for your DriveOS release. + > If your CUDA version is not the same as in the example, set `CUDA_VERSION` (for examples that use it in multiple places) or add `-DCUDA_VERSION=` to the cmake command. + + ```bash + cd $TRT_OSSPATH + mkdir -p build && cd build + export CUDA_VERSION=11.4 + export CUDA=cuda-$CUDA_VERSION + export CUDA_ROOT=/usr/local/cuda-safe-$CUDA_VERSION + export QNX_BASE=/drive/toolchains/qnx_toolchain # Set to your QNX toolchain installation path + export QNX_HOST=$QNX_BASE/host/linux/x86_64/ + export QNX_TARGET=$QNX_BASE/target/qnx7/ + export PATH=$PATH:$QNX_HOST/usr/bin + cmake .. -DBUILD_SAMPLES=ON -DBUILD_PLUGINS=OFF -DBUILD_PARSERS=OFF -DBUILD_SAFE_SAMPLES=OFF -DCMAKE_CUDA_COMPILER=$CUDA_ROOT/bin/nvcc -DTRT_OUT_DIR=`pwd`/bin_dynamic_cross -DTRT_LIB_DIR=$TRT_LIBPATH -DCMAKE_TOOLCHAIN_FILE=$TRT_OSSPATH/cmake/toolchains/cmake_qnx.toolchain -DCUDA_VERSION=$CUDA_VERSION -DCMAKE_CUDA_ARCHITECTURES=87 + make -j$(nproc) + ``` + + **Example: Cross-Compile for DOS7 QNX (aarch64)** + + > NOTE: Set `QNX_BASE` to your QNX toolchain installation path. + > For more information on installing the QNX SDP, refer to the NVIDIA DriveOS QNX Installation Guide for your DriveOS release. + > If your CUDA version is not the same as in the example, set `CUDA_VERSION` (for examples that use it in multiple places) or add `-DCUDA_VERSION=` to the cmake command. + + ```bash + cd $TRT_OSSPATH + mkdir -p build && cd build + export CUDA_VERSION=13.2 + export CUDA=cuda-$CUDA_VERSION + export CUDA_ROOT=/usr/local/cuda-safe-$CUDA_VERSION + export QNX_BASE=/drive/toolchains/qnx_toolchain # Set to your QNX toolchain installation path + export QNX_HOST=$QNX_BASE/host/linux/x86_64/ + export QNX_TARGET=$QNX_BASE/target/qnx/ + export PATH=$PATH:$QNX_HOST/usr/bin + cmake .. -DBUILD_SAMPLES=ON -DBUILD_PLUGINS=OFF -DBUILD_PARSERS=OFF -DBUILD_SAFE_SAMPLES=OFF -DCMAKE_CUDA_COMPILER=$CUDA_ROOT/bin/nvcc -DTRT_OUT_DIR=`pwd`/bin_dynamic_cross -DTRT_LIB_DIR=$TRT_LIBPATH -DCMAKE_TOOLCHAIN_FILE=$TRT_OSSPATH/cmake/toolchains/cmake_qnx.toolchain -DCUDA_VERSION=$CUDA_VERSION -DCMAKE_CUDA_ARCHITECTURES=110 + make -j$(nproc) + ``` + # References ## TensorRT Resources