Skip to content

Commit

Permalink
test
Browse files Browse the repository at this point in the history
  • Loading branch information
lanluo-nvidia committed Jun 17, 2024
1 parent 59f5cdc commit 8824afb
Showing 1 changed file with 23 additions and 18 deletions.
41 changes: 23 additions & 18 deletions .github/scripts/build-linux-release-artifacts.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,6 @@ set -x

CURRENT_DIR=`pwd`

ls

python -m pip list | grep torch

python -m pip list | grep tensorrt

if [[ "${PYTHON_VERSION}" == "3.8" ]]; then
PY_BUILD_CODE=cp38-cp38
elif [[ "${PYTHON_VERSION}" == "3.9" ]]; then
Expand All @@ -25,7 +19,14 @@ fi

python -m pip install auditwheel

# Setup Bazel via Bazelisk
wget -q https://github.com/bazelbuild/bazelisk/releases/download/v1.17.0/bazelisk-linux-amd64 -O /usr/bin/bazel &&\
chmod a+x /usr/bin/bazel

which bazel

# download TensorRT tarball
TRT_VERSION=10.0.1
wget -q https://developer.nvidia.com/downloads/compute/machine-learning/tensorrt/10.0.1/tars/TensorRT-10.0.1.6.Linux.x86_64-gnu.cuda-12.4.tar.gz \
&& gunzip TensorRT-10.0.1.6.Linux.x86_64-gnu.cuda-12.4.tar.gz \
&& tar -xvf TensorRT-10.0.1.6.Linux.x86_64-gnu.cuda-12.4.tar \
Expand All @@ -37,20 +38,13 @@ SITE_PKG_DIR=`python -c 'import sysconfig; print(sysconfig.get_paths()["purelib

LD_LIBRARY_PATH=$LD_LIBRARY_PATH:${TENSERRT_DIR}/lib:${SITE_PKG_DIR}/torch/lib:${SITE_PKG_DIR}/tensorrt/:${CUDA_HOME}/lib64:${CUDA_HOME}/lib64/stubs \

python -m auditwheel repair \
$(cat py/ci/soname_excludes.params) \
--plat manylinux_2_34_x86_64 \
/opt/torch-tensorrt-builds/torch_tensorrt-*-${PY_BUILD_CODE}-linux_x86_64.whl

if [[ ! -d dist ]]; then
mkdir dist
fi
cp wheelhouse/torch_tensorrt*x86_64.whl dist/

CUDA_VERSION=$(python -c "import versions; versions.cuda_version()")
TORCHTRT_VERSION=$(python -c "import versions; versions.torch_tensorrt_version_release()")
TRT_VERSION=$(python -c "import versions; versions.tensorrt_version()")
TORCH_VERSION=$(python -c "from torch import __version__;print(__version__.split('+')[0])")
# BUILD_VERSION is 2.3.0+cu121
# but we don't want the +cu121 in the wheel file name
TORCHTRT_VERSION=${BUILD_VERSION%+*}

libtorchtrt() {
pre_cxx11_abi=${1}
Expand All @@ -62,18 +56,29 @@ libtorchtrt() {
PY_DIR=/opt/python/${PY_BUILD_CODE}

python -m pip install -r ${PROJECT_DIR}/py/requirements.txt

TORCH_VERSION=$(python -c "from torch import __version__;print(__version__.split('+')[0])")

if [[ '${pre_cxx11_abi}' == 'true' ]]; then
bazel build //:libtorchtrt --config pre_cxx11_abi --platforms //toolchains:ci_rhel_x86_64_linux -c opt --noshow_progress
cp ${PROJECT_DIR}/bazel-bin/libtorchtrt.tar.gz \
${PROJECT_DIR}/dist/libtorchtrt-${TORCHTRT_VERSION}-pre-cxx11-abi-tensorrt${TRT_VERSION}-cuda${CUDA_VERSION}-libtorch${TORCH_VERSION}-x86_64-linux.tar.gz
${PROJECT_DIR}/dist/libtorchtrt-${TORCHTRT_VERSION}-pre-cxx11-abi-tensorrt${TRT_VERSION}-cuda${CU_VERSION}-libtorch${TORCH_VERSION}-x86_64-linux.tar.gz
else
bazel build //:libtorchtrt --platforms //toolchains:ci_rhel_x86_64_linux -c opt --noshow_progress
cp ${PROJECT_DIR}/bazel-bin/libtorchtrt.tar.gz \
${PROJECT_DIR}/dist/libtorchtrt-${TORCHTRT_VERSION}-tensorrt${TRT_VERSION}-cuda${CUDA_VERSION}-libtorch${TORCH_VERSION}-x86_64-linux.tar.gz
${PROJECT_DIR}/dist/libtorchtrt-${TORCHTRT_VERSION}-tensorrt${TRT_VERSION}-cuda${CU_VERSION}-libtorch${TORCH_VERSION}-x86_64-linux.tar.gz
fi
}

# build pre_cxx11_abi
libtorchtrt true
# build cxx11_abi
libtorchtrt false

# auditwheel repair
python -m auditwheel repair \
$(cat py/ci/soname_excludes.params) \
--plat manylinux_2_34_x86_64 \
/opt/torch-tensorrt-builds/torch_tensorrt-*-${PY_BUILD_CODE}-linux_x86_64.whl

cp wheelhouse/torch_tensorrt*x86_64.whl dist/

0 comments on commit 8824afb

Please sign in to comment.