From 36e5a1da91a4263e241b6abdf7bd389e1db11a98 Mon Sep 17 00:00:00 2001 From: lanluo-nvidia Date: Tue, 1 Oct 2024 20:29:01 -0700 Subject: [PATCH 1/9] add jp6.1 build support --- .github/scripts/build_jetson_6.1.sh | 55 +++++++++++++++++++ toolchains/BUILD | 9 ++++ toolchains/jp_workspaces/MODULE.bazel.jp61 | 61 ++++++++++++++++++++++ 3 files changed, 125 insertions(+) create mode 100755 .github/scripts/build_jetson_6.1.sh create mode 100644 toolchains/jp_workspaces/MODULE.bazel.jp61 diff --git a/.github/scripts/build_jetson_6.1.sh b/.github/scripts/build_jetson_6.1.sh new file mode 100755 index 0000000000..448949cf14 --- /dev/null +++ b/.github/scripts/build_jetson_6.1.sh @@ -0,0 +1,55 @@ +#!/usr/bin/env bash + +set -euxo pipefail + +# get jetpack version: eg: Version: 6.1+b123 ---> 6.1 +jetpack_version=$(apt show nvidia-jetpack 2>/dev/null | grep Version: | cut -d ' ' -f 2 | cut -d '+' -f 1) +python_version=$(python --version) +cuda_version=$(nvcc --version | grep Cuda | grep release | cut -d ',' -f 2 | sed -e 's/ release //g') +echo "Current jetpack_version: ${jetpack_version} cuda_version: ${cuda_version} python_version: ${python_version} " + +export LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:/usr/lib/aarch64-linux-gnu:/usr/include/aarch64-linux-gnu:/usr/local/cuda-${cuda_version}/lib64 + +# make sure nvidia-jetpack dev package is installed: +# go to /usr/include/aarch64-linux-gnu/ if you can see NvInfer.h(tensorrt related header files) which means dev package is installed +# if not installed, install via the below cmd: +# sudo apt update +# sudo apt install nvidia-jetpack + +# make sure cuda is installed: +# nvcc --version or go to /usr/local/cuda/bin to see whether it is installed +# the install nvidia-jetpack dev package step will automatically install the cuda toolkit +# if not installed, install via the below cmd: +# sudo apt update +# sudo apt install cuda-toolkit-12-6 + +# make sure bazel is installed via the below cmd: +# wget -v https://github.com/bazelbuild/bazelisk/releases/download/v1.20.0/bazelisk-linux-arm64 +# sudo mv bazelisk-linux-arm64 /usr/bin/bazel +# chmod +x /usr/bin/bazel + +# make sure setuptools is installed +# sudo apt install python3-pip +# make sure setuptools is upgraded via the below cmd: +# pip install -U pip setuptools + +# make sure torch is installed via the below cmd: +# wget https://developer.download.nvidia.cn/compute/redist/jp/v61/pytorch/torch-2.5.0a0+872d972e41.nv24.08.17622132-cp310-cp310-linux_aarch64.whl +# python -m pip install torch-2.5.0a0+872d972e41.nv24.08.17622132-cp310-cp310-linux_aarch64.whl + +# make sure libcusparseLt.so exists if not download and copy via the below cmd: +# wget https://developer.download.nvidia.com/compute/cusparselt/redist/libcusparse_lt/linux-sbsa/libcusparse_lt-linux-sbsa-0.5.2.1-archive.tar.xz +# tar xf libcusparse_lt-linux-sbsa-0.5.2.1-archive.tar.xz +# sudo cp -a libcusparse_lt-linux-sbsa-0.5.2.1-archive/include/* /usr/local/cuda/include/ +# sudo cp -a libcusparse_lt-linux-sbsa-0.5.2.1-archive/lib/* /usr/local/cuda/lib64/ + +export TORCH_INSTALL_PATH=$(python -c "import torch, os; print(os.path.dirname(torch.__file__))") +export SITE_PACKAGE_PATH=${TORCH_INSTALL_PATH::-6} +export CUDA_HOME=/usr/local/cuda-${cuda_version}/ +# replace the WORKSPACE file with jetpack one +cat WORKSPACE > WORKSPACE.orig +cat toolchains/jp_workspaces/WORKSPACE.jp60 | envsubst > WORKSPACE + +# build on jetpack +python setup.py --use-cxx11-abi install --user + diff --git a/toolchains/BUILD b/toolchains/BUILD index aa6486d075..dc82ac2af4 100644 --- a/toolchains/BUILD +++ b/toolchains/BUILD @@ -35,6 +35,15 @@ platform( ], ) +platform( + name = "jetpack_6.1", + constraint_values = [ + "@platforms//os:linux", + "@platforms//cpu:aarch64", + "@//toolchains/jetpack:4.6", + ], +) + platform( name = "ci_rhel_x86_64_linux", constraint_values = [ diff --git a/toolchains/jp_workspaces/MODULE.bazel.jp61 b/toolchains/jp_workspaces/MODULE.bazel.jp61 new file mode 100644 index 0000000000..dd694b91d2 --- /dev/null +++ b/toolchains/jp_workspaces/MODULE.bazel.jp61 @@ -0,0 +1,61 @@ +module( + name = "torch_tensorrt", + repo_name = "org_pytorch_tensorrt", + version = "${BUILD_VERSION}" +) + +bazel_dep(name = "googletest", version = "1.14.0") +bazel_dep(name = "platforms", version = "0.0.10") +bazel_dep(name = "rules_cc", version = "0.0.9") +bazel_dep(name = "rules_python", version = "0.34.0") + +python = use_extension("@rules_python//python/extensions:python.bzl", "python") +python.toolchain( + ignore_root_user_error = True, + python_version = "3.11", +) + +bazel_dep(name = "rules_pkg", version = "1.0.1") +git_override( + module_name = "rules_pkg", + commit = "17c57f4", + remote = "https://github.com/narendasan/rules_pkg", +) + +local_repository = use_repo_rule("@bazel_tools//tools/build_defs/repo:local.bzl", "local_repository") + +# External dependency for torch_tensorrt if you already have precompiled binaries. +local_repository( + name = "torch_tensorrt", + path = "${SITE_PACKAGE_PATH}/torch_tensorrt", +) + + +new_local_repository = use_repo_rule("@bazel_tools//tools/build_defs/repo:local.bzl", "new_local_repository") + +# CUDA should be installed on the system locally +new_local_repository( + name = "cuda", + build_file = "@//third_party/cuda:BUILD", + path = "${CUDA_HOME}", +) + +new_local_repository( + name = "libtorch", + path = "${TORCH_INSTALL_PATH}", + build_file = "third_party/libtorch/BUILD", +) + +new_local_repository( + name = "libtorch_pre_cxx11_abi", + path = "${TORCH_INSTALL_PATH}", + build_file = "third_party/libtorch/BUILD" +) + +new_local_repository( + name = "tensorrt", + path = "/usr/", + build_file = "@//third_party/tensorrt/local:BUILD" +) + + \ No newline at end of file From 6d957e140e4b43cabdcd5968811b6cb303f43385 Mon Sep 17 00:00:00 2001 From: lanluo-nvidia Date: Tue, 1 Oct 2024 21:07:38 -0700 Subject: [PATCH 2/9] test --- .github/scripts/build_jetson_6.1.sh | 18 ++++++++++++------ setup.py | 11 ++++++++--- toolchains/BUILD | 2 +- toolchains/jetpack/BUILD | 5 +++++ 4 files changed, 26 insertions(+), 10 deletions(-) diff --git a/.github/scripts/build_jetson_6.1.sh b/.github/scripts/build_jetson_6.1.sh index 448949cf14..4a1127afdb 100755 --- a/.github/scripts/build_jetson_6.1.sh +++ b/.github/scripts/build_jetson_6.1.sh @@ -1,5 +1,8 @@ #!/usr/bin/env bash +# how to run the jetson build on jetpack6.1: +# ./.github/scripts/build_jetson_6.1.sh + set -euxo pipefail # get jetpack version: eg: Version: 6.1+b123 ---> 6.1 @@ -28,10 +31,13 @@ export LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:/usr/lib/aarch64-linux-gnu:/usr/includ # sudo mv bazelisk-linux-arm64 /usr/bin/bazel # chmod +x /usr/bin/bazel -# make sure setuptools is installed +# make sure pip is installed: # sudo apt install python3-pip -# make sure setuptools is upgraded via the below cmd: -# pip install -U pip setuptools + +# make sure setuptools is installed with the version < 71.*.* +# version 71.*.* will give the following error during build +# TypeError: canonicalize_version() got an unexpected keyword argument 'strip_trailing_zero' +# python -m pip install setuptools==70.2.0 # make sure torch is installed via the below cmd: # wget https://developer.download.nvidia.cn/compute/redist/jp/v61/pytorch/torch-2.5.0a0+872d972e41.nv24.08.17622132-cp310-cp310-linux_aarch64.whl @@ -46,9 +52,9 @@ export LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:/usr/lib/aarch64-linux-gnu:/usr/includ export TORCH_INSTALL_PATH=$(python -c "import torch, os; print(os.path.dirname(torch.__file__))") export SITE_PACKAGE_PATH=${TORCH_INSTALL_PATH::-6} export CUDA_HOME=/usr/local/cuda-${cuda_version}/ -# replace the WORKSPACE file with jetpack one -cat WORKSPACE > WORKSPACE.orig -cat toolchains/jp_workspaces/WORKSPACE.jp60 | envsubst > WORKSPACE + +# replace the Module file with jetpack one +cat toolchains/jp_workspaces/MODULE.bazel.jp61 | envsubst > MODULE.bazel # build on jetpack python setup.py --use-cxx11-abi install --user diff --git a/setup.py b/setup.py index de532d9071..0b8f47fb6f 100644 --- a/setup.py +++ b/setup.py @@ -156,12 +156,14 @@ def load_dep_info(): JETPACK_VERSION = "4.6" elif version == "5.0": JETPACK_VERSION = "5.0" + elif version == "6.1": + JETPACK_VERSION = "6.1" if not JETPACK_VERSION: warnings.warn( - "Assuming jetpack version to be 5.0, if not use the --jetpack-version option" + "Assuming jetpack version to be 6.1, if not use the --jetpack-version option" ) - JETPACK_VERSION = "5.0" + JETPACK_VERSION = "6.1" if not CXX11_ABI: warnings.warn( @@ -213,12 +215,15 @@ def build_libtorchtrt_pre_cxx11_abi( elif JETPACK_VERSION == "5.0": cmd.append("--platforms=//toolchains:jetpack_5.0") print("Jetpack version: 5.0") + elif JETPACK_VERSION == "6.1": + cmd.append("--platforms=//toolchains:jetpack_6.1") + print("Jetpack version: 6.1") if CI_BUILD: cmd.append("--platforms=//toolchains:ci_rhel_x86_64_linux") print("CI based build") - print("building libtorchtrt") + print(f"building libtorchtrt {cmd=}") status_code = subprocess.run(cmd).returncode if status_code != 0: diff --git a/toolchains/BUILD b/toolchains/BUILD index dc82ac2af4..a3cd275373 100644 --- a/toolchains/BUILD +++ b/toolchains/BUILD @@ -40,7 +40,7 @@ platform( constraint_values = [ "@platforms//os:linux", "@platforms//cpu:aarch64", - "@//toolchains/jetpack:4.6", + "@//toolchains/jetpack:6.1", ], ) diff --git a/toolchains/jetpack/BUILD b/toolchains/jetpack/BUILD index fa5ddd2c87..ed37a864b6 100644 --- a/toolchains/jetpack/BUILD +++ b/toolchains/jetpack/BUILD @@ -11,3 +11,8 @@ constraint_value( name = "4.6", constraint_setting = ":jetpack", ) + +constraint_value( + name = "6.1", + constraint_setting = ":jetpack", +) \ No newline at end of file From 425c013fe5ee1c8f27461212483443529f6a8754 Mon Sep 17 00:00:00 2001 From: lanluo-nvidia Date: Thu, 3 Oct 2024 10:39:17 -0700 Subject: [PATCH 3/9] resolve comments --- .github/scripts/build_jetson_6.1.sh | 2 +- .../jp_workspaces/{MODULE.bazel.jp61 => MODULE.bazel.tmpl} | 0 2 files changed, 1 insertion(+), 1 deletion(-) rename toolchains/jp_workspaces/{MODULE.bazel.jp61 => MODULE.bazel.tmpl} (100%) diff --git a/.github/scripts/build_jetson_6.1.sh b/.github/scripts/build_jetson_6.1.sh index 4a1127afdb..a4fb365630 100755 --- a/.github/scripts/build_jetson_6.1.sh +++ b/.github/scripts/build_jetson_6.1.sh @@ -54,7 +54,7 @@ export SITE_PACKAGE_PATH=${TORCH_INSTALL_PATH::-6} export CUDA_HOME=/usr/local/cuda-${cuda_version}/ # replace the Module file with jetpack one -cat toolchains/jp_workspaces/MODULE.bazel.jp61 | envsubst > MODULE.bazel +cat toolchains/jp_workspaces/MODULE.bazel.tmpl | envsubst > MODULE.bazel # build on jetpack python setup.py --use-cxx11-abi install --user diff --git a/toolchains/jp_workspaces/MODULE.bazel.jp61 b/toolchains/jp_workspaces/MODULE.bazel.tmpl similarity index 100% rename from toolchains/jp_workspaces/MODULE.bazel.jp61 rename to toolchains/jp_workspaces/MODULE.bazel.tmpl From e1bfdd69c49d1ec4ce39d80f7e6e7e259e255b04 Mon Sep 17 00:00:00 2001 From: lanluo-nvidia Date: Sat, 5 Oct 2024 07:58:36 -0700 Subject: [PATCH 4/9] add the documentation for jetpack6.1 build --- .github/scripts/build_jetson_6.1.sh | 61 ---------------- docsrc/getting_started/jetpack.rst | 109 ++++++++++++++++++++++++++++ 2 files changed, 109 insertions(+), 61 deletions(-) delete mode 100755 .github/scripts/build_jetson_6.1.sh create mode 100644 docsrc/getting_started/jetpack.rst diff --git a/.github/scripts/build_jetson_6.1.sh b/.github/scripts/build_jetson_6.1.sh deleted file mode 100755 index a4fb365630..0000000000 --- a/.github/scripts/build_jetson_6.1.sh +++ /dev/null @@ -1,61 +0,0 @@ -#!/usr/bin/env bash - -# how to run the jetson build on jetpack6.1: -# ./.github/scripts/build_jetson_6.1.sh - -set -euxo pipefail - -# get jetpack version: eg: Version: 6.1+b123 ---> 6.1 -jetpack_version=$(apt show nvidia-jetpack 2>/dev/null | grep Version: | cut -d ' ' -f 2 | cut -d '+' -f 1) -python_version=$(python --version) -cuda_version=$(nvcc --version | grep Cuda | grep release | cut -d ',' -f 2 | sed -e 's/ release //g') -echo "Current jetpack_version: ${jetpack_version} cuda_version: ${cuda_version} python_version: ${python_version} " - -export LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:/usr/lib/aarch64-linux-gnu:/usr/include/aarch64-linux-gnu:/usr/local/cuda-${cuda_version}/lib64 - -# make sure nvidia-jetpack dev package is installed: -# go to /usr/include/aarch64-linux-gnu/ if you can see NvInfer.h(tensorrt related header files) which means dev package is installed -# if not installed, install via the below cmd: -# sudo apt update -# sudo apt install nvidia-jetpack - -# make sure cuda is installed: -# nvcc --version or go to /usr/local/cuda/bin to see whether it is installed -# the install nvidia-jetpack dev package step will automatically install the cuda toolkit -# if not installed, install via the below cmd: -# sudo apt update -# sudo apt install cuda-toolkit-12-6 - -# make sure bazel is installed via the below cmd: -# wget -v https://github.com/bazelbuild/bazelisk/releases/download/v1.20.0/bazelisk-linux-arm64 -# sudo mv bazelisk-linux-arm64 /usr/bin/bazel -# chmod +x /usr/bin/bazel - -# make sure pip is installed: -# sudo apt install python3-pip - -# make sure setuptools is installed with the version < 71.*.* -# version 71.*.* will give the following error during build -# TypeError: canonicalize_version() got an unexpected keyword argument 'strip_trailing_zero' -# python -m pip install setuptools==70.2.0 - -# make sure torch is installed via the below cmd: -# wget https://developer.download.nvidia.cn/compute/redist/jp/v61/pytorch/torch-2.5.0a0+872d972e41.nv24.08.17622132-cp310-cp310-linux_aarch64.whl -# python -m pip install torch-2.5.0a0+872d972e41.nv24.08.17622132-cp310-cp310-linux_aarch64.whl - -# make sure libcusparseLt.so exists if not download and copy via the below cmd: -# wget https://developer.download.nvidia.com/compute/cusparselt/redist/libcusparse_lt/linux-sbsa/libcusparse_lt-linux-sbsa-0.5.2.1-archive.tar.xz -# tar xf libcusparse_lt-linux-sbsa-0.5.2.1-archive.tar.xz -# sudo cp -a libcusparse_lt-linux-sbsa-0.5.2.1-archive/include/* /usr/local/cuda/include/ -# sudo cp -a libcusparse_lt-linux-sbsa-0.5.2.1-archive/lib/* /usr/local/cuda/lib64/ - -export TORCH_INSTALL_PATH=$(python -c "import torch, os; print(os.path.dirname(torch.__file__))") -export SITE_PACKAGE_PATH=${TORCH_INSTALL_PATH::-6} -export CUDA_HOME=/usr/local/cuda-${cuda_version}/ - -# replace the Module file with jetpack one -cat toolchains/jp_workspaces/MODULE.bazel.tmpl | envsubst > MODULE.bazel - -# build on jetpack -python setup.py --use-cxx11-abi install --user - diff --git a/docsrc/getting_started/jetpack.rst b/docsrc/getting_started/jetpack.rst new file mode 100644 index 0000000000..d7bb54e9e2 --- /dev/null +++ b/docsrc/getting_started/jetpack.rst @@ -0,0 +1,109 @@ +.. _Torch TensorRT in JetPack 6.1 + +Overview +################## + +JetPack 6.1 +--------------------- +Nvida JetPack 6.1 is the latest production release ofJetPack 6. +With this release it incorporates: +CUDA 12.6 +TensorRT 10.3 +cuDNN 9.3 +DLFW 24.0 + +You can find more details for the JetPack 6.1: + + * https://docs.nvidia.com/jetson/jetpack/release-notes/index.html + * https://docs.nvidia.com/deeplearning/frameworks/install-pytorch-jetson-platform/index.html + + +Prerequisites +~~~~~~~~~~~~~~ + + +Ensure your jetson devleoper kit has been flashed with the latest JetPack 6.1 +You can find more details on how to flash Jetson board via sdk-manager + + * https://developer.nvidia.com/sdk-manager + +.. code-block:: sh + # ensure the current jetpack version is 6.1 + apt show nvidia-jetpack + + +Ensure you have installed JetPack Dev components +This step is required if you need to build on jetson board +You can only install the dev components that you require +ex: tensorrt-dev would be the meta-package for all TRT development +or install everthing + +.. code-block:: sh + # install all the nvidia-jetpack dev components + sudo apt update + sudo apt install nvidia-jetpack + + +Ensure you have cuda 12.6 installed(this should be installed automatically from nvidia-jetpack) + +.. code-block:: sh + # check the cuda version + nvcc --version + # if not installed or the version is not 12.6, install via the below cmd: + sudo apt update + sudo apt install cuda-toolkit-12-6 + + +Ensure libcusparseLt.so exists at /usr/local/cuda/lib64/ + +.. code-block:: sh + # if not exist, download and copy to the directory + wget https://developer.download.nvidia.com/compute/cusparselt/redist/libcusparse_lt/linux-sbsa/libcusparse_lt-linux-sbsa-0.5.2.1-archive.tar.xz + tar xf libcusparse_lt-linux-sbsa-0.5.2.1-archive.tar.xz + sudo cp -a libcusparse_lt-linux-sbsa-0.5.2.1-archive/include/* /usr/local/cuda/include/ + sudo cp -a libcusparse_lt-linux-sbsa-0.5.2.1-archive/lib/* /usr/local/cuda/lib64/ + + +Build torch_tensorrt +~~~~~~~~~~~~~~ + + +Install bazel + +.. code-block:: sh + wget -v https://github.com/bazelbuild/bazelisk/releases/download/v1.20.0/bazelisk-linux-arm64 + sudo mv bazelisk-linux-arm64 /usr/bin/bazel + chmod +x /usr/bin/bazel + +Install pip and required python packages + +.. code-block:: sh + # install pip + sudp apt install python3-pip + +.. code-block:: sh + # install setuptools with the version less than 71.*.* + python -m pip install setuptools==70.2.0 + +.. code-block:: sh + # install torch + wget https://developer.download.nvidia.cn/compute/redist/jp/v61/pytorch/torch-2.5.0a0+872d972e41.nv24.08.17622132-cp310-cp310-linux_aarch64.whl + python -m pip install torch-2.5.0a0+872d972e41.nv24.08.17622132-cp310-cp310-linux_aarch64.whl + + # install torchvision + # currently it has not available yet for JetPack 6.1, it should be available in future + + +Build and Install torch_tensorrt wheel file + +.. code-block:: sh + cuda_version=$(nvcc --version | grep Cuda | grep release | cut -d ',' -f 2 | sed -e 's/ release //g') + export TORCH_INSTALL_PATH=$(python -c "import torch, os; print(os.path.dirname(torch.__file__))") + export SITE_PACKAGE_PATH=${TORCH_INSTALL_PATH::-6} + export CUDA_HOME=/usr/local/cuda-${cuda_version}/ + # replace the MODULE.bazel with the jetpack one + cat toolchains/jp_workspaces/MODULE.bazel.tmpl | envsubst > MODULE.bazel + # build and install torch_tensorrt wheel file + python setup.py --use-cxx11-abi install --user + + From 99b5b16387b486cdfd07c8da14ab0eb7ada935cf Mon Sep 17 00:00:00 2001 From: lanluo-nvidia Date: Sat, 5 Oct 2024 08:19:30 -0700 Subject: [PATCH 5/9] test --- docsrc/getting_started/jetpack.rst | 36 ++++++++++++++++++------------ 1 file changed, 22 insertions(+), 14 deletions(-) diff --git a/docsrc/getting_started/jetpack.rst b/docsrc/getting_started/jetpack.rst index d7bb54e9e2..58f8ea7afc 100644 --- a/docsrc/getting_started/jetpack.rst +++ b/docsrc/getting_started/jetpack.rst @@ -1,4 +1,4 @@ -.. _Torch TensorRT in JetPack 6.1 +.. _Torch_TensorRT_in_JetPack_6.1 Overview ################## @@ -22,41 +22,40 @@ Prerequisites ~~~~~~~~~~~~~~ -Ensure your jetson devleoper kit has been flashed with the latest JetPack 6.1 -You can find more details on how to flash Jetson board via sdk-manager +Ensure your jetson devleoper kit has been flashed with the latest JetPack 6.1. You can find more details on how to flash Jetson board via sdk-manager: * https://developer.nvidia.com/sdk-manager + +check the current jetpack version using + .. code-block:: sh - # ensure the current jetpack version is 6.1 + apt show nvidia-jetpack +Ensure you have installed JetPack Dev components. This step is required if you need to build on jetson board. -Ensure you have installed JetPack Dev components -This step is required if you need to build on jetson board -You can only install the dev components that you require -ex: tensorrt-dev would be the meta-package for all TRT development -or install everthing +You can only install the dev components that you require: ex, tensorrt-dev would be the meta-package for all TRT development or install everthing. .. code-block:: sh # install all the nvidia-jetpack dev components sudo apt update sudo apt install nvidia-jetpack - Ensure you have cuda 12.6 installed(this should be installed automatically from nvidia-jetpack) .. code-block:: sh + # check the cuda version nvcc --version # if not installed or the version is not 12.6, install via the below cmd: sudo apt update sudo apt install cuda-toolkit-12-6 - -Ensure libcusparseLt.so exists at /usr/local/cuda/lib64/ +Ensure libcusparseLt.so exists at /usr/local/cuda/lib64/: .. code-block:: sh + # if not exist, download and copy to the directory wget https://developer.download.nvidia.com/compute/cusparselt/redist/libcusparse_lt/linux-sbsa/libcusparse_lt-linux-sbsa-0.5.2.1-archive.tar.xz tar xf libcusparse_lt-linux-sbsa-0.5.2.1-archive.tar.xz @@ -71,6 +70,7 @@ Build torch_tensorrt Install bazel .. code-block:: sh + wget -v https://github.com/bazelbuild/bazelisk/releases/download/v1.20.0/bazelisk-linux-arm64 sudo mv bazelisk-linux-arm64 /usr/bin/bazel chmod +x /usr/bin/bazel @@ -78,14 +78,17 @@ Install bazel Install pip and required python packages .. code-block:: sh + # install pip sudp apt install python3-pip .. code-block:: sh + # install setuptools with the version less than 71.*.* python -m pip install setuptools==70.2.0 .. code-block:: sh + # install torch wget https://developer.download.nvidia.cn/compute/redist/jp/v61/pytorch/torch-2.5.0a0+872d972e41.nv24.08.17622132-cp310-cp310-linux_aarch64.whl python -m pip install torch-2.5.0a0+872d972e41.nv24.08.17622132-cp310-cp310-linux_aarch64.whl @@ -96,7 +99,14 @@ Install pip and required python packages Build and Install torch_tensorrt wheel file + +Since torch_tensorrt version has dependencies on torch version. torch version supported by JetPack6.1 is from DLFW 24.08/24.09(torch 2.5.0). + +Please make sure to build torch_tensorrt wheel file from source release/2.5 branch +(TODO: lanl to update the branch name once release/ngc branch is available) + .. code-block:: sh + cuda_version=$(nvcc --version | grep Cuda | grep release | cut -d ',' -f 2 | sed -e 's/ release //g') export TORCH_INSTALL_PATH=$(python -c "import torch, os; print(os.path.dirname(torch.__file__))") export SITE_PACKAGE_PATH=${TORCH_INSTALL_PATH::-6} @@ -105,5 +115,3 @@ Build and Install torch_tensorrt wheel file cat toolchains/jp_workspaces/MODULE.bazel.tmpl | envsubst > MODULE.bazel # build and install torch_tensorrt wheel file python setup.py --use-cxx11-abi install --user - - From 96ec66d2169801e2faf581afec0318303da386bc Mon Sep 17 00:00:00 2001 From: lanluo-nvidia Date: Mon, 7 Oct 2024 15:15:59 -0700 Subject: [PATCH 6/9] resolve comments --- docsrc/getting_started/jetpack.rst | 15 +++++++-------- docsrc/index.rst | 1 + 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/docsrc/getting_started/jetpack.rst b/docsrc/getting_started/jetpack.rst index 58f8ea7afc..d2c0971d92 100644 --- a/docsrc/getting_started/jetpack.rst +++ b/docsrc/getting_started/jetpack.rst @@ -10,7 +10,7 @@ With this release it incorporates: CUDA 12.6 TensorRT 10.3 cuDNN 9.3 -DLFW 24.0 +DLFW 24.09 You can find more details for the JetPack 6.1: @@ -22,7 +22,7 @@ Prerequisites ~~~~~~~~~~~~~~ -Ensure your jetson devleoper kit has been flashed with the latest JetPack 6.1. You can find more details on how to flash Jetson board via sdk-manager: +Ensure your jetson developer kit has been flashed with the latest JetPack 6.1. You can find more details on how to flash Jetson board via sdk-manager: * https://developer.nvidia.com/sdk-manager @@ -39,8 +39,8 @@ You can only install the dev components that you require: ex, tensorrt-dev would .. code-block:: sh # install all the nvidia-jetpack dev components - sudo apt update - sudo apt install nvidia-jetpack + sudo apt-get update + sudo apt-get install nvidia-jetpack Ensure you have cuda 12.6 installed(this should be installed automatically from nvidia-jetpack) @@ -49,8 +49,8 @@ Ensure you have cuda 12.6 installed(this should be installed automatically from # check the cuda version nvcc --version # if not installed or the version is not 12.6, install via the below cmd: - sudo apt update - sudo apt install cuda-toolkit-12-6 + sudo apt-get update + sudo apt-get install cuda-toolkit-12-6 Ensure libcusparseLt.so exists at /usr/local/cuda/lib64/: @@ -90,8 +90,7 @@ Install pip and required python packages .. code-block:: sh # install torch - wget https://developer.download.nvidia.cn/compute/redist/jp/v61/pytorch/torch-2.5.0a0+872d972e41.nv24.08.17622132-cp310-cp310-linux_aarch64.whl - python -m pip install torch-2.5.0a0+872d972e41.nv24.08.17622132-cp310-cp310-linux_aarch64.whl + python -m pip install https://developer.download.nvidia.com/compute/redist/jp/v61/pytorch/torch-2.5.0a0+872d972e41.nv24.08.17622132-cp310-cp310-linux_aarch64.whl # install torchvision # currently it has not available yet for JetPack 6.1, it should be available in future diff --git a/docsrc/index.rst b/docsrc/index.rst index 7a91e763ad..85ef2e3f73 100644 --- a/docsrc/index.rst +++ b/docsrc/index.rst @@ -26,6 +26,7 @@ Getting Started :hidden: getting_started/installation + getting_started/jetpack getting_started/quick_start User Guide From 6b020f4657df583f61bee990639c38731cfce4d7 Mon Sep 17 00:00:00 2001 From: lanluo-nvidia Date: Fri, 11 Oct 2024 09:51:20 -0700 Subject: [PATCH 7/9] resolve comments --- docsrc/getting_started/jetpack.rst | 6 ++++-- toolchains/jp_workspaces/requirements.txt | 6 ++++++ toolchains/jp_workspaces/test_requirements.txt | 9 +++++++++ 3 files changed, 19 insertions(+), 2 deletions(-) create mode 100644 toolchains/jp_workspaces/requirements.txt create mode 100644 toolchains/jp_workspaces/test_requirements.txt diff --git a/docsrc/getting_started/jetpack.rst b/docsrc/getting_started/jetpack.rst index d2c0971d92..04c14cc290 100644 --- a/docsrc/getting_started/jetpack.rst +++ b/docsrc/getting_started/jetpack.rst @@ -75,12 +75,14 @@ Install bazel sudo mv bazelisk-linux-arm64 /usr/bin/bazel chmod +x /usr/bin/bazel -Install pip and required python packages +Install pip and required python packages: + * https://pip.pypa.io/en/stable/installation/ .. code-block:: sh # install pip - sudp apt install python3-pip + wget https://bootstrap.pypa.io/get-pip.py + python get-pip.py .. code-block:: sh diff --git a/toolchains/jp_workspaces/requirements.txt b/toolchains/jp_workspaces/requirements.txt new file mode 100644 index 0000000000..74945d5880 --- /dev/null +++ b/toolchains/jp_workspaces/requirements.txt @@ -0,0 +1,6 @@ +setuptools==70.2.0 +numpy<2.0.0 +packaging +pyyaml +torch +--index-url https://developer.download.nvidia.com/compute/redist/jp/v61/pytorch/torch-2.5.0a0+872d972e41.nv24.08.17622132-cp310-cp310-linux_aarch64.whl diff --git a/toolchains/jp_workspaces/test_requirements.txt b/toolchains/jp_workspaces/test_requirements.txt new file mode 100644 index 0000000000..1d8a5eb97d --- /dev/null +++ b/toolchains/jp_workspaces/test_requirements.txt @@ -0,0 +1,9 @@ +expecttest==0.1.6 +networkx==2.8.8 +numpy<2.0.0 +parameterized>=0.2.0 +pytest>=8.2.1 +pytest-xdist>=3.6.1 +pyyaml +transformers +# TODO: currently timm torchvision nvidia-modelopt does not have distributions for jetson \ No newline at end of file From 1626f0ce58b8b07a91759b97fe6efe6b111f9bb7 Mon Sep 17 00:00:00 2001 From: lanluo-nvidia Date: Fri, 11 Oct 2024 09:56:53 -0700 Subject: [PATCH 8/9] resolve comments --- docsrc/getting_started/jetpack.rst | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/docsrc/getting_started/jetpack.rst b/docsrc/getting_started/jetpack.rst index 04c14cc290..7088efcf61 100644 --- a/docsrc/getting_started/jetpack.rst +++ b/docsrc/getting_started/jetpack.rst @@ -86,16 +86,11 @@ Install pip and required python packages: .. code-block:: sh - # install setuptools with the version less than 71.*.* - python -m pip install setuptools==70.2.0 + # install required python packages + python -m pip install -r toolchains/jp_workspaces/requirements.txt -.. code-block:: sh - - # install torch - python -m pip install https://developer.download.nvidia.com/compute/redist/jp/v61/pytorch/torch-2.5.0a0+872d972e41.nv24.08.17622132-cp310-cp310-linux_aarch64.whl - - # install torchvision - # currently it has not available yet for JetPack 6.1, it should be available in future + # if you want to run the test cases, then install the test required python packages + python -m pip install -r toolchains/jp_workspaces/test_requirements.txt Build and Install torch_tensorrt wheel file @@ -116,3 +111,4 @@ Please make sure to build torch_tensorrt wheel file from source release/2.5 bran cat toolchains/jp_workspaces/MODULE.bazel.tmpl | envsubst > MODULE.bazel # build and install torch_tensorrt wheel file python setup.py --use-cxx11-abi install --user + From 2455882dcc82d68da6ead54e2bdebc6f412f7997 Mon Sep 17 00:00:00 2001 From: lanluo-nvidia Date: Tue, 15 Oct 2024 23:18:26 -0700 Subject: [PATCH 9/9] test --- docsrc/getting_started/jetpack.rst | 5 +++++ toolchains/jp_workspaces/requirements.txt | 2 -- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/docsrc/getting_started/jetpack.rst b/docsrc/getting_started/jetpack.rst index 7088efcf61..f1b648fc3d 100644 --- a/docsrc/getting_started/jetpack.rst +++ b/docsrc/getting_started/jetpack.rst @@ -84,6 +84,11 @@ Install pip and required python packages: wget https://bootstrap.pypa.io/get-pip.py python get-pip.py +.. code-block:: sh + + # install pytorch from nvidia jetson distribution: https://developer.download.nvidia.com/compute/redist/jp/v61/pytorch + python -m pip install torch https://developer.download.nvidia.com/compute/redist/jp/v61/pytorch/torch-2.5.0a0+872d972e41.nv24.08.17622132-cp310-cp310-linux_aarch64.whl + .. code-block:: sh # install required python packages diff --git a/toolchains/jp_workspaces/requirements.txt b/toolchains/jp_workspaces/requirements.txt index 74945d5880..a934d2e75d 100644 --- a/toolchains/jp_workspaces/requirements.txt +++ b/toolchains/jp_workspaces/requirements.txt @@ -2,5 +2,3 @@ setuptools==70.2.0 numpy<2.0.0 packaging pyyaml -torch ---index-url https://developer.download.nvidia.com/compute/redist/jp/v61/pytorch/torch-2.5.0a0+872d972e41.nv24.08.17622132-cp310-cp310-linux_aarch64.whl