Skip to content

Commit bc8d6cf

Browse files
committed
test
1 parent 947ab53 commit bc8d6cf

File tree

5 files changed

+401
-3
lines changed

5 files changed

+401
-3
lines changed
Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
#!/bin/bash
2+
3+
set -x
4+
5+
CURRENT_DIR=`pwd`
6+
7+
ls
8+
9+
python -m pip list | grep torch
10+
11+
python -m pip list | grep tensorrt
12+
13+
if [[ "${PYTHON_VERSION}" == "3.8" ]]; then
14+
PY_BUILD_CODE=cp38-cp38
15+
elif [[ "${PYTHON_VERSION}" == "3.9" ]]; then
16+
PY_BUILD_CODE=cp39-cp39
17+
elif [[ "${PYTHON_VERSION}" == "3.10" ]]; then
18+
PY_BUILD_CODE=cp310-cp310
19+
elif [[ "${PYTHON_VERSION}" == "3.11" ]]; then
20+
PY_BUILD_CODE=cp38-cp38
21+
else
22+
echo "python version: ${PYTHON_VERSION} is not supported"
23+
exit
24+
fi
25+
26+
python -m pip install auditwheel
27+
28+
# download TensorRT tarball
29+
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 \
30+
&& gunzip TensorRT-10.0.1.6.Linux.x86_64-gnu.cuda-12.4.tar.gz \
31+
&& tar -xvf TensorRT-10.0.1.6.Linux.x86_64-gnu.cuda-12.4.tar \
32+
&& rm TensorRT-10.0.1.6.Linux.x86_64-gnu.cuda-12.4.tar
33+
34+
TENSERRT_DIR=${CURRENT_DIR}/TensorRT-10.0.1.6
35+
36+
SITE_PKG_DIR=`python -c 'import sysconfig; print(sysconfig.get_paths()["purelib"])'`
37+
38+
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 \
39+
40+
python -m auditwheel repair \
41+
$(cat py/ci/soname_excludes.params) \
42+
--plat manylinux_2_34_x86_64 \
43+
/opt/torch-tensorrt-builds/torch_tensorrt-*-${PY_BUILD_CODE}-linux_x86_64.whl
44+
45+
cp wheelhouse/torch_tensorrt*x86_64.whl dist/
46+
47+
CUDA_VERSION=$(python -c "import versions; versions.cuda_version()")
48+
TORCHTRT_VERSION=$(python -c "import versions; versions.torch_tensorrt_version_release()")
49+
TRT_VERSION=$(python -c "import versions; versions.tensorrt_version()")
50+
TORCH_VERSION=$(python -c "from torch import __version__;print(__version__.split('+')[0])")
51+
52+
libtorchtrt() {
53+
pre_cxx11_abi=${1}
54+
PROJECT_DIR=${CURRENT_DIR}
55+
cd ${PROJECT_DIR}
56+
# mkdir -p ${PROJECT_DIR}/py/wheelhouse
57+
58+
PY_NAME=python${PYTHON_VERSION}
59+
PY_DIR=/opt/python/${PY_BUILD_CODE}
60+
61+
python -m pip install -r ${PROJECT_DIR}/py/requirements.txt
62+
if [[ '${pre_cxx11_abi}' == 'true' ]]; then
63+
bazel build //:libtorchtrt --config pre_cxx11_abi --platforms //toolchains:ci_rhel_x86_64_linux -c opt --noshow_progress
64+
cp ${PROJECT_DIR}/bazel-bin/libtorchtrt.tar.gz \
65+
${PROJECT_DIR}/dist/libtorchtrt-${TORCHTRT_VERSION}-pre-cxx11-abi-tensorrt${TRT_VERSION}-cuda${CUDA_VERSION}-libtorch${TORCH_VERSION}-x86_64-linux.tar.gz
66+
else
67+
bazel build //:libtorchtrt --platforms //toolchains:ci_rhel_x86_64_linux -c opt --noshow_progress
68+
cp ${PROJECT_DIR}/bazel-bin/libtorchtrt.tar.gz \
69+
${PROJECT_DIR}/dist/libtorchtrt-${TORCHTRT_VERSION}-tensorrt${TRT_VERSION}-cuda${CUDA_VERSION}-libtorch${TORCH_VERSION}-x86_64-linux.tar.gz
70+
fi
71+
}
72+
73+
# build pre_cxx11_abi
74+
libtorchtrt true
75+
# build cxx11_abi
76+
libtorchtrt false

.github/workflows/linter.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
name: Lint Code
22

3-
# on:
4-
# pull_request:
5-
# types: [opened, synchronize, ready_for_review, review_requested, reopened]
3+
on:
4+
pull_request:
5+
types: [opened, synchronize, ready_for_review, review_requested, reopened]
66

77
jobs:
88
cpp-linting:
Lines changed: 200 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,200 @@
1+
name: Release artifacts on Linux
2+
3+
on:
4+
workflow_call:
5+
inputs:
6+
job-name:
7+
description: "Name of task"
8+
default: ""
9+
type: string
10+
repository:
11+
description: 'Repository to checkout, defaults to ""'
12+
default: ""
13+
type: string
14+
ref:
15+
description: 'Reference to checkout, defaults to "nightly"'
16+
default: "nightly"
17+
type: string
18+
pre-script:
19+
description: "Pre script to run prior to build"
20+
default: ""
21+
type: string
22+
test-infra-repository:
23+
description: "Test infra repository to use"
24+
default: "pytorch/test-infra"
25+
type: string
26+
test-infra-ref:
27+
description: "Test infra reference to use"
28+
default: "release/2.3"
29+
type: string
30+
build-matrix:
31+
description: "Build matrix to utilize"
32+
default: ""
33+
type: string
34+
architecture:
35+
description: Architecture to build for x86_64 for default Linux, or aarch64 for Linux aarch64 builds
36+
required: false
37+
type: string
38+
default: x86_64
39+
setup-miniconda:
40+
description: Works as stated in actions/checkout, but the default value is recursive
41+
required: false
42+
type: boolean
43+
default: true
44+
# script:
45+
# description: 'Script to utilize'
46+
# default: "python setup.py bdist_wheel"
47+
# type: string
48+
continue-on-error:
49+
description: "Prevents a job from failing when a step fails. Set to true to allow a job to pass when exec script step fails."
50+
default: false
51+
type: boolean
52+
upload-artifact:
53+
description: 'Name to give artifacts uploaded from ${RUNNER_ARTIFACT_DIR}'
54+
default: ''
55+
type: string
56+
57+
jobs:
58+
build:
59+
strategy:
60+
fail-fast: false
61+
matrix: ${{ fromJSON(inputs.build-matrix) }}
62+
env:
63+
PYTHON_VERSION: ${{ matrix.python_version }}
64+
PACKAGE_TYPE: wheel
65+
REPOSITORY: ${{ inputs.repository }}
66+
REF: ${{ inputs.ref }}
67+
CU_VERSION: ${{ matrix.desired_cuda }}
68+
# SCRIPT: ${{ inputs.script }}
69+
# RUNNER_TEST_RESULTS_DIR: /tmp/test_results
70+
ARCH: ${{ inputs.architecture }}
71+
name: ${{ inputs.job-name }}-${{ matrix.desired_cuda }}
72+
runs-on: ${{ matrix.validation_runner }}
73+
container:
74+
image: ${{ matrix.container_image }}
75+
options: ${{ matrix.gpu_arch_type == 'cuda' && '--gpus all' || ' ' }}
76+
if: ${{ env.CU_VERSION == '12.1' }}
77+
# If a build is taking longer than 60 minutes on these runners we need
78+
# to have a conversation
79+
timeout-minutes: 60
80+
steps:
81+
- name: Clean workspace
82+
run: |
83+
set -euxo pipefail
84+
echo "::group::Cleanup debug output"
85+
rm -rfv "${GITHUB_WORKSPACE}"
86+
mkdir -p "${GITHUB_WORKSPACE}"
87+
echo "::endgroup::"
88+
- uses: actions/checkout@v3
89+
with:
90+
# Support the use case where we need to checkout someone's fork
91+
repository: ${{ inputs.test-infra-repository }}
92+
ref: ${{ inputs.test-infra-ref }}
93+
path: test-infra
94+
- name: Setup SSH
95+
uses: ./test-infra/.github/actions/setup-ssh
96+
with:
97+
github-secret: ${{ github.token }}
98+
- uses: ./test-infra/.github/actions/set-channel
99+
- uses: ./test-infra/.github/actions/setup-binary-builds
100+
with:
101+
repository: ${{ inputs.repository }}
102+
ref: ${{ inputs.ref }}
103+
setup-miniconda: ${{ inputs.setup-miniconda }}
104+
python-version: ${{ env.PYTHON_VERSION }}
105+
cuda-version: ${{ env.CU_VERSION }}
106+
arch: ${{ env.ARCH }}
107+
- name: Run Pre-Script with Caching
108+
if: ${{ inputs.pre-script != '' }}
109+
uses: ./test-infra/.github/actions/run-script-with-cache
110+
with:
111+
cache-path: ${{ inputs.cache-path }}
112+
cache-key: ${{ inputs.cache-key }}
113+
repository: ${{ inputs.repository }}
114+
script: ${{ inputs.pre-script }}
115+
- name: Download artifacts
116+
uses: actions/download-artifact@v3
117+
with:
118+
name: ${{ env.ARTIFACT_NAME }}
119+
path: /opt/torch-tensorrt-builds/
120+
# - name: Install torch and torch-tensorrt
121+
# if: ${{ inputs.pre-script != '' }}
122+
# uses: ./test-infra/.github/actions/run-script-with-cache
123+
# with:
124+
# repository: ${{ inputs.repository }}
125+
# script: .github/scripts/install-torch-tensorrt.sh
126+
- name: Pack script
127+
continue-on-error: ${{ inputs.continue-on-error }}
128+
working-directory: ${{ inputs.repository }}
129+
env:
130+
ALL_SECRETS: ${{ toJSON(secrets) }}
131+
run: |
132+
set -euxo pipefail
133+
source "${BUILD_ENV_FILE}"
134+
{
135+
echo "${SCRIPT}";
136+
} > "user_script"
137+
cat .github/scripts/build-linux-release-artifacts.sh user_script > exec_script
138+
- name: Run Script
139+
uses: ./test-infra/.github/actions/run-script-with-cache
140+
with:
141+
repository: ${{ inputs.repository }}
142+
script: exec_script
143+
# - name: Surface failing tests
144+
# if: always()
145+
# uses: pmeier/[email protected]
146+
# with:
147+
# path: ${{ env.RUNNER_TEST_RESULTS_DIR }}
148+
# fail-on-empty: false
149+
150+
# - name: Prepare artifacts for upload
151+
# working-directory: ${{ inputs.repository }}
152+
# id: check-artifacts
153+
# env:
154+
# UPLOAD_ARTIFACT_NAME: ${{ inputs.upload-artifact }}
155+
# run: |
156+
# if [ -d "dist" ] && [ -n "$(ls -A dist)" ]; then
157+
# mv -v dist/* "${RUNNER_ARTIFACT_DIR}/"
158+
# fi
159+
160+
# # if [[ -n "${UPLOAD_ARTIFACT_NAME}" ]]; then
161+
# # # If the default execution path is followed then we should get a wheel in the dist/ folder
162+
# # # attempt to just grab whatever is in there and scoop it all up
163+
# # if find "dist/" -name "*.whl" >/dev/null 2>/dev/null; then
164+
# # mv -v dist/*.whl "${RUNNER_ARTIFACT_DIR}/"
165+
# # fi
166+
# # # Set to fail upload step if there are no files for upload and expected files for upload
167+
# # echo 'if-no-files-found=error' >> "${GITHUB_OUTPUT}"
168+
# # fi
169+
170+
# # upload_docs=0
171+
# # # Check if there are things in the documentation folder to uplaod
172+
# # if find "${RUNNER_DOCS_DIR}" -mindepth 1 -maxdepth 1 | read -r; then
173+
# # # TODO: Add a check here to test if on ec2 because if we're not on ec2 then this
174+
# # # upload will probably not work correctly
175+
# # upload_docs=1
176+
# # fi
177+
# # echo "upload-docs=${upload_docs}" >> "${GITHUB_OUTPUT}"
178+
179+
# - name: Upload artifacts to GitHub (if any)
180+
# uses: actions/upload-artifact@v3
181+
# if: ${{ inputs.upload-artifact != '' }}
182+
# with:
183+
# name: ${{ inputs.upload-artifact }}
184+
# path: ${{ runner.temp }}/artifacts/
185+
# if-no-files-found: ${{ steps.check-artifacts.outputs.if-no-files-found }}
186+
187+
# - name: Upload documentation to S3 (if any)
188+
# uses: seemethere/upload-artifact-s3@v5
189+
# if: ${{ steps.check-artifacts.outputs.upload-docs == 1 && github.event.pull_request.number != '' }}
190+
# with:
191+
# retention-days: 14
192+
# s3-bucket: doc-previews
193+
# if-no-files-found: error
194+
# path: ${{ env.RUNNER_DOCS_DIR }}
195+
# # ${{ env.repository }} is $OWNER/$REPO
196+
# s3-prefix: ${{ env.REPOSITORY }}/${{ github.event.pull_request.number }}
197+
198+
concurrency:
199+
group: ${{ github.workflow }}-${{ github.ref_name }}
200+
cancel-in-progress: true
Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
name: Release Linux wheels and tarball
2+
3+
on:
4+
pull_request:
5+
6+
jobs:
7+
generate-matrix:
8+
uses: pytorch/test-infra/.github/workflows/generate_binary_build_matrix.yml@main
9+
with:
10+
package-type: wheel
11+
os: linux
12+
channel: release
13+
test-infra-repository: pytorch/test-infra
14+
test-infra-ref: main
15+
with-rocm: false
16+
with-cpu: false
17+
18+
build:
19+
needs: generate-matrix
20+
permissions:
21+
id-token: write
22+
contents: read
23+
strategy:
24+
fail-fast: false
25+
matrix:
26+
include:
27+
- repository: pytorch/tensorrt
28+
pre-script: packaging/pre_build_script.sh
29+
env-var-script: packaging/env_vars.txt
30+
post-script: packaging/post_build_release_script.sh
31+
smoke-test-script: packaging/smoke_test_script.sh
32+
package-name: torch_tensorrt
33+
# env:
34+
# CU_VERSION: ${{ build-matrix.desired_cuda }}
35+
# PYTHON_VERSION: ${{ build-matrix.python_version }}
36+
name: Build torch-tensorrt whl package
37+
uses: pytorch/test-infra/.github/workflows/build_wheels_linux.yml@release/2.3
38+
with:
39+
repository: ${{ matrix.repository }}
40+
ref: ""
41+
test-infra-repository: pytorch/test-infra
42+
test-infra-ref: release/2.3
43+
build-matrix: ${{ needs.generate-matrix.outputs.matrix }}
44+
pre-script: ${{ matrix.pre-script }}
45+
env-var-script: ${{ matrix.env-var-script }}
46+
post-script: ${{ matrix.post-script }}
47+
package-name: ${{ matrix.package-name }}
48+
smoke-test-script: ${{ matrix.smoke-test-script }}
49+
trigger-event: ${{ github.event_name }}
50+
51+
build-other-release-artifacts:
52+
name: Build other release artifacts
53+
needs: [generate-matrix, build]
54+
strategy:
55+
fail-fast: false
56+
matrix:
57+
include:
58+
- repository: pytorch/tensorrt
59+
if: ${{ env.CHANNEL == 'release'}}
60+
uses: pytorch/tensorrt/.github/workflows/linuex-release-artifacts.yml@release/2.3
61+
with:
62+
job-name: build-other-release-artifiacts
63+
repository: "pytorch/tensorrt"
64+
ref: ""
65+
test-infra-repository: pytorch/test-infra
66+
test-infra-ref: main
67+
build-matrix: ${{ needs.generate-matrix.outputs.matrix }}
68+
pre-script: ${{ matrix.pre-script }}
69+
70+
concurrency:
71+
group: ${{ github.workflow }}-${{ github.ref_name }}
72+
cancel-in-progress: true

0 commit comments

Comments
 (0)