From 198299fbd9b5d3c5c02545f2e87e88d7b3f89f25 Mon Sep 17 00:00:00 2001 From: lanluo-nvidia Date: Thu, 4 Jul 2024 15:01:33 -0700 Subject: [PATCH 01/32] Test only: add release tarball workflow --- .github/workflows/build-test-linux.yml | 2 +- .github/workflows/build-test-windows.yml | 2 +- .github/workflows/linux-release.yml | 67 ++++++++++++++++++++++++ 3 files changed, 69 insertions(+), 2 deletions(-) create mode 100644 .github/workflows/linux-release.yml diff --git a/.github/workflows/build-test-linux.yml b/.github/workflows/build-test-linux.yml index b862673f0b..48f41107ee 100644 --- a/.github/workflows/build-test-linux.yml +++ b/.github/workflows/build-test-linux.yml @@ -1,7 +1,7 @@ name: Build and test Linux wheels on: - pull_request: + # pull_request: push: branches: - main diff --git a/.github/workflows/build-test-windows.yml b/.github/workflows/build-test-windows.yml index 1bdb52ae8a..d8c84c9afe 100644 --- a/.github/workflows/build-test-windows.yml +++ b/.github/workflows/build-test-windows.yml @@ -1,7 +1,7 @@ name: Build and test Windows wheels on: - pull_request: + # pull_request: push: branches: - main diff --git a/.github/workflows/linux-release.yml b/.github/workflows/linux-release.yml new file mode 100644 index 0000000000..58c81ec0dd --- /dev/null +++ b/.github/workflows/linux-release.yml @@ -0,0 +1,67 @@ +name: Release Linux wheels and tarball + +on: + pull_request: + +permissions: + id-token: write + contents: read + +jobs: + release_tar_ball: + permissions: + packages: write + env: + PYTHON_VERSION: 3.10 + CU_VERSION: cu124 + name: release_tar_ball + runs-on: linux.4xlarge.nvidia.gpu + container: + image: 'ghcr.io/pytorch/tensorrt/torch_tensorrt:2951_merge_cxx11_abi' + options: '--gpus all' + timeout-minutes: 120 + steps: + - name: Clean workspace + shell: bash -l {0} + run: | + set -euxo pipefail + echo "::group::Cleanup debug output" + rm -rf "${GITHUB_WORKSPACE}" + mkdir -p "${GITHUB_WORKSPACE}" + + if [[ "${{ inputs.architecture }}" = "aarch64" ]]; then + rm -rf "${RUNNER_TEMP}/*" + fi + + echo "::endgroup::" + - uses: actions/checkout@v3 + with: + # Support the use case where we need to checkout someone's fork + repository: ${{ inputs.test-infra-repository }} + ref: ${{ inputs.test-infra-ref }} + path: test-infra + - name: Build CXX11-ABI Tarball + shell: bash -l {0} + run: | + set -euxo pipefail + bazel build //:libtorchtrt --compilation_mode opt --config=default + mkdir release + # example: 2.4.0.dev20240610+cu124, we don't want the +cu124 part, so remove +cu124 + PYTORCH_VERSION=$(python -c "import torch; print(torch.__version__)") + PYTORCH_VERSION=${PYTORCH_VERSION%+*} + TORCHTRT_VERSION=2.5.0 + cp bazel-bin/libtorchtrt.tar.gz \ + release/libtorchtrt-${TORCHTRT_VERSION}-tensorrt${TENSORRT_VERSION}-cuda${CU_VERSION}-libtorch${PYTORCH_VERSION}-x86_64-linux.tar.gz + + # NB: Only upload to GitHub after passing smoke tests + - name: Upload wheel to GitHub + continue-on-error: true + uses: actions/upload-artifact@v3 + with: + name: release-tarball + path: /opt/torch_tensorrt/release + + +concurrency: + group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref_name }}-${{ inputs.repository }}-${{ github.event_name == 'workflow_dispatch' }}-${{ inputs.job-name }} + cancel-in-progress: true \ No newline at end of file From 41ff5e7c442784e5d5275cfef4189949a30e80c5 Mon Sep 17 00:00:00 2001 From: lanluo-nvidia Date: Thu, 4 Jul 2024 16:03:35 -0700 Subject: [PATCH 02/32] test --- .github/workflows/linux-release.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/linux-release.yml b/.github/workflows/linux-release.yml index 58c81ec0dd..0867c12e97 100644 --- a/.github/workflows/linux-release.yml +++ b/.github/workflows/linux-release.yml @@ -44,6 +44,7 @@ jobs: shell: bash -l {0} run: | set -euxo pipefail + cd /opt/torch_tensorrt bazel build //:libtorchtrt --compilation_mode opt --config=default mkdir release # example: 2.4.0.dev20240610+cu124, we don't want the +cu124 part, so remove +cu124 @@ -61,7 +62,6 @@ jobs: name: release-tarball path: /opt/torch_tensorrt/release - concurrency: group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref_name }}-${{ inputs.repository }}-${{ github.event_name == 'workflow_dispatch' }}-${{ inputs.job-name }} cancel-in-progress: true \ No newline at end of file From fb32bfc0c20ebe09198060ca6bb9c693703975fb Mon Sep 17 00:00:00 2001 From: lanluo-nvidia Date: Thu, 4 Jul 2024 17:23:51 -0700 Subject: [PATCH 03/32] test --- .github/workflows/docker_builder.yml | 96 ++++++++++++++++++++++++++-- .github/workflows/linux-release.yml | 6 +- 2 files changed, 95 insertions(+), 7 deletions(-) diff --git a/.github/workflows/docker_builder.yml b/.github/workflows/docker_builder.yml index 3059b4da71..ccaf8a4b57 100644 --- a/.github/workflows/docker_builder.yml +++ b/.github/workflows/docker_builder.yml @@ -2,6 +2,7 @@ name: 'Torch-TensorRT Docker Build' # Apply workflow only to main, nightly, release branches on: + pull_request: push: branches: - main @@ -18,14 +19,17 @@ jobs: build: permissions: packages: write - + id-token: write + contents: read runs-on: linux.4xlarge.nvidia.gpu - + outputs: + cxx11_docker_url: ${{ env.DOCKER_REGISTRY }}/${{ steps.fix_slashes_cxx11.outputs.cxx11_container_name }} # Define key environment variables # Container name is of the form torch_tensorrt: env: DOCKER_REGISTRY: ghcr.io/pytorch/tensorrt CONTAINER_NAME: torch_tensorrt:${{ github.ref_name }} + CXX11_CONTAINER_NAME: torch_tensorrt_cxx11:${{ github.ref_name }} steps: - name: Checkout repository @@ -37,6 +41,13 @@ jobs: export container_name=$(echo ${{ env.CONTAINER_NAME }} | sed 's|/|_|g') echo "container_name=$container_name" >> $GITHUB_OUTPUT + - name: Fix Slashes CXX11 Repo Name + id: fix_slashes_cxx11 + if: ${{ contains(github.event.pull_request.labels.*.name, 'build-release-artifacts') || startsWith(github.event.ref, 'refs/tags/v') }} + run: | + export container_name=$(echo ${{ env.CXX11_CONTAINER_NAME }} | sed 's|/|_|g') + echo "cxx11_container_name=$container_name" >> $GITHUB_OUTPUT + - name: Log in to the Container registry uses: docker/login-action@v2 with: @@ -45,7 +56,7 @@ jobs: password: ${{ secrets.GITHUB_TOKEN }} # Automatically detect TensorRT default versions for Torch-TRT build - - name: Build Docker image + - name: Build Pre_CXX11_ABI Docker image env: DOCKER_TAG: ${{ env.DOCKER_REGISTRY }}/${{ steps.fix_slashes.outputs.container_name }} run: | @@ -55,10 +66,31 @@ jobs: DOCKER_BUILDKIT=1 docker build --build-arg TENSORRT_VERSION=$TRT_VERSION -f docker/Dockerfile --tag $DOCKER_TAG . + - name: Build CXX11_ABI Docker image + env: + DOCKER_TAG: ${{ env.DOCKER_REGISTRY }}/${{ steps.fix_slashes_cxx11.outputs.cxx11_container_name }} + if: ${{ contains(github.event.pull_request.labels.*.name, 'build-release-artifacts') || startsWith(github.event.ref, 'refs/tags/v') }} + run: | + set -x + python3 -m pip install pyyaml + TRT_VERSION=$(python3 -c "import versions; versions.tensorrt_version()") + echo "TRT VERSION = ${TRT_VERSION}" + DOCKER_BUILDKIT=1 docker build --build-arg TENSORRT_VERSION=$TRT_VERSION --build-arg USE_CXX11_ABI=True -f docker/Dockerfile --tag $DOCKER_TAG . + - name: Push Docker image env: DOCKER_URL: ${{ env.DOCKER_REGISTRY }}/${{ steps.fix_slashes.outputs.container_name }} - run: docker push $DOCKER_URL + run: | + set -x + docker push $DOCKER_URL + + - name: Push CXX11_ABI Docker image + env: + DOCKER_URL: ${{ env.DOCKER_REGISTRY }}/${{ steps.fix_slashes_cxx11.outputs.cxx11_container_name }} + if: ${{ contains(github.event.pull_request.labels.*.name, 'build-release-artifacts') || startsWith(github.event.ref, 'refs/tags/v') }} + run: | + set -x + docker push $DOCKER_URL # Clean up all untagged containers in registry - name: Container Registry Cleanup @@ -68,3 +100,59 @@ jobs: package-type: container min-versions-to-keep: 0 delete-only-untagged-versions: True + + release_tar_ball: + needs: [build] + permissions: + packages: write + id-token: write + contents: read + env: + PYTHON_VERSION: 3.10 + CU_VERSION: cu124 + name: release_tar_ball + runs-on: linux.4xlarge.nvidia.gpu + container: + image: ${{ needs.outputs.cxx11_docker_url }} + options: '--gpus all' + timeout-minutes: 120 + if: ${{ contains(github.event.pull_request.labels.*.name, 'build-release-artifacts') || startsWith(github.event.ref, 'refs/tags/v') }} + steps: + - name: Clean workspace + shell: bash -l {0} + run: | + set -euxo pipefail + echo "::group::Cleanup debug output" + rm -rf "${GITHUB_WORKSPACE}" + mkdir -p "${GITHUB_WORKSPACE}" + + if [[ "${{ inputs.architecture }}" = "aarch64" ]]; then + rm -rf "${RUNNER_TEMP}/*" + fi + + echo "::endgroup::" + - uses: actions/checkout@v3 + with: + repository: ${{ inputs.test-infra-repository }} + ref: ${{ inputs.test-infra-ref }} + path: test-infra + - name: Build CXX11-ABI Tarball + shell: bash -l {0} + run: | + set -euxo pipefail + cd /opt/torch_tensorrt + bazel build //:libtorchtrt --compilation_mode opt --config=default + mkdir release + # example: 2.4.0.dev20240610+cu124, we don't want the +cu124 part, so remove +cu124 + PYTORCH_VERSION=$(python -c "import torch; print(torch.__version__)") + PYTORCH_VERSION=${PYTORCH_VERSION%+*} + TORCHTRT_VERSION=2.5.0 + cp bazel-bin/libtorchtrt.tar.gz \ + release/libtorchtrt-${TORCHTRT_VERSION}-tensorrt${TENSORRT_VERSION}-cuda${CU_VERSION}-libtorch${PYTORCH_VERSION}-x86_64-linux.tar.gz + + - name: Upload tarball to GitHub + continue-on-error: true + uses: actions/upload-artifact@v4 + with: + name: cxx11-tarball + path: /opt/torch_tensorrt/release/ \ No newline at end of file diff --git a/.github/workflows/linux-release.yml b/.github/workflows/linux-release.yml index 0867c12e97..bf40c9206a 100644 --- a/.github/workflows/linux-release.yml +++ b/.github/workflows/linux-release.yml @@ -55,12 +55,12 @@ jobs: release/libtorchtrt-${TORCHTRT_VERSION}-tensorrt${TENSORRT_VERSION}-cuda${CU_VERSION}-libtorch${PYTORCH_VERSION}-x86_64-linux.tar.gz # NB: Only upload to GitHub after passing smoke tests - - name: Upload wheel to GitHub + - name: Upload tarball to GitHub continue-on-error: true - uses: actions/upload-artifact@v3 + uses: actions/upload-artifact@v4 with: name: release-tarball - path: /opt/torch_tensorrt/release + path: /opt/torch_tensorrt/release/ concurrency: group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref_name }}-${{ inputs.repository }}-${{ github.event_name == 'workflow_dispatch' }}-${{ inputs.job-name }} From 1ba82aecee350e744ec2d7629c1a1a237c50f6a6 Mon Sep 17 00:00:00 2001 From: lanluo-nvidia Date: Thu, 4 Jul 2024 18:06:03 -0700 Subject: [PATCH 04/32] test --- .github/workflows/docker_builder.yml | 171 ++++++++++++++++++--------- .github/workflows/linux-release.yml | 33 +++--- 2 files changed, 132 insertions(+), 72 deletions(-) diff --git a/.github/workflows/docker_builder.yml b/.github/workflows/docker_builder.yml index ccaf8a4b57..a95e06334c 100644 --- a/.github/workflows/docker_builder.yml +++ b/.github/workflows/docker_builder.yml @@ -15,21 +15,21 @@ concurrency: group: ${{ github.workflow }}-${{ github.ref_name }} cancel-in-progress: true +permissions: + packages: write + id-token: write + contents: read + jobs: - build: - permissions: - packages: write - id-token: write - contents: read + build-pre-cxx11: runs-on: linux.4xlarge.nvidia.gpu outputs: - cxx11_docker_url: ${{ env.DOCKER_REGISTRY }}/${{ steps.fix_slashes_cxx11.outputs.cxx11_container_name }} + docker_url: ${{ env.DOCKER_REGISTRY }}/${{ steps.fix_slashes.outputs.container_name }} # Define key environment variables # Container name is of the form torch_tensorrt: env: DOCKER_REGISTRY: ghcr.io/pytorch/tensorrt CONTAINER_NAME: torch_tensorrt:${{ github.ref_name }} - CXX11_CONTAINER_NAME: torch_tensorrt_cxx11:${{ github.ref_name }} steps: - name: Checkout repository @@ -41,13 +41,6 @@ jobs: export container_name=$(echo ${{ env.CONTAINER_NAME }} | sed 's|/|_|g') echo "container_name=$container_name" >> $GITHUB_OUTPUT - - name: Fix Slashes CXX11 Repo Name - id: fix_slashes_cxx11 - if: ${{ contains(github.event.pull_request.labels.*.name, 'build-release-artifacts') || startsWith(github.event.ref, 'refs/tags/v') }} - run: | - export container_name=$(echo ${{ env.CXX11_CONTAINER_NAME }} | sed 's|/|_|g') - echo "cxx11_container_name=$container_name" >> $GITHUB_OUTPUT - - name: Log in to the Container registry uses: docker/login-action@v2 with: @@ -55,21 +48,63 @@ jobs: username: ${{ github.actor }} password: ${{ secrets.GITHUB_TOKEN }} - # Automatically detect TensorRT default versions for Torch-TRT build - - name: Build Pre_CXX11_ABI Docker image + - name: Build PRE_CXX11_ABI Docker image env: DOCKER_TAG: ${{ env.DOCKER_REGISTRY }}/${{ steps.fix_slashes.outputs.container_name }} run: | + set -x python3 -m pip install pyyaml TRT_VERSION=$(python3 -c "import versions; versions.tensorrt_version()") echo "TRT VERSION = ${TRT_VERSION}" - DOCKER_BUILDKIT=1 docker build --build-arg TENSORRT_VERSION=$TRT_VERSION -f docker/Dockerfile --tag $DOCKER_TAG . + - name: Push PRE_CXX11_ABI Docker image + env: + DOCKER_URL: ${{ env.DOCKER_REGISTRY }}/${{ steps.fix_slashes.outputs.container_name }} + run: | + set -x + docker push $DOCKER_URL + + # Clean up all untagged containers in registry + - name: Container Registry Cleanup + uses: actions/delete-package-versions@v4 + with: + package-name: "tensorrt/torch_tensorrt" + package-type: container + min-versions-to-keep: 0 + delete-only-untagged-versions: True + + build-cxx11: + if: ${{ contains(github.event.pull_request.labels.*.name, 'build-release-artifacts') || startsWith(github.event.ref, 'refs/tags/v') }} + runs-on: linux.4xlarge.nvidia.gpu + outputs: + docker_url: ${{ env.DOCKER_REGISTRY }}/${{ steps.fix_slashes.outputs.container_name }} + # Define key environment variables + # Container name is of the form torch_tensorrt_cxx11: + env: + DOCKER_REGISTRY: ghcr.io/pytorch/tensorrt + CONTAINER_NAME: torch_tensorrt_cxx11:${{ github.ref_name }} + + steps: + - name: Checkout repository + uses: actions/checkout@v3 + + - name: Fix Slashes Repo Name + id: fix_slashes + run: | + export container_name=$(echo ${{ env.CONTAINER_NAME }} | sed 's|/|_|g') + echo "container_name=$container_name" >> $GITHUB_OUTPUT + + - name: Log in to the Container registry + uses: docker/login-action@v2 + with: + registry: ${{ env.DOCKER_REGISTRY }} + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + - name: Build CXX11_ABI Docker image env: - DOCKER_TAG: ${{ env.DOCKER_REGISTRY }}/${{ steps.fix_slashes_cxx11.outputs.cxx11_container_name }} - if: ${{ contains(github.event.pull_request.labels.*.name, 'build-release-artifacts') || startsWith(github.event.ref, 'refs/tags/v') }} + DOCKER_TAG: ${{ env.DOCKER_REGISTRY }}/${{ steps.fix_slashes.outputs.container_name }} run: | set -x python3 -m pip install pyyaml @@ -77,17 +112,9 @@ jobs: echo "TRT VERSION = ${TRT_VERSION}" DOCKER_BUILDKIT=1 docker build --build-arg TENSORRT_VERSION=$TRT_VERSION --build-arg USE_CXX11_ABI=True -f docker/Dockerfile --tag $DOCKER_TAG . - - name: Push Docker image - env: - DOCKER_URL: ${{ env.DOCKER_REGISTRY }}/${{ steps.fix_slashes.outputs.container_name }} - run: | - set -x - docker push $DOCKER_URL - - name: Push CXX11_ABI Docker image env: - DOCKER_URL: ${{ env.DOCKER_REGISTRY }}/${{ steps.fix_slashes_cxx11.outputs.cxx11_container_name }} - if: ${{ contains(github.event.pull_request.labels.*.name, 'build-release-artifacts') || startsWith(github.event.ref, 'refs/tags/v') }} + DOCKER_URL: ${{ env.DOCKER_REGISTRY }}/${{ steps.fix_slashes.outputs.container_name }} run: | set -x docker push $DOCKER_URL @@ -96,63 +123,101 @@ jobs: - name: Container Registry Cleanup uses: actions/delete-package-versions@v4 with: - package-name: "tensorrt/torch_tensorrt" + package-name: "tensorrt/torch_tensorrt_cxx11" package-type: container min-versions-to-keep: 0 delete-only-untagged-versions: True - release_tar_ball: - needs: [build] - permissions: - packages: write - id-token: write - contents: read + release_cxx11_tar_ball: + needs: [build-cxx11] env: PYTHON_VERSION: 3.10 CU_VERSION: cu124 name: release_tar_ball runs-on: linux.4xlarge.nvidia.gpu container: - image: ${{ needs.outputs.cxx11_docker_url }} + image: ${{ needs.outputs.docker_url }} options: '--gpus all' timeout-minutes: 120 if: ${{ contains(github.event.pull_request.labels.*.name, 'build-release-artifacts') || startsWith(github.event.ref, 'refs/tags/v') }} steps: - - name: Clean workspace + # - name: Clean workspace + # shell: bash -l {0} + # run: | + # set -euxo pipefail + # echo "::group::Cleanup debug output" + # rm -rf "${GITHUB_WORKSPACE}" + # mkdir -p "${GITHUB_WORKSPACE}" + # echo "::endgroup::" + # - uses: actions/checkout@v3 + # with: + # repository: ${{ inputs.test-infra-repository }} + # ref: ${{ inputs.test-infra-ref }} + # path: test-infra + - name: Build CXX11-ABI Tarball shell: bash -l {0} run: | set -euxo pipefail - echo "::group::Cleanup debug output" - rm -rf "${GITHUB_WORKSPACE}" - mkdir -p "${GITHUB_WORKSPACE}" - - if [[ "${{ inputs.architecture }}" = "aarch64" ]]; then - rm -rf "${RUNNER_TEMP}/*" - fi + cd /opt/torch_tensorrt + bazel build //:libtorchtrt --compilation_mode opt --config=default + mkdir release + # example: 2.4.0.dev20240610+cu124, we don't want the +cu124 part, so remove +cu124 + PYTORCH_VERSION=$(python -c "import torch; print(torch.__version__)") + PYTORCH_VERSION=${PYTORCH_VERSION%+*} + TORCHTRT_VERSION=2.5.0 + cp bazel-bin/libtorchtrt.tar.gz \ + release/libtorchtrt-${TORCHTRT_VERSION}-tensorrt${TENSORRT_VERSION}-cuda${CU_VERSION}-libtorch${PYTORCH_VERSION}-x86_64-linux.tar.gz - echo "::endgroup::" - - uses: actions/checkout@v3 + - name: Upload tarball to GitHub + continue-on-error: true + uses: actions/upload-artifact@v4 with: - repository: ${{ inputs.test-infra-repository }} - ref: ${{ inputs.test-infra-ref }} - path: test-infra - - name: Build CXX11-ABI Tarball + name: cxx11-tarball-${PYTHON_VERSION}-${CU_VERSION} + path: /opt/torch_tensorrt/release/ + + release_pre_cxx11_tar_ball: + needs: [build-pre-cxx11] + env: + PYTHON_VERSION: 3.10 + CU_VERSION: cu124 + name: release_tar_ball + runs-on: linux.4xlarge.nvidia.gpu + container: + image: ${{ needs.outputs.docker_url }} + options: '--gpus all' + timeout-minutes: 120 + if: ${{ contains(github.event.pull_request.labels.*.name, 'build-release-artifacts') || startsWith(github.event.ref, 'refs/tags/v') }} + steps: + # - name: Clean workspace + # shell: bash -l {0} + # run: | + # set -euxo pipefail + # echo "::group::Cleanup debug output" + # rm -rf "${GITHUB_WORKSPACE}" + # mkdir -p "${GITHUB_WORKSPACE}" + # echo "::endgroup::" + # - uses: actions/checkout@v3 + # with: + # repository: ${{ inputs.test-infra-repository }} + # ref: ${{ inputs.test-infra-ref }} + # path: test-infra + - name: Build PRE-CXX11-ABI Tarball shell: bash -l {0} run: | set -euxo pipefail cd /opt/torch_tensorrt - bazel build //:libtorchtrt --compilation_mode opt --config=default + bazel build //:libtorchtrt --compilation_mode opt --config=pre_cxx11_abi mkdir release # example: 2.4.0.dev20240610+cu124, we don't want the +cu124 part, so remove +cu124 PYTORCH_VERSION=$(python -c "import torch; print(torch.__version__)") PYTORCH_VERSION=${PYTORCH_VERSION%+*} TORCHTRT_VERSION=2.5.0 cp bazel-bin/libtorchtrt.tar.gz \ - release/libtorchtrt-${TORCHTRT_VERSION}-tensorrt${TENSORRT_VERSION}-cuda${CU_VERSION}-libtorch${PYTORCH_VERSION}-x86_64-linux.tar.gz + release/libtorchtrt-${TORCHTRT_VERSION}-pre-cxx11-abi-tensorrt${TENSORRT_VERSION}-cuda${CU_VERSION}-libtorch${PYTORCH_VERSION}-x86_64-linux.tar.gz - name: Upload tarball to GitHub continue-on-error: true uses: actions/upload-artifact@v4 with: - name: cxx11-tarball + name: pre-cxx11-tarball-${PYTHON_VERSION}-${CU_VERSION} path: /opt/torch_tensorrt/release/ \ No newline at end of file diff --git a/.github/workflows/linux-release.yml b/.github/workflows/linux-release.yml index bf40c9206a..ecf72800c5 100644 --- a/.github/workflows/linux-release.yml +++ b/.github/workflows/linux-release.yml @@ -21,25 +21,20 @@ jobs: options: '--gpus all' timeout-minutes: 120 steps: - - name: Clean workspace - shell: bash -l {0} - run: | - set -euxo pipefail - echo "::group::Cleanup debug output" - rm -rf "${GITHUB_WORKSPACE}" - mkdir -p "${GITHUB_WORKSPACE}" - - if [[ "${{ inputs.architecture }}" = "aarch64" ]]; then - rm -rf "${RUNNER_TEMP}/*" - fi - - echo "::endgroup::" - - uses: actions/checkout@v3 - with: - # Support the use case where we need to checkout someone's fork - repository: ${{ inputs.test-infra-repository }} - ref: ${{ inputs.test-infra-ref }} - path: test-infra + # - name: Clean workspace + # shell: bash -l {0} + # run: | + # set -euxo pipefail + # echo "::group::Cleanup debug output" + # rm -rf "${GITHUB_WORKSPACE}" + # mkdir -p "${GITHUB_WORKSPACE}" + # echo "::endgroup::" + # - uses: actions/checkout@v3 + # with: + # # Support the use case where we need to checkout someone's fork + # repository: ${{ inputs.test-infra-repository }} + # ref: ${{ inputs.test-infra-ref }} + # path: test-infra - name: Build CXX11-ABI Tarball shell: bash -l {0} run: | From fc1fba401eb10100875547b3718eecc78013197d Mon Sep 17 00:00:00 2001 From: lanluo-nvidia Date: Thu, 4 Jul 2024 18:15:43 -0700 Subject: [PATCH 05/32] test --- docker/WORKSPACE.docker | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/docker/WORKSPACE.docker b/docker/WORKSPACE.docker index 461a22147f..1729baa2db 100755 --- a/docker/WORKSPACE.docker +++ b/docker/WORKSPACE.docker @@ -51,16 +51,18 @@ new_local_repository( # Tarballs and fetched dependencies (default - use in cases when building from precompiled bin and tarballs) ############################################################################################################# -new_local_repository( +http_archive( name = "libtorch", - path = "/opt/python3/site-packages/torch/", - build_file = "third_party/libtorch/BUILD" + build_file = "@//third_party/libtorch:BUILD", + strip_prefix = "libtorch", + urls = ["https://download.pytorch.org/libtorch/nightly/cu124/libtorch-cxx11-abi-shared-with-deps-latest.zip"], ) -new_local_repository( +http_archive( name = "libtorch_pre_cxx11_abi", - path = "/opt/python3/site-packages/torch/", - build_file = "third_party/libtorch/BUILD" + build_file = "@//third_party/libtorch:BUILD", + strip_prefix = "libtorch", + urls = ["https://download.pytorch.org/libtorch/nightly/cu124/libtorch-shared-with-deps-latest.zip"], ) #################################################################################### From bc060fc464aab639a2911d7e237e75a485ad1ca0 Mon Sep 17 00:00:00 2001 From: lanluo-nvidia Date: Thu, 4 Jul 2024 20:15:19 -0700 Subject: [PATCH 06/32] test --- .github/workflows/docker_builder.yml | 38 +--- .github/workflows/linux-release.yml | 62 ------ .github/workflows/release-linux.yml | 131 +++++++++++ .github/workflows/release-wheel-linux.yml | 251 ++++++++++++++++++++++ 4 files changed, 388 insertions(+), 94 deletions(-) delete mode 100644 .github/workflows/linux-release.yml create mode 100644 .github/workflows/release-linux.yml create mode 100644 .github/workflows/release-wheel-linux.yml diff --git a/.github/workflows/docker_builder.yml b/.github/workflows/docker_builder.yml index a95e06334c..82f9f02cdb 100644 --- a/.github/workflows/docker_builder.yml +++ b/.github/workflows/docker_builder.yml @@ -38,6 +38,7 @@ jobs: - name: Fix Slashes Repo Name id: fix_slashes run: | + set -x export container_name=$(echo ${{ env.CONTAINER_NAME }} | sed 's|/|_|g') echo "container_name=$container_name" >> $GITHUB_OUTPUT @@ -92,6 +93,7 @@ jobs: - name: Fix Slashes Repo Name id: fix_slashes run: | + set -x export container_name=$(echo ${{ env.CONTAINER_NAME }} | sed 's|/|_|g') echo "container_name=$container_name" >> $GITHUB_OUTPUT @@ -128,32 +130,18 @@ jobs: min-versions-to-keep: 0 delete-only-untagged-versions: True - release_cxx11_tar_ball: + release-cxx11-tar-ball: needs: [build-cxx11] env: PYTHON_VERSION: 3.10 CU_VERSION: cu124 - name: release_tar_ball runs-on: linux.4xlarge.nvidia.gpu container: - image: ${{ needs.outputs.docker_url }} + image: ${{ needs.build-cxx11.outputs.docker_url }} options: '--gpus all' timeout-minutes: 120 if: ${{ contains(github.event.pull_request.labels.*.name, 'build-release-artifacts') || startsWith(github.event.ref, 'refs/tags/v') }} steps: - # - name: Clean workspace - # shell: bash -l {0} - # run: | - # set -euxo pipefail - # echo "::group::Cleanup debug output" - # rm -rf "${GITHUB_WORKSPACE}" - # mkdir -p "${GITHUB_WORKSPACE}" - # echo "::endgroup::" - # - uses: actions/checkout@v3 - # with: - # repository: ${{ inputs.test-infra-repository }} - # ref: ${{ inputs.test-infra-ref }} - # path: test-infra - name: Build CXX11-ABI Tarball shell: bash -l {0} run: | @@ -175,32 +163,18 @@ jobs: name: cxx11-tarball-${PYTHON_VERSION}-${CU_VERSION} path: /opt/torch_tensorrt/release/ - release_pre_cxx11_tar_ball: + release-pre-cxx11-tar-ball: needs: [build-pre-cxx11] env: PYTHON_VERSION: 3.10 CU_VERSION: cu124 - name: release_tar_ball runs-on: linux.4xlarge.nvidia.gpu container: - image: ${{ needs.outputs.docker_url }} + image: ${{ needs.build-pre-cxx11.outputs.docker_url }} options: '--gpus all' timeout-minutes: 120 if: ${{ contains(github.event.pull_request.labels.*.name, 'build-release-artifacts') || startsWith(github.event.ref, 'refs/tags/v') }} steps: - # - name: Clean workspace - # shell: bash -l {0} - # run: | - # set -euxo pipefail - # echo "::group::Cleanup debug output" - # rm -rf "${GITHUB_WORKSPACE}" - # mkdir -p "${GITHUB_WORKSPACE}" - # echo "::endgroup::" - # - uses: actions/checkout@v3 - # with: - # repository: ${{ inputs.test-infra-repository }} - # ref: ${{ inputs.test-infra-ref }} - # path: test-infra - name: Build PRE-CXX11-ABI Tarball shell: bash -l {0} run: | diff --git a/.github/workflows/linux-release.yml b/.github/workflows/linux-release.yml deleted file mode 100644 index ecf72800c5..0000000000 --- a/.github/workflows/linux-release.yml +++ /dev/null @@ -1,62 +0,0 @@ -name: Release Linux wheels and tarball - -on: - pull_request: - -permissions: - id-token: write - contents: read - -jobs: - release_tar_ball: - permissions: - packages: write - env: - PYTHON_VERSION: 3.10 - CU_VERSION: cu124 - name: release_tar_ball - runs-on: linux.4xlarge.nvidia.gpu - container: - image: 'ghcr.io/pytorch/tensorrt/torch_tensorrt:2951_merge_cxx11_abi' - options: '--gpus all' - timeout-minutes: 120 - steps: - # - name: Clean workspace - # shell: bash -l {0} - # run: | - # set -euxo pipefail - # echo "::group::Cleanup debug output" - # rm -rf "${GITHUB_WORKSPACE}" - # mkdir -p "${GITHUB_WORKSPACE}" - # echo "::endgroup::" - # - uses: actions/checkout@v3 - # with: - # # Support the use case where we need to checkout someone's fork - # repository: ${{ inputs.test-infra-repository }} - # ref: ${{ inputs.test-infra-ref }} - # path: test-infra - - name: Build CXX11-ABI Tarball - shell: bash -l {0} - run: | - set -euxo pipefail - cd /opt/torch_tensorrt - bazel build //:libtorchtrt --compilation_mode opt --config=default - mkdir release - # example: 2.4.0.dev20240610+cu124, we don't want the +cu124 part, so remove +cu124 - PYTORCH_VERSION=$(python -c "import torch; print(torch.__version__)") - PYTORCH_VERSION=${PYTORCH_VERSION%+*} - TORCHTRT_VERSION=2.5.0 - cp bazel-bin/libtorchtrt.tar.gz \ - release/libtorchtrt-${TORCHTRT_VERSION}-tensorrt${TENSORRT_VERSION}-cuda${CU_VERSION}-libtorch${PYTORCH_VERSION}-x86_64-linux.tar.gz - - # NB: Only upload to GitHub after passing smoke tests - - name: Upload tarball to GitHub - continue-on-error: true - uses: actions/upload-artifact@v4 - with: - name: release-tarball - path: /opt/torch_tensorrt/release/ - -concurrency: - group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref_name }}-${{ inputs.repository }}-${{ github.event_name == 'workflow_dispatch' }}-${{ inputs.job-name }} - cancel-in-progress: true \ No newline at end of file diff --git a/.github/workflows/release-linux.yml b/.github/workflows/release-linux.yml new file mode 100644 index 0000000000..139dc00c24 --- /dev/null +++ b/.github/workflows/release-linux.yml @@ -0,0 +1,131 @@ +name: Release Linux wheels and tarball + +on: + pull_request: + push: + tags: + # NOTE: Binary build pipelines should only get triggered on release candidate builds + # Release candidate tags look like: v1.11.0-rc1 + - v[0-9]+.[0-9]+.[0-9]+-rc[0-9]+ + +permissions: + id-token: write + contents: read + packages: write + +jobs: + release-cxx11-tar-ball: + env: + PYTHON_VERSION: 3.10 + CU_VERSION: cu124 + name: release_cxx11_tar_ball + runs-on: linux.4xlarge.nvidia.gpu + container: + # TODO: this should be changed to ghcr.io/pytorch/tensorrt/torch_tensorrt_cxx11:release_2.4 + # once the PR is committed to release/2.4 branch + image: 'ghcr.io/pytorch/tensorrt/torch_tensorrt_cxx11:2987_merge' + options: '--gpus all' + timeout-minutes: 120 + steps: + - name: Build CXX11-ABI Tarball + shell: bash -l {0} + run: | + set -euxo pipefail + cd /opt/torch_tensorrt + bazel build //:libtorchtrt --compilation_mode opt --config=default + mkdir release + # example: 2.4.0.dev20240610+cu124, we don't want the +cu124 part, so remove +cu124 + PYTORCH_VERSION=$(python -c "import torch; print(torch.__version__)") + PYTORCH_VERSION=${PYTORCH_VERSION%+*} + TORCHTRT_VERSION=2.4.0 + cp bazel-bin/libtorchtrt.tar.gz \ + release/libtorchtrt-${TORCHTRT_VERSION}-tensorrt${TENSORRT_VERSION}-cuda${CU_VERSION}-libtorch${PYTORCH_VERSION}-x86_64-linux.tar.gz + + # NB: Only upload to GitHub after passing smoke tests + - name: Upload tarball to GitHub + continue-on-error: true + uses: actions/upload-artifact@v4 + with: + name: cxx11-tarball-${PYTHON_VERSION}-${CU_VERSION} + path: /opt/torch_tensorrt/release/ + + release-pre-cxx11-tar-ball: + env: + PYTHON_VERSION: 3.10 + CU_VERSION: cu124 + name: release_pre_cxx11_tar_ball + runs-on: linux.4xlarge.nvidia.gpu + container: + # TODO: this should be changed to ghcr.io/pytorch/tensorrt/torch_tensorrt:release_2.4 + # once the PR is committed to release/2.4 branch + image: 'ghcr.io/pytorch/tensorrt/torch_tensorrt:2987_merge' + options: '--gpus all' + timeout-minutes: 120 + steps: + - name: Build PRE-CXX11-ABI Tarball + shell: bash -l {0} + run: | + set -euxo pipefail + cd /opt/torch_tensorrt + bazel build //:libtorchtrt --compilation_mode opt --config=pre_cxx11_abi + mkdir release + # example: 2.4.0.dev20240610+cu124, we don't want the +cu124 part, so remove +cu124 + PYTORCH_VERSION=$(python -c "import torch; print(torch.__version__)") + PYTORCH_VERSION=${PYTORCH_VERSION%+*} + TORCHTRT_VERSION=2.4.0 + cp bazel-bin/libtorchtrt.tar.gz \ + release/libtorchtrt-${TORCHTRT_VERSION}-pre-cxx11-abi-tensorrt${TENSORRT_VERSION}-cuda${CU_VERSION}-libtorch${PYTORCH_VERSION}-x86_64-linux.tar.gz + + # NB: Only upload to GitHub after passing smoke tests + - name: Upload tarball to GitHub + continue-on-error: true + uses: actions/upload-artifact@v4 + with: + name: pre-cxx11-tarball-${PYTHON_VERSION}-${CU_VERSION} + path: /opt/torch_tensorrt/release/ + + generate-matrix: + uses: pytorch/test-infra/.github/workflows/generate_binary_build_matrix.yml@main + with: + package-type: wheel + os: linux + test-infra-repository: pytorch/test-infra + test-infra-ref: main + with-rocm: false + with-cpu: false + + generate-release-matrix: + needs: [generate-matrix] + outputs: + matrix: ${{ steps.generate.outputs.matrix }} + runs-on: ubuntu-latest + steps: + - name: Generate release matrix + id: generate + run: | + set -x + apt-get update && apt-get install -y jq + MATRIX_BLOB=${{ needs.generate-matrix.outputs.matrix }} + echo "${MATRIX_BLOB}" + RELEASE_MATRIX_BLOB=$(echo ${MATRIX_BLOB} | jq ."include" | jq '.[] | select(.desired_cuda=="cu124")' ) + echo "${RELEASE_MATRIX_BLOB}" + echo "matrix=${RELEASE_MATRIX_BLOB}" >> "${GITHUB_OUTPUT}" + + build-wheel-artifacts: + name: Build torch-tensorrt release wheel artifacts + needs: [generate-release-matrix] + strategy: + fail-fast: false + matrix: + include: + - repository: pytorch/tensorrt + package-name: torch_tensorrt + pre-script: packaging/pre_build_script.sh + env-var-script: packaging/env_vars.txt + post-script: packaging/post_build_script.sh + smoke-test-script: packaging/smoke_test_script.sh + uses: ./.github/workflows/release-wheel-linux.yml + +concurrency: + group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref_name }}-${{ inputs.repository }}-${{ github.event_name == 'workflow_dispatch' }}-${{ inputs.job-name }} + cancel-in-progress: true \ No newline at end of file diff --git a/.github/workflows/release-wheel-linux.yml b/.github/workflows/release-wheel-linux.yml new file mode 100644 index 0000000000..28b3b5d0ba --- /dev/null +++ b/.github/workflows/release-wheel-linux.yml @@ -0,0 +1,251 @@ +name: Build Release Wheel Artifacts on Linux + +on: + workflow_call: + inputs: + repository: + description: 'Repository to checkout, defaults to ""' + default: "" + type: string + ref: + description: 'Reference to checkout, defaults to "nightly"' + default: "nightly" + type: string + test-infra-repository: + description: "Test infra repository to use" + default: "pytorch/test-infra" + type: string + test-infra-ref: + description: "Test infra reference to use" + default: "" + type: string + build-matrix: + description: "Build matrix to utilize" + default: "" + type: string + pre-script: + description: "Pre script to run prior to build" + default: "" + type: string + post-script: + description: "Post script to run prior to build" + default: "" + type: string + smoke-test-script: + description: "Script for Smoke Test for a specific domain" + default: "" + type: string + env-var-script: + description: "Script that sets Domain-Specific Environment Variables" + default: "" + type: string + package-name: + description: "Name of the actual python package that is imported" + default: "" + type: string + trigger-event: + description: "Trigger Event in caller that determines whether or not to upload" + default: "" + type: string + cache-path: + description: "The path(s) on the runner to cache or restore. The path is relative to repository." + default: "" + type: string + cache-key: + description: "The key created when saving a cache and the key used to search for a cache." + default: "" + type: string + architecture: + description: Architecture to build for x86_64 for default Linux, or aarch64 for Linux aarch64 builds + required: false + type: string + default: x86_64 + submodules: + description: Works as stated in actions/checkout, but the default value is recursive + required: false + type: string + default: recursive + setup-miniconda: + description: Set to true if setup-miniconda is needed + required: false + type: boolean + default: true + +permissions: + id-token: write + contents: read + +jobs: + release-wheel: + strategy: + fail-fast: false + matrix: ${{ fromJSON(inputs.build-matrix) }} + env: + PYTHON_VERSION: ${{ matrix.python_version }} + PACKAGE_TYPE: wheel + REPOSITORY: ${{ inputs.repository }} + REF: ${{ inputs.ref }} + CU_VERSION: ${{ matrix.desired_cuda }} + UPLOAD_TO_BASE_BUCKET: ${{ matrix.upload_to_base_bucket }} + ARCH: ${{ inputs.architecture }} + name: release_${{ matrix.build_name }} + runs-on: ${{ matrix.validation_runner }} + container: + image: ${{ matrix.container_image }} + options: ${{ matrix.gpu_arch_type == 'cuda' && '--gpus all' || ' ' }} + # If a build is taking longer than 120 minutes on these runners we need + # to have a conversation + timeout-minutes: 120 + steps: + - name: Clean workspace + shell: bash -l {0} + run: | + set -euxo pipefail + echo "needs.check.outputs.release_flag: ${{ needs.check.outputs.release_flag }}" + echo "::group::Cleanup debug output" + rm -rf "${GITHUB_WORKSPACE}" + mkdir -p "${GITHUB_WORKSPACE}" + if [[ "${{ inputs.architecture }}" = "aarch64" ]]; then + rm -rf "${RUNNER_TEMP}/*" + fi + echo "::endgroup::" + - uses: actions/checkout@v3 + with: + # Support the use case where we need to checkout someone's fork + repository: ${{ inputs.test-infra-repository }} + ref: ${{ inputs.test-infra-ref }} + path: test-infra + - uses: actions/checkout@v3 + if: ${{ env.ARCH == 'aarch64' }} + with: + # Support the use case where we need to checkout someone's fork + repository: "pytorch/builder" + ref: "main" + path: builder + - name: Set linux aarch64 CI + if: ${{ inputs.architecture == 'aarch64' }} + shell: bash -l {0} + env: + DESIRED_PYTHON: ${{ matrix.python_version }} + run: | + set +e + # TODO: This is temporary aarch64 setup script, this should be integrated into aarch64 docker. + ${GITHUB_WORKSPACE}/builder/aarch64_linux/aarch64_ci_setup.sh + echo "/opt/conda/bin" >> $GITHUB_PATH + set -e + - uses: ./test-infra/.github/actions/set-channel + - name: Set PYTORCH_VERSION + if: ${{ env.CHANNEL == 'test' }} + run: | + # When building RC, set the version to be the current candidate version, + # otherwise, leave it alone so nightly will pick up the latest + echo "PYTORCH_VERSION=${{ matrix.stable_version }}" >> "${GITHUB_ENV}" + - uses: ./test-infra/.github/actions/setup-binary-builds + env: + PLATFORM: ${{ inputs.architecture == 'aarch64' && 'linux-aarch64' || ''}} + with: + repository: ${{ inputs.repository }} + ref: ${{ inputs.ref }} + submodules: ${{ inputs.submodules }} + setup-miniconda: ${{ inputs.setup-miniconda }} + python-version: ${{ env.PYTHON_VERSION }} + cuda-version: ${{ env.CU_VERSION }} + arch: ${{ env.ARCH }} + - name: Combine Env Var and Build Env Files + if: ${{ inputs.env-var-script != '' }} + working-directory: ${{ inputs.repository }} + run: | + set -euxo pipefail + cat "${{ inputs.env-var-script }}" >> "${BUILD_ENV_FILE}" + - name: Install torch dependency + run: | + set -euxo pipefail + # shellcheck disable=SC1090 + source "${BUILD_ENV_FILE}" + # shellcheck disable=SC2086 + ${CONDA_RUN} ${PIP_INSTALL_TORCH} + - name: Run Pre-Script with Caching + if: ${{ inputs.pre-script != '' }} + uses: ./test-infra/.github/actions/run-script-with-cache + with: + cache-path: ${{ inputs.cache-path }} + cache-key: ${{ inputs.cache-key }} + repository: ${{ inputs.repository }} + script: ${{ inputs.pre-script }} + - name: Build clean + working-directory: ${{ inputs.repository }} + shell: bash -l {0} + run: | + set -euxo pipefail + source "${BUILD_ENV_FILE}" + ${CONDA_RUN} python setup.py clean + - name: Build the wheel (bdist_wheel) + working-directory: ${{ inputs.repository }} + shell: bash -l {0} + run: | + # set -euxo pipefail + set -x + source "${BUILD_ENV_FILE}" + + # BUILD_VERSION example: 2.4.0.dev20240610+cu121, we don't want the +cu121 part, so remove +cu121 + BUILD_VERSION=${BUILD_VERSION%+*} + ${CONDA_RUN} python setup.py bdist_wheel --release + TRT_VERSION=10.0.1 + + ${CONDA_RUN} python -m pip install auditwheel + ${CONDA_RUN} python -m auditwheel repair \ + $(cat py/ci/soname_excludes.params) \ + --plat manylinux_2_34_x86_64 \ + dist/torch_tensorrt-*-linux_x86_64.whl + ${CONDA_RUN} python -m zipfile --list wheelhouse/torch_tensorrt-*_x86_64.whl + cp wheelhouse/torch_tensorrt-*_x86_64.whl dist/ + - name: Run Post-Script + if: ${{ inputs.post-script != '' }} + uses: ./test-infra/.github/actions/run-script-with-cache + with: + repository: ${{ inputs.repository }} + script: ${{ inputs.post-script }} + - name: Smoke Test + shell: bash -l {0} + env: + PACKAGE_NAME: ${{ inputs.package-name }} + SMOKE_TEST_SCRIPT: ${{ inputs.smoke-test-script }} + run: | + set -euxo pipefail + source "${BUILD_ENV_FILE}" + WHEEL_NAME=$(ls "${{ inputs.repository }}/dist/" | grep .whl) + echo "$WHEEL_NAME" + ${CONDA_RUN} pip install "${{ inputs.repository }}/dist/$WHEEL_NAME" + # Checking that we have a pinned version of torch in our dependency tree + ( + pushd "${RUNNER_TEMP}" + unzip -o "${GITHUB_WORKSPACE}/${{ inputs.repository }}/dist/$WHEEL_NAME" + # Ensure that pytorch version is pinned, should output file where it was found + grep "Requires-Dist: torch (==.*)" -r . + ) + if [[ (! -f "${{ inputs.repository }}"/${SMOKE_TEST_SCRIPT}) ]]; then + echo "${{ inputs.repository }}/${SMOKE_TEST_SCRIPT} not found" + if [[ "${PACKAGE_NAME}" = "torchrec" ]]; then + # Special case for torchrec temporarily since __version__ does not + # work correctly on main in torchrec. This block will be + # removed once we fix it. + ${CONDA_RUN} python -c "import ${PACKAGE_NAME}" + else + ${CONDA_RUN} python -c "import ${PACKAGE_NAME}; print('package version is ', ${PACKAGE_NAME}.__version__)" + fi + else + echo "${{ inputs.repository }}/${SMOKE_TEST_SCRIPT} found" + ${CONDA_RUN} python "${{ inputs.repository }}/${SMOKE_TEST_SCRIPT}" + fi + # NB: Only upload to GitHub after passing smoke tests + - name: Upload wheel to GitHub + continue-on-error: true + uses: actions/upload-artifact@v3 + with: + name: ${{ env.ARTIFACT_NAME }} + path: ${{ inputs.repository }}/dist/ + + +concurrency: + group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref_name }}-${{ inputs.repository }}-${{ github.event_name == 'workflow_dispatch' }}-${{ inputs.job-name }} + cancel-in-progress: true \ No newline at end of file From ab1f547bb41abdb8669d160629d0297822d4cbf1 Mon Sep 17 00:00:00 2001 From: lanluo-nvidia Date: Thu, 4 Jul 2024 20:30:49 -0700 Subject: [PATCH 07/32] test --- .github/workflows/release-linux.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/release-linux.yml b/.github/workflows/release-linux.yml index 139dc00c24..4cba1657cb 100644 --- a/.github/workflows/release-linux.yml +++ b/.github/workflows/release-linux.yml @@ -104,7 +104,7 @@ jobs: id: generate run: | set -x - apt-get update && apt-get install -y jq + sudo apt-get update && apt-get install -y jq MATRIX_BLOB=${{ needs.generate-matrix.outputs.matrix }} echo "${MATRIX_BLOB}" RELEASE_MATRIX_BLOB=$(echo ${MATRIX_BLOB} | jq ."include" | jq '.[] | select(.desired_cuda=="cu124")' ) From 9f05b661fecc9a103167c8efce72b14296e53da1 Mon Sep 17 00:00:00 2001 From: lanluo-nvidia Date: Fri, 5 Jul 2024 00:45:53 -0700 Subject: [PATCH 08/32] test --- .github/workflows/release-linux.yml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/.github/workflows/release-linux.yml b/.github/workflows/release-linux.yml index 4cba1657cb..f438275b7b 100644 --- a/.github/workflows/release-linux.yml +++ b/.github/workflows/release-linux.yml @@ -104,10 +104,11 @@ jobs: id: generate run: | set -x - sudo apt-get update && apt-get install -y jq + sudo apt-get update && sudo apt-get install -y jq MATRIX_BLOB=${{ needs.generate-matrix.outputs.matrix }} echo "${MATRIX_BLOB}" - RELEASE_MATRIX_BLOB=$(echo ${MATRIX_BLOB} | jq ."include" | jq '.[] | select(.desired_cuda=="cu124")' ) + RELEASE_MATRIX_INCLUDE=$(echo ${MATRIX_BLOB} | jq -c '.[] | map(select(.desired_cuda=="cu124"))') + RELEASE_MATRIX_BLOB=$(echo {\"include\":"${RELEASE_MATRIX_INCLUDE}"}) echo "${RELEASE_MATRIX_BLOB}" echo "matrix=${RELEASE_MATRIX_BLOB}" >> "${GITHUB_OUTPUT}" From a35e60f9a506862fef9e152bd8c8cb91a08d2571 Mon Sep 17 00:00:00 2001 From: lanluo-nvidia Date: Fri, 5 Jul 2024 01:43:54 -0700 Subject: [PATCH 09/32] test --- .github/workflows/release-linux.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/release-linux.yml b/.github/workflows/release-linux.yml index f438275b7b..f0259f7a11 100644 --- a/.github/workflows/release-linux.yml +++ b/.github/workflows/release-linux.yml @@ -108,7 +108,7 @@ jobs: MATRIX_BLOB=${{ needs.generate-matrix.outputs.matrix }} echo "${MATRIX_BLOB}" RELEASE_MATRIX_INCLUDE=$(echo ${MATRIX_BLOB} | jq -c '.[] | map(select(.desired_cuda=="cu124"))') - RELEASE_MATRIX_BLOB=$(echo {\"include\":"${RELEASE_MATRIX_INCLUDE}"}) + RELEASE_MATRIX_BLOB=$(jq -c -n '{"include": $RELEASE_MATRIX_INCLUDE}' --argjson RELEASE_MATRIX_INCLUDE "$RELEASE_MATRIX_INCLUDE") echo "${RELEASE_MATRIX_BLOB}" echo "matrix=${RELEASE_MATRIX_BLOB}" >> "${GITHUB_OUTPUT}" From 466801b6a6c1093c984095ae4a0517a4f78f78a9 Mon Sep 17 00:00:00 2001 From: lanluo-nvidia Date: Fri, 5 Jul 2024 10:28:49 -0700 Subject: [PATCH 10/32] test --- .github/workflows/docker_builder.yml | 69 +----------------------- .github/workflows/release-linux.yml | 79 +++++++++++++++------------- 2 files changed, 42 insertions(+), 106 deletions(-) diff --git a/.github/workflows/docker_builder.yml b/.github/workflows/docker_builder.yml index 82f9f02cdb..fa6d39fbfb 100644 --- a/.github/workflows/docker_builder.yml +++ b/.github/workflows/docker_builder.yml @@ -2,7 +2,7 @@ name: 'Torch-TensorRT Docker Build' # Apply workflow only to main, nightly, release branches on: - pull_request: + #pull_request: push: branches: - main @@ -76,7 +76,6 @@ jobs: delete-only-untagged-versions: True build-cxx11: - if: ${{ contains(github.event.pull_request.labels.*.name, 'build-release-artifacts') || startsWith(github.event.ref, 'refs/tags/v') }} runs-on: linux.4xlarge.nvidia.gpu outputs: docker_url: ${{ env.DOCKER_REGISTRY }}/${{ steps.fix_slashes.outputs.container_name }} @@ -129,69 +128,3 @@ jobs: package-type: container min-versions-to-keep: 0 delete-only-untagged-versions: True - - release-cxx11-tar-ball: - needs: [build-cxx11] - env: - PYTHON_VERSION: 3.10 - CU_VERSION: cu124 - runs-on: linux.4xlarge.nvidia.gpu - container: - image: ${{ needs.build-cxx11.outputs.docker_url }} - options: '--gpus all' - timeout-minutes: 120 - if: ${{ contains(github.event.pull_request.labels.*.name, 'build-release-artifacts') || startsWith(github.event.ref, 'refs/tags/v') }} - steps: - - name: Build CXX11-ABI Tarball - shell: bash -l {0} - run: | - set -euxo pipefail - cd /opt/torch_tensorrt - bazel build //:libtorchtrt --compilation_mode opt --config=default - mkdir release - # example: 2.4.0.dev20240610+cu124, we don't want the +cu124 part, so remove +cu124 - PYTORCH_VERSION=$(python -c "import torch; print(torch.__version__)") - PYTORCH_VERSION=${PYTORCH_VERSION%+*} - TORCHTRT_VERSION=2.5.0 - cp bazel-bin/libtorchtrt.tar.gz \ - release/libtorchtrt-${TORCHTRT_VERSION}-tensorrt${TENSORRT_VERSION}-cuda${CU_VERSION}-libtorch${PYTORCH_VERSION}-x86_64-linux.tar.gz - - - name: Upload tarball to GitHub - continue-on-error: true - uses: actions/upload-artifact@v4 - with: - name: cxx11-tarball-${PYTHON_VERSION}-${CU_VERSION} - path: /opt/torch_tensorrt/release/ - - release-pre-cxx11-tar-ball: - needs: [build-pre-cxx11] - env: - PYTHON_VERSION: 3.10 - CU_VERSION: cu124 - runs-on: linux.4xlarge.nvidia.gpu - container: - image: ${{ needs.build-pre-cxx11.outputs.docker_url }} - options: '--gpus all' - timeout-minutes: 120 - if: ${{ contains(github.event.pull_request.labels.*.name, 'build-release-artifacts') || startsWith(github.event.ref, 'refs/tags/v') }} - steps: - - name: Build PRE-CXX11-ABI Tarball - shell: bash -l {0} - run: | - set -euxo pipefail - cd /opt/torch_tensorrt - bazel build //:libtorchtrt --compilation_mode opt --config=pre_cxx11_abi - mkdir release - # example: 2.4.0.dev20240610+cu124, we don't want the +cu124 part, so remove +cu124 - PYTORCH_VERSION=$(python -c "import torch; print(torch.__version__)") - PYTORCH_VERSION=${PYTORCH_VERSION%+*} - TORCHTRT_VERSION=2.5.0 - cp bazel-bin/libtorchtrt.tar.gz \ - release/libtorchtrt-${TORCHTRT_VERSION}-pre-cxx11-abi-tensorrt${TENSORRT_VERSION}-cuda${CU_VERSION}-libtorch${PYTORCH_VERSION}-x86_64-linux.tar.gz - - - name: Upload tarball to GitHub - continue-on-error: true - uses: actions/upload-artifact@v4 - with: - name: pre-cxx11-tarball-${PYTHON_VERSION}-${CU_VERSION} - path: /opt/torch_tensorrt/release/ \ No newline at end of file diff --git a/.github/workflows/release-linux.yml b/.github/workflows/release-linux.yml index f0259f7a11..15d6eefc15 100644 --- a/.github/workflows/release-linux.yml +++ b/.github/workflows/release-linux.yml @@ -49,40 +49,40 @@ jobs: name: cxx11-tarball-${PYTHON_VERSION}-${CU_VERSION} path: /opt/torch_tensorrt/release/ - release-pre-cxx11-tar-ball: - env: - PYTHON_VERSION: 3.10 - CU_VERSION: cu124 - name: release_pre_cxx11_tar_ball - runs-on: linux.4xlarge.nvidia.gpu - container: - # TODO: this should be changed to ghcr.io/pytorch/tensorrt/torch_tensorrt:release_2.4 - # once the PR is committed to release/2.4 branch - image: 'ghcr.io/pytorch/tensorrt/torch_tensorrt:2987_merge' - options: '--gpus all' - timeout-minutes: 120 - steps: - - name: Build PRE-CXX11-ABI Tarball - shell: bash -l {0} - run: | - set -euxo pipefail - cd /opt/torch_tensorrt - bazel build //:libtorchtrt --compilation_mode opt --config=pre_cxx11_abi - mkdir release - # example: 2.4.0.dev20240610+cu124, we don't want the +cu124 part, so remove +cu124 - PYTORCH_VERSION=$(python -c "import torch; print(torch.__version__)") - PYTORCH_VERSION=${PYTORCH_VERSION%+*} - TORCHTRT_VERSION=2.4.0 - cp bazel-bin/libtorchtrt.tar.gz \ - release/libtorchtrt-${TORCHTRT_VERSION}-pre-cxx11-abi-tensorrt${TENSORRT_VERSION}-cuda${CU_VERSION}-libtorch${PYTORCH_VERSION}-x86_64-linux.tar.gz + # release-pre-cxx11-tar-ball: + # env: + # PYTHON_VERSION: 3.10 + # CU_VERSION: cu124 + # name: release_pre_cxx11_tar_ball + # runs-on: linux.4xlarge.nvidia.gpu + # container: + # # TODO: this should be changed to ghcr.io/pytorch/tensorrt/torch_tensorrt:release_2.4 + # # once the PR is committed to release/2.4 branch + # image: 'ghcr.io/pytorch/tensorrt/torch_tensorrt:2987_merge' + # options: '--gpus all' + # timeout-minutes: 120 + # steps: + # - name: Build PRE-CXX11-ABI Tarball + # shell: bash -l {0} + # run: | + # set -euxo pipefail + # cd /opt/torch_tensorrt + # bazel build //:libtorchtrt --compilation_mode opt --config=pre_cxx11_abi + # mkdir release + # # example: 2.4.0.dev20240610+cu124, we don't want the +cu124 part, so remove +cu124 + # PYTORCH_VERSION=$(python -c "import torch; print(torch.__version__)") + # PYTORCH_VERSION=${PYTORCH_VERSION%+*} + # TORCHTRT_VERSION=2.4.0 + # cp bazel-bin/libtorchtrt.tar.gz \ + # release/libtorchtrt-${TORCHTRT_VERSION}-pre-cxx11-abi-tensorrt${TENSORRT_VERSION}-cuda${CU_VERSION}-libtorch${PYTORCH_VERSION}-x86_64-linux.tar.gz - # NB: Only upload to GitHub after passing smoke tests - - name: Upload tarball to GitHub - continue-on-error: true - uses: actions/upload-artifact@v4 - with: - name: pre-cxx11-tarball-${PYTHON_VERSION}-${CU_VERSION} - path: /opt/torch_tensorrt/release/ + # # NB: Only upload to GitHub after passing smoke tests + # - name: Upload tarball to GitHub + # continue-on-error: true + # uses: actions/upload-artifact@v4 + # with: + # name: pre-cxx11-tarball-${PYTHON_VERSION}-${CU_VERSION} + # path: /opt/torch_tensorrt/release/ generate-matrix: uses: pytorch/test-infra/.github/workflows/generate_binary_build_matrix.yml@main @@ -97,20 +97,23 @@ jobs: generate-release-matrix: needs: [generate-matrix] outputs: - matrix: ${{ steps.generate.outputs.matrix }} + release_matrix: ${{ steps.generate.outputs.release_matrix }} runs-on: ubuntu-latest + strategy: + fail-fast: false + matrix: ${{ fromJSON(needs.generate-matrix.outputs.matrix) }} steps: - name: Generate release matrix id: generate run: | set -x sudo apt-get update && sudo apt-get install -y jq - MATRIX_BLOB=${{ needs.generate-matrix.outputs.matrix }} - echo "${MATRIX_BLOB}" - RELEASE_MATRIX_INCLUDE=$(echo ${MATRIX_BLOB} | jq -c '.[] | map(select(.desired_cuda=="cu124"))') + echo "${matrix}" + + RELEASE_MATRIX_INCLUDE=$(echo ${matrix} | jq -c '.[] | map(select(.desired_cuda=="cu124"))') RELEASE_MATRIX_BLOB=$(jq -c -n '{"include": $RELEASE_MATRIX_INCLUDE}' --argjson RELEASE_MATRIX_INCLUDE "$RELEASE_MATRIX_INCLUDE") echo "${RELEASE_MATRIX_BLOB}" - echo "matrix=${RELEASE_MATRIX_BLOB}" >> "${GITHUB_OUTPUT}" + echo "release_matrix=${RELEASE_MATRIX_BLOB}" >> "${GITHUB_OUTPUT}" build-wheel-artifacts: name: Build torch-tensorrt release wheel artifacts From 40ec899d67a2a5000828d476c6c8c8735c96f10a Mon Sep 17 00:00:00 2001 From: lanluo-nvidia Date: Fri, 5 Jul 2024 10:38:06 -0700 Subject: [PATCH 11/32] test --- .github/workflows/release-linux.yml | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/.github/workflows/release-linux.yml b/.github/workflows/release-linux.yml index 15d6eefc15..4639b24f37 100644 --- a/.github/workflows/release-linux.yml +++ b/.github/workflows/release-linux.yml @@ -99,15 +99,13 @@ jobs: outputs: release_matrix: ${{ steps.generate.outputs.release_matrix }} runs-on: ubuntu-latest - strategy: - fail-fast: false - matrix: ${{ fromJSON(needs.generate-matrix.outputs.matrix) }} steps: - name: Generate release matrix id: generate run: | set -x sudo apt-get update && sudo apt-get install -y jq + matrix=${{ fromJSON(needs.generate-matrix.outputs.matrix) }} echo "${matrix}" RELEASE_MATRIX_INCLUDE=$(echo ${matrix} | jq -c '.[] | map(select(.desired_cuda=="cu124"))') From e8cd39e10c5764efd40ddf9c3cf5d05b82cbfc2d Mon Sep 17 00:00:00 2001 From: lanluo-nvidia Date: Fri, 5 Jul 2024 10:46:38 -0700 Subject: [PATCH 12/32] test --- .github/workflows/release-linux.yml | 37 +++++++++++++++-------------- 1 file changed, 19 insertions(+), 18 deletions(-) diff --git a/.github/workflows/release-linux.yml b/.github/workflows/release-linux.yml index 4639b24f37..2b194b3c41 100644 --- a/.github/workflows/release-linux.yml +++ b/.github/workflows/release-linux.yml @@ -94,31 +94,32 @@ jobs: with-rocm: false with-cpu: false - generate-release-matrix: - needs: [generate-matrix] - outputs: - release_matrix: ${{ steps.generate.outputs.release_matrix }} - runs-on: ubuntu-latest - steps: - - name: Generate release matrix - id: generate - run: | - set -x - sudo apt-get update && sudo apt-get install -y jq - matrix=${{ fromJSON(needs.generate-matrix.outputs.matrix) }} - echo "${matrix}" + # generate-release-matrix: + # needs: [generate-matrix] + # outputs: + # release_matrix: ${{ steps.generate.outputs.release_matrix }} + # runs-on: ubuntu-latest + # steps: + # - name: Generate release matrix + # id: generate + # run: | + # set -x + # sudo apt-get update && sudo apt-get install -y jq + # matrix=${{ toJSON(needs.generate-matrix.outputs.matrix) }} + # echo "${matrix}" - RELEASE_MATRIX_INCLUDE=$(echo ${matrix} | jq -c '.[] | map(select(.desired_cuda=="cu124"))') - RELEASE_MATRIX_BLOB=$(jq -c -n '{"include": $RELEASE_MATRIX_INCLUDE}' --argjson RELEASE_MATRIX_INCLUDE "$RELEASE_MATRIX_INCLUDE") - echo "${RELEASE_MATRIX_BLOB}" - echo "release_matrix=${RELEASE_MATRIX_BLOB}" >> "${GITHUB_OUTPUT}" + # RELEASE_MATRIX_INCLUDE=$(echo ${matrix} | jq -c '.[] | map(select(.desired_cuda=="cu124"))') + # RELEASE_MATRIX_BLOB=$(jq -c -n '{"include": $RELEASE_MATRIX_INCLUDE}' --argjson RELEASE_MATRIX_INCLUDE "$RELEASE_MATRIX_INCLUDE") + # echo "${RELEASE_MATRIX_BLOB}" + # echo "release_matrix=${RELEASE_MATRIX_BLOB}" >> "${GITHUB_OUTPUT}" build-wheel-artifacts: name: Build torch-tensorrt release wheel artifacts - needs: [generate-release-matrix] + needs: [generate-matrix] strategy: fail-fast: false matrix: + desired_cuda: ["cu124"] include: - repository: pytorch/tensorrt package-name: torch_tensorrt From 6c67eae4d96b5c090a4ad13731b3bc7e6074bd76 Mon Sep 17 00:00:00 2001 From: lanluo-nvidia Date: Fri, 5 Jul 2024 11:06:36 -0700 Subject: [PATCH 13/32] test --- .github/workflows/release-linux.yml | 72 +++-------------------- .github/workflows/release-wheel-linux.yml | 14 ++++- 2 files changed, 20 insertions(+), 66 deletions(-) diff --git a/.github/workflows/release-linux.yml b/.github/workflows/release-linux.yml index 2b194b3c41..59b83f9cea 100644 --- a/.github/workflows/release-linux.yml +++ b/.github/workflows/release-linux.yml @@ -14,74 +14,39 @@ permissions: packages: write jobs: - release-cxx11-tar-ball: - env: - PYTHON_VERSION: 3.10 - CU_VERSION: cu124 - name: release_cxx11_tar_ball - runs-on: linux.4xlarge.nvidia.gpu - container: - # TODO: this should be changed to ghcr.io/pytorch/tensorrt/torch_tensorrt_cxx11:release_2.4 - # once the PR is committed to release/2.4 branch - image: 'ghcr.io/pytorch/tensorrt/torch_tensorrt_cxx11:2987_merge' - options: '--gpus all' - timeout-minutes: 120 - steps: - - name: Build CXX11-ABI Tarball - shell: bash -l {0} - run: | - set -euxo pipefail - cd /opt/torch_tensorrt - bazel build //:libtorchtrt --compilation_mode opt --config=default - mkdir release - # example: 2.4.0.dev20240610+cu124, we don't want the +cu124 part, so remove +cu124 - PYTORCH_VERSION=$(python -c "import torch; print(torch.__version__)") - PYTORCH_VERSION=${PYTORCH_VERSION%+*} - TORCHTRT_VERSION=2.4.0 - cp bazel-bin/libtorchtrt.tar.gz \ - release/libtorchtrt-${TORCHTRT_VERSION}-tensorrt${TENSORRT_VERSION}-cuda${CU_VERSION}-libtorch${PYTORCH_VERSION}-x86_64-linux.tar.gz - - # NB: Only upload to GitHub after passing smoke tests - - name: Upload tarball to GitHub - continue-on-error: true - uses: actions/upload-artifact@v4 - with: - name: cxx11-tarball-${PYTHON_VERSION}-${CU_VERSION} - path: /opt/torch_tensorrt/release/ - - # release-pre-cxx11-tar-ball: + # release-cxx11-tar-ball: # env: # PYTHON_VERSION: 3.10 # CU_VERSION: cu124 - # name: release_pre_cxx11_tar_ball + # name: release_cxx11_tar_ball # runs-on: linux.4xlarge.nvidia.gpu # container: - # # TODO: this should be changed to ghcr.io/pytorch/tensorrt/torch_tensorrt:release_2.4 + # # TODO: this should be changed to ghcr.io/pytorch/tensorrt/torch_tensorrt_cxx11:release_2.4 # # once the PR is committed to release/2.4 branch - # image: 'ghcr.io/pytorch/tensorrt/torch_tensorrt:2987_merge' + # image: 'ghcr.io/pytorch/tensorrt/torch_tensorrt_cxx11:2987_merge' # options: '--gpus all' # timeout-minutes: 120 # steps: - # - name: Build PRE-CXX11-ABI Tarball + # - name: Build CXX11-ABI Tarball # shell: bash -l {0} # run: | # set -euxo pipefail # cd /opt/torch_tensorrt - # bazel build //:libtorchtrt --compilation_mode opt --config=pre_cxx11_abi + # bazel build //:libtorchtrt --compilation_mode opt --config=default # mkdir release # # example: 2.4.0.dev20240610+cu124, we don't want the +cu124 part, so remove +cu124 # PYTORCH_VERSION=$(python -c "import torch; print(torch.__version__)") # PYTORCH_VERSION=${PYTORCH_VERSION%+*} # TORCHTRT_VERSION=2.4.0 # cp bazel-bin/libtorchtrt.tar.gz \ - # release/libtorchtrt-${TORCHTRT_VERSION}-pre-cxx11-abi-tensorrt${TENSORRT_VERSION}-cuda${CU_VERSION}-libtorch${PYTORCH_VERSION}-x86_64-linux.tar.gz + # release/libtorchtrt-${TORCHTRT_VERSION}-tensorrt${TENSORRT_VERSION}-cuda${CU_VERSION}-libtorch${PYTORCH_VERSION}-x86_64-linux.tar.gz # # NB: Only upload to GitHub after passing smoke tests # - name: Upload tarball to GitHub # continue-on-error: true - # uses: actions/upload-artifact@v4 + # uses: actions/upload-artifact@v3 # with: - # name: pre-cxx11-tarball-${PYTHON_VERSION}-${CU_VERSION} + # name: cxx11-tarball-${PYTHON_VERSION}-${CU_VERSION} # path: /opt/torch_tensorrt/release/ generate-matrix: @@ -94,25 +59,6 @@ jobs: with-rocm: false with-cpu: false - # generate-release-matrix: - # needs: [generate-matrix] - # outputs: - # release_matrix: ${{ steps.generate.outputs.release_matrix }} - # runs-on: ubuntu-latest - # steps: - # - name: Generate release matrix - # id: generate - # run: | - # set -x - # sudo apt-get update && sudo apt-get install -y jq - # matrix=${{ toJSON(needs.generate-matrix.outputs.matrix) }} - # echo "${matrix}" - - # RELEASE_MATRIX_INCLUDE=$(echo ${matrix} | jq -c '.[] | map(select(.desired_cuda=="cu124"))') - # RELEASE_MATRIX_BLOB=$(jq -c -n '{"include": $RELEASE_MATRIX_INCLUDE}' --argjson RELEASE_MATRIX_INCLUDE "$RELEASE_MATRIX_INCLUDE") - # echo "${RELEASE_MATRIX_BLOB}" - # echo "release_matrix=${RELEASE_MATRIX_BLOB}" >> "${GITHUB_OUTPUT}" - build-wheel-artifacts: name: Build torch-tensorrt release wheel artifacts needs: [generate-matrix] diff --git a/.github/workflows/release-wheel-linux.yml b/.github/workflows/release-wheel-linux.yml index 28b3b5d0ba..3e2f1c6098 100644 --- a/.github/workflows/release-wheel-linux.yml +++ b/.github/workflows/release-wheel-linux.yml @@ -183,14 +183,16 @@ jobs: working-directory: ${{ inputs.repository }} shell: bash -l {0} run: | - # set -euxo pipefail - set -x + set -euxo pipefail source "${BUILD_ENV_FILE}" # BUILD_VERSION example: 2.4.0.dev20240610+cu121, we don't want the +cu121 part, so remove +cu121 BUILD_VERSION=${BUILD_VERSION%+*} ${CONDA_RUN} python setup.py bdist_wheel --release TRT_VERSION=10.0.1 + mkdir tarball + cp bazel-bin/libtorchtrt.tar.gz \ + tarball/libtorchtrt-${BUILD_VERSION}-pre-cxx11-abi-tensorrt${TRT_VERSION}-cuda${CU_VERSION}-libtorch${BUILD_VERSION}-x86_64-linux.tar.gz ${CONDA_RUN} python -m pip install auditwheel ${CONDA_RUN} python -m auditwheel repair \ @@ -244,7 +246,13 @@ jobs: with: name: ${{ env.ARTIFACT_NAME }} path: ${{ inputs.repository }}/dist/ - + - name: Upload pre-cxx11 tarball to GitHub + if: ${{ env.PYTHON_VERSION == "3.10" && env.CU_VERSION == "cu124" }} + continue-on-error: true + uses: actions/upload-artifact@v3 + with: + name: pre-cxx11-tarball-${PYTHON_VERSION}-${CU_VERSION} + path: ${{ inputs.repository }}/tarball/ concurrency: group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref_name }}-${{ inputs.repository }}-${{ github.event_name == 'workflow_dispatch' }}-${{ inputs.job-name }} From e793bd66b874193bff87ff76f272e26afe093d48 Mon Sep 17 00:00:00 2001 From: lanluo-nvidia Date: Fri, 5 Jul 2024 11:13:54 -0700 Subject: [PATCH 14/32] test --- .github/workflows/release-wheel-linux.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/release-wheel-linux.yml b/.github/workflows/release-wheel-linux.yml index 3e2f1c6098..04368c011a 100644 --- a/.github/workflows/release-wheel-linux.yml +++ b/.github/workflows/release-wheel-linux.yml @@ -247,7 +247,7 @@ jobs: name: ${{ env.ARTIFACT_NAME }} path: ${{ inputs.repository }}/dist/ - name: Upload pre-cxx11 tarball to GitHub - if: ${{ env.PYTHON_VERSION == "3.10" && env.CU_VERSION == "cu124" }} + if: ${{ env.PYTHON_VERSION == '3.10' && env.CU_VERSION == 'cu124' }} continue-on-error: true uses: actions/upload-artifact@v3 with: From 5575b3407dbc5e610054444c9aeca90935b77642 Mon Sep 17 00:00:00 2001 From: lanluo-nvidia Date: Fri, 5 Jul 2024 11:15:48 -0700 Subject: [PATCH 15/32] test --- .github/workflows/release-linux.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/release-linux.yml b/.github/workflows/release-linux.yml index 59b83f9cea..d85b7319fe 100644 --- a/.github/workflows/release-linux.yml +++ b/.github/workflows/release-linux.yml @@ -65,7 +65,6 @@ jobs: strategy: fail-fast: false matrix: - desired_cuda: ["cu124"] include: - repository: pytorch/tensorrt package-name: torch_tensorrt From 887e6b864c43db991df4f817d11771a1c18f588a Mon Sep 17 00:00:00 2001 From: lanluo-nvidia Date: Fri, 5 Jul 2024 11:44:28 -0700 Subject: [PATCH 16/32] test --- .github/workflows/docker_builder.yml | 2 +- .github/workflows/release-linux.yml | 20 ++++++++++++++++---- 2 files changed, 17 insertions(+), 5 deletions(-) diff --git a/.github/workflows/docker_builder.yml b/.github/workflows/docker_builder.yml index fa6d39fbfb..0cf49d4c95 100644 --- a/.github/workflows/docker_builder.yml +++ b/.github/workflows/docker_builder.yml @@ -2,7 +2,7 @@ name: 'Torch-TensorRT Docker Build' # Apply workflow only to main, nightly, release branches on: - #pull_request: + pull_request: push: branches: - main diff --git a/.github/workflows/release-linux.yml b/.github/workflows/release-linux.yml index d85b7319fe..652c4b0d1f 100644 --- a/.github/workflows/release-linux.yml +++ b/.github/workflows/release-linux.yml @@ -14,11 +14,11 @@ permissions: packages: write jobs: - # release-cxx11-tar-ball: + # release-cxx11-tarball-artifacts: # env: # PYTHON_VERSION: 3.10 # CU_VERSION: cu124 - # name: release_cxx11_tar_ball + # name: Release torch-tensorrt cxx11 tarball artifacts # runs-on: linux.4xlarge.nvidia.gpu # container: # # TODO: this should be changed to ghcr.io/pytorch/tensorrt/torch_tensorrt_cxx11:release_2.4 @@ -59,8 +59,8 @@ jobs: with-rocm: false with-cpu: false - build-wheel-artifacts: - name: Build torch-tensorrt release wheel artifacts + release-other-artifacts: + name: Release torch-tensorrt wheel and pre-cxx11 tarball artifacts needs: [generate-matrix] strategy: fail-fast: false @@ -73,6 +73,18 @@ jobs: post-script: packaging/post_build_script.sh smoke-test-script: packaging/smoke_test_script.sh uses: ./.github/workflows/release-wheel-linux.yml + with: + repository: ${{ matrix.repository }} + ref: "" + test-infra-repository: pytorch/test-infra + test-infra-ref: main + build-matrix: ${{ needs.generate-matrix.outputs.matrix }} + pre-script: ${{ matrix.pre-script }} + env-var-script: ${{ matrix.env-var-script }} + post-script: ${{ matrix.post-script }} + package-name: ${{ matrix.package-name }} + smoke-test-script: ${{ matrix.smoke-test-script }} + trigger-event: ${{ github.event_name }} concurrency: group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref_name }}-${{ inputs.repository }}-${{ github.event_name == 'workflow_dispatch' }}-${{ inputs.job-name }} From 46e38dcac7ea48084f8f7aeb93c139149812fca6 Mon Sep 17 00:00:00 2001 From: lanluo-nvidia Date: Fri, 5 Jul 2024 12:32:11 -0700 Subject: [PATCH 17/32] test --- .github/workflows/docker_builder.yml | 1 - .github/workflows/release-wheel-linux.yml | 15 +++++++++------ 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/.github/workflows/docker_builder.yml b/.github/workflows/docker_builder.yml index 0cf49d4c95..3bc972a86f 100644 --- a/.github/workflows/docker_builder.yml +++ b/.github/workflows/docker_builder.yml @@ -2,7 +2,6 @@ name: 'Torch-TensorRT Docker Build' # Apply workflow only to main, nightly, release branches on: - pull_request: push: branches: - main diff --git a/.github/workflows/release-wheel-linux.yml b/.github/workflows/release-wheel-linux.yml index 04368c011a..b4c626a248 100644 --- a/.github/workflows/release-wheel-linux.yml +++ b/.github/workflows/release-wheel-linux.yml @@ -96,6 +96,7 @@ jobs: # If a build is taking longer than 120 minutes on these runners we need # to have a conversation timeout-minutes: 120 + if: ${{ env.CU_VERSION == 'cu124' }} steps: - name: Clean workspace shell: bash -l {0} @@ -190,9 +191,11 @@ jobs: BUILD_VERSION=${BUILD_VERSION%+*} ${CONDA_RUN} python setup.py bdist_wheel --release TRT_VERSION=10.0.1 - mkdir tarball + mkdir release + mkdir release/tarball + mkdir release/wheel cp bazel-bin/libtorchtrt.tar.gz \ - tarball/libtorchtrt-${BUILD_VERSION}-pre-cxx11-abi-tensorrt${TRT_VERSION}-cuda${CU_VERSION}-libtorch${BUILD_VERSION}-x86_64-linux.tar.gz + release/tarball/libtorchtrt-${BUILD_VERSION}-pre-cxx11-abi-tensorrt${TRT_VERSION}-cuda${CU_VERSION}-libtorch${BUILD_VERSION}-x86_64-linux.tar.gz ${CONDA_RUN} python -m pip install auditwheel ${CONDA_RUN} python -m auditwheel repair \ @@ -200,7 +203,7 @@ jobs: --plat manylinux_2_34_x86_64 \ dist/torch_tensorrt-*-linux_x86_64.whl ${CONDA_RUN} python -m zipfile --list wheelhouse/torch_tensorrt-*_x86_64.whl - cp wheelhouse/torch_tensorrt-*_x86_64.whl dist/ + cp wheelhouse/torch_tensorrt-*_x86_64.whl release/wheel/ - name: Run Post-Script if: ${{ inputs.post-script != '' }} uses: ./test-infra/.github/actions/run-script-with-cache @@ -215,7 +218,7 @@ jobs: run: | set -euxo pipefail source "${BUILD_ENV_FILE}" - WHEEL_NAME=$(ls "${{ inputs.repository }}/dist/" | grep .whl) + WHEEL_NAME=$(ls "${{ inputs.repository }}/release/wheel/" | grep .whl) echo "$WHEEL_NAME" ${CONDA_RUN} pip install "${{ inputs.repository }}/dist/$WHEEL_NAME" # Checking that we have a pinned version of torch in our dependency tree @@ -245,14 +248,14 @@ jobs: uses: actions/upload-artifact@v3 with: name: ${{ env.ARTIFACT_NAME }} - path: ${{ inputs.repository }}/dist/ + path: ${{ inputs.repository }}/release/wheel/ - name: Upload pre-cxx11 tarball to GitHub if: ${{ env.PYTHON_VERSION == '3.10' && env.CU_VERSION == 'cu124' }} continue-on-error: true uses: actions/upload-artifact@v3 with: name: pre-cxx11-tarball-${PYTHON_VERSION}-${CU_VERSION} - path: ${{ inputs.repository }}/tarball/ + path: ${{ inputs.repository }}/release/tarball/ concurrency: group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref_name }}-${{ inputs.repository }}-${{ github.event_name == 'workflow_dispatch' }}-${{ inputs.job-name }} From c89b863d459b24c50adc098b2045bcc8884a7b8a Mon Sep 17 00:00:00 2001 From: lanluo-nvidia Date: Fri, 5 Jul 2024 13:17:29 -0700 Subject: [PATCH 18/32] test --- .github/scripts/generate-release-matrix.py | 35 ++++++++++++++++++++++ .github/workflows/release-linux.yml | 19 ++++++++++-- .github/workflows/release-wheel-linux.yml | 2 +- 3 files changed, 53 insertions(+), 3 deletions(-) create mode 100644 .github/scripts/generate-release-matrix.py diff --git a/.github/scripts/generate-release-matrix.py b/.github/scripts/generate-release-matrix.py new file mode 100644 index 0000000000..5cbeaddd12 --- /dev/null +++ b/.github/scripts/generate-release-matrix.py @@ -0,0 +1,35 @@ +#!/usr/bin/env python3 + +import argparse +import json +import sys + +RELEASE_CUDA_VERSION = ["cu124"] +RELEASE_PYTHON_VERSION = ["3.8", "3.9", "3.10", "3.11"] + + +def main(args: list[str]) -> None: + parser = argparse.ArgumentParser() + parser.add_argument( + "--matrix", + help="test matrix", + type=str, + default="", + ) + options = parser.parse_args(args) + matrix_dict = json.loads(options.matrix) + includes = matrix_dict["include"] + filtered_includes = [] + for item in includes: + if ( + item["desired_cuda"] in RELEASE_CUDA_VERSION + and item["python_version"] in RELEASE_PYTHON_VERSION + ): + filtered_includes.append(item) + filtered_matrix_dict = {} + filtered_matrix_dict["include"] = filtered_includes + print(json.dumps(filtered_matrix_dict)) + + +if __name__ == "__main__": + main(sys.argv[1:]) diff --git a/.github/workflows/release-linux.yml b/.github/workflows/release-linux.yml index 652c4b0d1f..8a025f6c0d 100644 --- a/.github/workflows/release-linux.yml +++ b/.github/workflows/release-linux.yml @@ -59,9 +59,24 @@ jobs: with-rocm: false with-cpu: false + generate-release-matrix: + needs: [generate-matrix] + outputs: + matrix: ${{ steps.generate.outputs.matrix }} + runs-on: ubuntu-latest + steps: + - name: Generate release matrix + id: generate + run: | + set -eou pipefail + MATRIX_BLOB=${{ toJSON(needs.generate-matrix.outputs.matrix) }} + MATRIX_BLOB="$(python3 .github/scripts/generate_release_matrix.py --matrix "${MATRIX_BLOB}")" + echo "${MATRIX_BLOB}" + echo "matrix=${MATRIX_BLOB}" >> "${GITHUB_OUTPUT}" + release-other-artifacts: name: Release torch-tensorrt wheel and pre-cxx11 tarball artifacts - needs: [generate-matrix] + needs: [generate-release-matrix] strategy: fail-fast: false matrix: @@ -78,7 +93,7 @@ jobs: ref: "" test-infra-repository: pytorch/test-infra test-infra-ref: main - build-matrix: ${{ needs.generate-matrix.outputs.matrix }} + build-matrix: ${{ needs.generate-release-matrix.outputs.matrix }} pre-script: ${{ matrix.pre-script }} env-var-script: ${{ matrix.env-var-script }} post-script: ${{ matrix.post-script }} diff --git a/.github/workflows/release-wheel-linux.yml b/.github/workflows/release-wheel-linux.yml index b4c626a248..4428680884 100644 --- a/.github/workflows/release-wheel-linux.yml +++ b/.github/workflows/release-wheel-linux.yml @@ -96,7 +96,7 @@ jobs: # If a build is taking longer than 120 minutes on these runners we need # to have a conversation timeout-minutes: 120 - if: ${{ env.CU_VERSION == 'cu124' }} + steps: - name: Clean workspace shell: bash -l {0} From fc1bde839ed028465b8e2a71c0f247095d3eec9b Mon Sep 17 00:00:00 2001 From: lanluo-nvidia Date: Fri, 5 Jul 2024 13:36:56 -0700 Subject: [PATCH 19/32] test --- .github/workflows/release-linux.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/release-linux.yml b/.github/workflows/release-linux.yml index 8a025f6c0d..f71dfc26bc 100644 --- a/.github/workflows/release-linux.yml +++ b/.github/workflows/release-linux.yml @@ -65,6 +65,9 @@ jobs: matrix: ${{ steps.generate.outputs.matrix }} runs-on: ubuntu-latest steps: + - uses: actions/checkout@v3 + with: + repository: pytorch/tensorrt - name: Generate release matrix id: generate run: | From 9a74f759fa91a858d9d96ac8ebc9f57f19dc3c82 Mon Sep 17 00:00:00 2001 From: lanluo-nvidia Date: Fri, 5 Jul 2024 13:44:00 -0700 Subject: [PATCH 20/32] test --- .github/workflows/release-linux.yml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/.github/workflows/release-linux.yml b/.github/workflows/release-linux.yml index f71dfc26bc..75b8c0876d 100644 --- a/.github/workflows/release-linux.yml +++ b/.github/workflows/release-linux.yml @@ -65,6 +65,9 @@ jobs: matrix: ${{ steps.generate.outputs.matrix }} runs-on: ubuntu-latest steps: + - uses: actions/setup-python@v4 + with: + python-version: '3.10' - uses: actions/checkout@v3 with: repository: pytorch/tensorrt @@ -72,6 +75,8 @@ jobs: id: generate run: | set -eou pipefail + pwd + ls -lart .github/scripts/ MATRIX_BLOB=${{ toJSON(needs.generate-matrix.outputs.matrix) }} MATRIX_BLOB="$(python3 .github/scripts/generate_release_matrix.py --matrix "${MATRIX_BLOB}")" echo "${MATRIX_BLOB}" From 9e07fbef287888318a8364fdf9bf4e9508d70fe0 Mon Sep 17 00:00:00 2001 From: lanluo-nvidia Date: Fri, 5 Jul 2024 13:54:10 -0700 Subject: [PATCH 21/32] test --- .github/workflows/build-test-windows.yml | 2 +- .github/workflows/release-linux.yml | 6 ++---- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/.github/workflows/build-test-windows.yml b/.github/workflows/build-test-windows.yml index d8c84c9afe..fb2d6f9dc2 100644 --- a/.github/workflows/build-test-windows.yml +++ b/.github/workflows/build-test-windows.yml @@ -1,7 +1,7 @@ name: Build and test Windows wheels on: - # pull_request: + #pull_request: push: branches: - main diff --git a/.github/workflows/release-linux.yml b/.github/workflows/release-linux.yml index 75b8c0876d..9757d7e0f2 100644 --- a/.github/workflows/release-linux.yml +++ b/.github/workflows/release-linux.yml @@ -1,4 +1,4 @@ -name: Release Linux wheels and tarball +name: Release Linux wheels and tarball artifacts on: pull_request: @@ -75,10 +75,8 @@ jobs: id: generate run: | set -eou pipefail - pwd - ls -lart .github/scripts/ MATRIX_BLOB=${{ toJSON(needs.generate-matrix.outputs.matrix) }} - MATRIX_BLOB="$(python3 .github/scripts/generate_release_matrix.py --matrix "${MATRIX_BLOB}")" + MATRIX_BLOB="$(python3 .github/scripts/generate-release-matrix.py --matrix "${MATRIX_BLOB}")" echo "${MATRIX_BLOB}" echo "matrix=${MATRIX_BLOB}" >> "${GITHUB_OUTPUT}" From f82f43e5e96353d0eb370a01ec2b21087fed1c01 Mon Sep 17 00:00:00 2001 From: lanluo-nvidia Date: Fri, 5 Jul 2024 14:28:01 -0700 Subject: [PATCH 22/32] test --- .github/workflows/release-linux.yml | 1 + packaging/pre_build_script_windows.sh | 6 +++++- setup.py | 1 + 3 files changed, 7 insertions(+), 1 deletion(-) diff --git a/.github/workflows/release-linux.yml b/.github/workflows/release-linux.yml index 9757d7e0f2..61ca313ec5 100644 --- a/.github/workflows/release-linux.yml +++ b/.github/workflows/release-linux.yml @@ -7,6 +7,7 @@ on: # NOTE: Binary build pipelines should only get triggered on release candidate builds # Release candidate tags look like: v1.11.0-rc1 - v[0-9]+.[0-9]+.[0-9]+-rc[0-9]+ + workflow_dispatch: permissions: id-token: write diff --git a/packaging/pre_build_script_windows.sh b/packaging/pre_build_script_windows.sh index 9724e18327..8e73c04b5b 100644 --- a/packaging/pre_build_script_windows.sh +++ b/packaging/pre_build_script_windows.sh @@ -1,4 +1,6 @@ -set -eou pipefail +#set -eou pipefail + +set -x pip install -U numpy packaging pyyaml setuptools wheel @@ -15,4 +17,6 @@ export CUDA_HOME="$(echo ${CUDA_PATH} | sed -e 's#\\#\/#g')" cat toolchains/ci_workspaces/WORKSPACE.win.release.tmpl | envsubst > WORKSPACE +echo ${BUILD_VERSION} +echo "BUILD_VERSION=2.4.0" >> ${GITHUB_ENV} echo "RELEASE=1" >> ${GITHUB_ENV} diff --git a/setup.py b/setup.py index c74fb9e130..9a24411ee6 100644 --- a/setup.py +++ b/setup.py @@ -124,6 +124,7 @@ def load_dep_info(): if RELEASE: __version__ = os.environ.get("BUILD_VERSION") + print(f"lan added __version__={__version__}") else: __version__ = f"{get_base_version()}.dev0+{get_git_revision_short_hash()}" From 74f344884dfc6211df708cf9afe12a9f50fe2a59 Mon Sep 17 00:00:00 2001 From: lanluo-nvidia Date: Fri, 5 Jul 2024 14:48:02 -0700 Subject: [PATCH 23/32] test --- .github/workflows/release-linux.yml | 66 ++++++++++---------- .github/workflows/release-wheel-linux.yml | 25 +------- .github/workflows/release-windows.yml | 74 +++++++++++++++++++++++ 3 files changed, 109 insertions(+), 56 deletions(-) create mode 100644 .github/workflows/release-windows.yml diff --git a/.github/workflows/release-linux.yml b/.github/workflows/release-linux.yml index 61ca313ec5..a66356d61e 100644 --- a/.github/workflows/release-linux.yml +++ b/.github/workflows/release-linux.yml @@ -15,40 +15,40 @@ permissions: packages: write jobs: - # release-cxx11-tarball-artifacts: - # env: - # PYTHON_VERSION: 3.10 - # CU_VERSION: cu124 - # name: Release torch-tensorrt cxx11 tarball artifacts - # runs-on: linux.4xlarge.nvidia.gpu - # container: - # # TODO: this should be changed to ghcr.io/pytorch/tensorrt/torch_tensorrt_cxx11:release_2.4 - # # once the PR is committed to release/2.4 branch - # image: 'ghcr.io/pytorch/tensorrt/torch_tensorrt_cxx11:2987_merge' - # options: '--gpus all' - # timeout-minutes: 120 - # steps: - # - name: Build CXX11-ABI Tarball - # shell: bash -l {0} - # run: | - # set -euxo pipefail - # cd /opt/torch_tensorrt - # bazel build //:libtorchtrt --compilation_mode opt --config=default - # mkdir release - # # example: 2.4.0.dev20240610+cu124, we don't want the +cu124 part, so remove +cu124 - # PYTORCH_VERSION=$(python -c "import torch; print(torch.__version__)") - # PYTORCH_VERSION=${PYTORCH_VERSION%+*} - # TORCHTRT_VERSION=2.4.0 - # cp bazel-bin/libtorchtrt.tar.gz \ - # release/libtorchtrt-${TORCHTRT_VERSION}-tensorrt${TENSORRT_VERSION}-cuda${CU_VERSION}-libtorch${PYTORCH_VERSION}-x86_64-linux.tar.gz + release-cxx11-tarball-artifacts: + env: + PYTHON_VERSION: 3.10 + CU_VERSION: cu124 + name: Release torch-tensorrt cxx11 tarball artifacts + runs-on: linux.4xlarge.nvidia.gpu + container: + # TODO: this should be changed to ghcr.io/pytorch/tensorrt/torch_tensorrt_cxx11:release_2.4 + # once the PR is committed to release/2.4 branch + image: 'ghcr.io/pytorch/tensorrt/torch_tensorrt_cxx11:2987_merge' + options: '--gpus all' + timeout-minutes: 120 + steps: + - name: Build CXX11-ABI Tarball + shell: bash -l {0} + run: | + set -euxo pipefail + cd /opt/torch_tensorrt + bazel build //:libtorchtrt --compilation_mode opt --config=default + mkdir release + # example: 2.4.0.dev20240610+cu124, we don't want the +cu124 part, so remove +cu124 + PYTORCH_VERSION=$(python -c "import torch; print(torch.__version__)") + PYTORCH_VERSION=${PYTORCH_VERSION%+*} + TORCHTRT_VERSION=2.4.0 + cp bazel-bin/libtorchtrt.tar.gz \ + release/libtorchtrt-${TORCHTRT_VERSION}-tensorrt${TENSORRT_VERSION}-cuda${CU_VERSION}-libtorch${PYTORCH_VERSION}-x86_64-linux.tar.gz - # # NB: Only upload to GitHub after passing smoke tests - # - name: Upload tarball to GitHub - # continue-on-error: true - # uses: actions/upload-artifact@v3 - # with: - # name: cxx11-tarball-${PYTHON_VERSION}-${CU_VERSION} - # path: /opt/torch_tensorrt/release/ + # NB: Only upload to GitHub after passing smoke tests + - name: Upload tarball to GitHub + continue-on-error: true + uses: actions/upload-artifact@v3 + with: + name: cxx11-tarball-${PYTHON_VERSION}-${CU_VERSION} + path: /opt/torch_tensorrt/release/ generate-matrix: uses: pytorch/test-infra/.github/workflows/generate_binary_build_matrix.yml@main diff --git a/.github/workflows/release-wheel-linux.yml b/.github/workflows/release-wheel-linux.yml index 4428680884..a755311e2f 100644 --- a/.github/workflows/release-wheel-linux.yml +++ b/.github/workflows/release-wheel-linux.yml @@ -219,29 +219,8 @@ jobs: set -euxo pipefail source "${BUILD_ENV_FILE}" WHEEL_NAME=$(ls "${{ inputs.repository }}/release/wheel/" | grep .whl) - echo "$WHEEL_NAME" - ${CONDA_RUN} pip install "${{ inputs.repository }}/dist/$WHEEL_NAME" - # Checking that we have a pinned version of torch in our dependency tree - ( - pushd "${RUNNER_TEMP}" - unzip -o "${GITHUB_WORKSPACE}/${{ inputs.repository }}/dist/$WHEEL_NAME" - # Ensure that pytorch version is pinned, should output file where it was found - grep "Requires-Dist: torch (==.*)" -r . - ) - if [[ (! -f "${{ inputs.repository }}"/${SMOKE_TEST_SCRIPT}) ]]; then - echo "${{ inputs.repository }}/${SMOKE_TEST_SCRIPT} not found" - if [[ "${PACKAGE_NAME}" = "torchrec" ]]; then - # Special case for torchrec temporarily since __version__ does not - # work correctly on main in torchrec. This block will be - # removed once we fix it. - ${CONDA_RUN} python -c "import ${PACKAGE_NAME}" - else - ${CONDA_RUN} python -c "import ${PACKAGE_NAME}; print('package version is ', ${PACKAGE_NAME}.__version__)" - fi - else - echo "${{ inputs.repository }}/${SMOKE_TEST_SCRIPT} found" - ${CONDA_RUN} python "${{ inputs.repository }}/${SMOKE_TEST_SCRIPT}" - fi + # TODO: add smoke test for the auditwheel built + # NB: Only upload to GitHub after passing smoke tests - name: Upload wheel to GitHub continue-on-error: true diff --git a/.github/workflows/release-windows.yml b/.github/workflows/release-windows.yml new file mode 100644 index 0000000000..1f9038ee56 --- /dev/null +++ b/.github/workflows/release-windows.yml @@ -0,0 +1,74 @@ +name: Release Windows wheels artifacts + +on: + pull_request: + push: + tags: + # NOTE: Binary build pipelines should only get triggered on release candidate builds + # Release candidate tags look like: v1.11.0-rc1 + - v[0-9]+.[0-9]+.[0-9]+-rc[0-9]+ + workflow_dispatch: + +permissions: + id-token: write + contents: read + packages: write + +jobs: + generate-matrix: + uses: pytorch/test-infra/.github/workflows/generate_binary_build_matrix.yml@main + with: + package-type: wheel + os: windows + test-infra-repository: pytorch/test-infra + test-infra-ref: main + with-rocm: false + with-cpu: false + + generate-release-matrix: + if: ${{ contains(github.event.pull_request.labels.*.name, 'build-release-artifacts') || startsWith(github.event.ref, 'refs/tags/v') }} + needs: [generate-matrix] + outputs: + matrix: ${{ steps.generate.outputs.matrix }} + runs-on: ubuntu-latest + steps: + - uses: actions/setup-python@v4 + with: + python-version: '3.10' + - uses: actions/checkout@v3 + with: + repository: pytorch/tensorrt + - name: Generate release matrix + id: generate + run: | + set -eou pipefail + MATRIX_BLOB=${{ toJSON(needs.generate-matrix.outputs.matrix) }} + MATRIX_BLOB="$(python3 .github/scripts/generate-release-matrix.py --matrix "${MATRIX_BLOB}")" + echo "${MATRIX_BLOB}" + echo "matrix=${MATRIX_BLOB}" >> "${GITHUB_OUTPUT}" + + release-wheel-artifacts: + needs: [generate-release-matrix] + name: Release torch-tensorrt wheel artifacts + strategy: + fail-fast: false + matrix: + include: + - repository: pytorch/tensorrt + pre-script: packaging/pre_build_script_windows.sh + env-script: packaging/vc_env_helper.bat + smoke-test-script: packaging/smoke_test_windows.py + wheel-build-params: "--release" + package-name: torch_tensorrt + uses: pytorch/test-infra/.github/workflows/build_wheels_windows.yml@main + with: + repository: ${{ matrix.repository }} + ref: "" + test-infra-repository: pytorch/test-infra + test-infra-ref: main + build-matrix: ${{ needs.substitute-runner.outputs.matrix }} + pre-script: ${{ matrix.pre-script }} + env-script: ${{ matrix.env-script }} + smoke-test-script: ${{ matrix.smoke-test-script }} + package-name: ${{ matrix.package-name }} + trigger-event: ${{ github.event_name }} From 8ffcc0936bdc5accf78eea7daa5432e922a3f6aa Mon Sep 17 00:00:00 2001 From: lanluo-nvidia Date: Fri, 5 Jul 2024 14:52:18 -0700 Subject: [PATCH 24/32] test --- .github/workflows/release-windows.yml | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/.github/workflows/release-windows.yml b/.github/workflows/release-windows.yml index 1f9038ee56..a32c6c6ed1 100644 --- a/.github/workflows/release-windows.yml +++ b/.github/workflows/release-windows.yml @@ -47,8 +47,19 @@ jobs: echo "${MATRIX_BLOB}" echo "matrix=${MATRIX_BLOB}" >> "${GITHUB_OUTPUT}" + substitute-runner: + needs: generate-release-matrix + outputs: + matrix: ${{ steps.substitute.outputs.matrix }} + runs-on: ubuntu-latest + steps: + - name: Substitute runner + id: substitute + run: | + echo matrix="$(echo '${{ needs.generate-release-matrix.outputs.matrix }}' | sed -e 's/windows.8xlarge.nvidia.gpu/windows.g5.4xlarge.nvidia.gpu/g')" >> ${GITHUB_OUTPUT} + release-wheel-artifacts: - needs: [generate-release-matrix] + needs: substitute-runner name: Release torch-tensorrt wheel artifacts strategy: fail-fast: false From 58491c0831eae70722a6ae90c9b25d8539bcfbb2 Mon Sep 17 00:00:00 2001 From: lanluo-nvidia Date: Fri, 5 Jul 2024 14:55:11 -0700 Subject: [PATCH 25/32] test --- .github/workflows/release-linux.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/release-linux.yml b/.github/workflows/release-linux.yml index a66356d61e..508bcb0de6 100644 --- a/.github/workflows/release-linux.yml +++ b/.github/workflows/release-linux.yml @@ -1,7 +1,6 @@ name: Release Linux wheels and tarball artifacts on: - pull_request: push: tags: # NOTE: Binary build pipelines should only get triggered on release candidate builds From 68db42934703067b8409fc423c9320cef482d056 Mon Sep 17 00:00:00 2001 From: lanluo-nvidia Date: Fri, 5 Jul 2024 15:56:55 -0700 Subject: [PATCH 26/32] test --- .github/workflows/release-linux.yml | 3 +- .github/workflows/release-wheel-linux.yml | 2 +- .github/workflows/release-wheel-windows.yml | 221 ++++++++++++++++++++ .github/workflows/release-windows.yml | 5 +- packaging/pre_build_script_windows.sh | 2 - 5 files changed, 226 insertions(+), 7 deletions(-) create mode 100644 .github/workflows/release-wheel-windows.yml diff --git a/.github/workflows/release-linux.yml b/.github/workflows/release-linux.yml index 508bcb0de6..11180a8d38 100644 --- a/.github/workflows/release-linux.yml +++ b/.github/workflows/release-linux.yml @@ -1,6 +1,7 @@ name: Release Linux wheels and tarball artifacts on: + pull_request: push: tags: # NOTE: Binary build pipelines should only get triggered on release candidate builds @@ -46,7 +47,7 @@ jobs: continue-on-error: true uses: actions/upload-artifact@v3 with: - name: cxx11-tarball-${PYTHON_VERSION}-${CU_VERSION} + name: cxx11-tarball-${{ env.PYTHON_VERSION }}-${{ env.CU_VERSION }} path: /opt/torch_tensorrt/release/ generate-matrix: diff --git a/.github/workflows/release-wheel-linux.yml b/.github/workflows/release-wheel-linux.yml index a755311e2f..67f9aa0c8a 100644 --- a/.github/workflows/release-wheel-linux.yml +++ b/.github/workflows/release-wheel-linux.yml @@ -233,7 +233,7 @@ jobs: continue-on-error: true uses: actions/upload-artifact@v3 with: - name: pre-cxx11-tarball-${PYTHON_VERSION}-${CU_VERSION} + name: pre-cxx11-tarball-${{ env.PYTHON_VERSION }}-${{ env.CU_VERSION }} path: ${{ inputs.repository }}/release/tarball/ concurrency: diff --git a/.github/workflows/release-wheel-windows.yml b/.github/workflows/release-wheel-windows.yml new file mode 100644 index 0000000000..fb8730aa9b --- /dev/null +++ b/.github/workflows/release-wheel-windows.yml @@ -0,0 +1,221 @@ +name: Build Release Wheel Artifacts on Windows + +on: + workflow_call: + inputs: + repository: + description: 'Repository to checkout, defaults to ""' + default: "" + type: string + ref: + description: 'Reference to checkout, defaults to "nightly"' + default: "nightly" + type: string + test-infra-repository: + description: "Test infra repository to use" + default: "pytorch/test-infra" + type: string + test-infra-ref: + description: "Test infra reference to use" + default: "" + type: string + build-matrix: + description: "Build matrix to utilize" + default: "" + type: string + pre-script: + description: "Pre script to run prior to build" + default: "" + type: string + env-script: + description: "Script to setup environment variables for the build" + default: "" + type: string + wheel-build-params: + description: "Additional parameters for bdist_wheel" + default: "" + type: string + post-script: + description: "Post script to run prior to build" + default: "" + type: string + smoke-test-script: + description: "Script for Smoke Test for a specific domain" + default: "" + type: string + package-name: + description: "Name of the actual python package that is imported" + default: "" + type: string + trigger-event: + description: "Trigger Event in caller that determines whether or not to upload" + default: "" + type: string + cache-path: + description: "The path(s) on the runner to cache or restore. The path is relative to repository." + default: "" + type: string + cache-key: + description: "The key created when saving a cache and the key used to search for a cache." + default: "" + type: string + submodules: + description: "Works as stated in actions/checkout, but the default value is recursive" + required: false + type: string + default: recursive + +permissions: + id-token: write + contents: read + +jobs: + build: + strategy: + fail-fast: false + matrix: ${{ fromJSON(inputs.build-matrix) }} + env: + PYTHON_VERSION: ${{ matrix.python_version }} + PACKAGE_TYPE: wheel + REPOSITORY: ${{ inputs.repository }} + REF: ${{ inputs.ref }} + CU_VERSION: ${{ matrix.desired_cuda }} + UPLOAD_TO_BASE_BUCKET: ${{ matrix.upload_to_base_bucket }} + name: ${{ matrix.build_name }} + runs-on: ${{ matrix.validation_runner }} + defaults: + run: + shell: bash -l {0} + # If a build is taking longer than 120 minutes on these runners we need + # to have a conversation + timeout-minutes: 120 + steps: + - uses: actions/checkout@v3 + with: + # Support the use case where we need to checkout someone's fork + repository: ${{ inputs.test-infra-repository }} + ref: ${{ inputs.test-infra-ref }} + path: test-infra + - uses: ./test-infra/.github/actions/setup-ssh + name: Setup SSH + with: + github-secret: ${{ secrets.GITHUB_TOKEN }} + activate-with-label: false + instructions: "SSH with rdesktop using ssh -L 3389:localhost:3389 %%username%%@%%hostname%%" + - name: Add Conda scripts to GitHub path + run: | + echo "C:/Jenkins/Miniconda3/Scripts" >> $GITHUB_PATH + - uses: ./test-infra/.github/actions/set-channel + - name: Set PYTORCH_VERSION + if: ${{ env.CHANNEL == 'test' }} + run: | + # When building RC, set the version to be the current candidate version, + # otherwise, leave it alone so nightly will pick up the latest + echo "PYTORCH_VERSION=${{ matrix.stable_version }}" >> "${GITHUB_ENV}" + - uses: ./test-infra/.github/actions/setup-binary-builds + with: + repository: ${{ inputs.repository }} + ref: ${{ inputs.ref }} + submodules: ${{ inputs.submodules }} + setup-miniconda: false + python-version: ${{ env.PYTHON_VERSION }} + cuda-version: ${{ env.CU_VERSION }} + arch: ${{ env.ARCH }} + - name: Install torch dependency + run: | + source "${BUILD_ENV_FILE}" + # shellcheck disable=SC2086 + ${CONDA_RUN} ${PIP_INSTALL_TORCH} + - name: Run Pre-Script with Caching + if: ${{ inputs.pre-script != '' }} + uses: ./test-infra/.github/actions/run-script-with-cache + with: + cache-path: ${{ inputs.cache-path }} + cache-key: ${{ inputs.cache-key }} + repository: ${{ inputs.repository }} + script: ${{ inputs.pre-script }} + is_windows: 'enabled' + - name: Build clean + working-directory: ${{ inputs.repository }} + run: | + source "${BUILD_ENV_FILE}" + ${CONDA_RUN} python setup.py clean + - name: Build the wheel (bdist_wheel) + working-directory: ${{ inputs.repository }} + env: + ENV_SCRIPT: ${{ inputs.env-script }} + BUILD_PARAMS: ${{ inputs.wheel-build-params }} + run: | + set -x + source "${BUILD_ENV_FILE}" + + if [[ "$CU_VERSION" == "cpu" ]]; then + # CUDA and CPU are ABI compatible on the CPU-only parts, so strip + # in this case + export PYTORCH_VERSION="$(${CONDA_RUN} pip show torch | grep ^Version: | sed 's/Version: *//' | sed 's/+.\+//')" + else + export PYTORCH_VERSION="$(${CONDA_RUN} pip show torch | grep ^Version: | sed 's/Version: *//')" + fi + + if [[ -z "${ENV_SCRIPT}" ]]; then + BUILD_VERSION=${PYTORCH_VERSION} ${CONDA_RUN} python setup.py bdist_wheel + else + if [[ ! -f ${ENV_SCRIPT} ]]; then + echo "::error::Specified env-script file (${ENV_SCRIPT}) not found" + exit 1 + else + ${CONDA_RUN} ${ENV_SCRIPT} BUILD_VERSION=${PYTORCH_VERSION} python setup.py bdist_wheel ${BUILD_PARAMS} + fi + fi + - name: Run post-script + working-directory: ${{ inputs.repository }} + env: + POST_SCRIPT: ${{ inputs.post-script }} + ENV_SCRIPT: ${{ inputs.env-script }} + if: ${{ inputs.post-script != '' }} + run: | + set -euxo pipefail + source "${BUILD_ENV_FILE}" + ${CONDA_RUN} ${ENV_SCRIPT} ${POST_SCRIPT} + - name: Smoke Test + env: + PACKAGE_NAME: ${{ inputs.package-name }} + SMOKE_TEST_SCRIPT: ${{ inputs.smoke-test-script }} + run: | + source "${BUILD_ENV_FILE}" + WHEEL_NAME=$(ls "${{ inputs.repository }}/dist/") + echo "$WHEEL_NAME" + ${CONDA_RUN} pip install "${{ inputs.repository }}/dist/$WHEEL_NAME" + if [[ ! -f "${{ inputs.repository }}"/${SMOKE_TEST_SCRIPT} ]]; then + echo "${{ inputs.repository }}/${SMOKE_TEST_SCRIPT} not found" + ${CONDA_RUN} python -c "import ${PACKAGE_NAME}; print('package version is ', ${PACKAGE_NAME}.__version__)" + else + echo "${{ inputs.repository }}/${SMOKE_TEST_SCRIPT} found" + ${CONDA_RUN} python "${{ inputs.repository }}/${SMOKE_TEST_SCRIPT}" + fi + # NB: Only upload to GitHub after passing smoke tests + - name: Upload wheel to GitHub + continue-on-error: true + uses: actions/upload-artifact@v3 + with: + name: ${{ env.ARTIFACT_NAME }} + path: ${{ inputs.repository }}/dist/ + - uses: ./test-infra/.github/actions/teardown-windows + if: always() + name: Teardown Windows + + upload: + needs: build + uses: ./.github/workflows/_binary_upload.yml + if: always() + with: + repository: ${{ inputs.repository }} + ref: ${{ inputs.ref }} + test-infra-repository: ${{ inputs.test-infra-repository }} + test-infra-ref: ${{ inputs.test-infra-ref }} + build-matrix: ${{ inputs.build-matrix }} + trigger-event: ${{ inputs.trigger-event }} + +concurrency: + group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref_name }}-${{ inputs.repository }}-${{ github.event_name == 'workflow_dispatch' }}-${{ inputs.job-name }} + cancel-in-progress: true diff --git a/.github/workflows/release-windows.yml b/.github/workflows/release-windows.yml index a32c6c6ed1..cd3cd6766a 100644 --- a/.github/workflows/release-windows.yml +++ b/.github/workflows/release-windows.yml @@ -69,9 +69,8 @@ jobs: pre-script: packaging/pre_build_script_windows.sh env-script: packaging/vc_env_helper.bat smoke-test-script: packaging/smoke_test_windows.py - wheel-build-params: "--release" package-name: torch_tensorrt - uses: pytorch/test-infra/.github/workflows/build_wheels_windows.yml@main + uses: ./.github/workflows/release-wheel-windows.yml with: repository: ${{ matrix.repository }} ref: "" @@ -82,4 +81,4 @@ jobs: env-script: ${{ matrix.env-script }} smoke-test-script: ${{ matrix.smoke-test-script }} package-name: ${{ matrix.package-name }} - trigger-event: ${{ github.event_name }} + wheel-build-params: "--release" diff --git a/packaging/pre_build_script_windows.sh b/packaging/pre_build_script_windows.sh index 8e73c04b5b..ebf11127d8 100644 --- a/packaging/pre_build_script_windows.sh +++ b/packaging/pre_build_script_windows.sh @@ -17,6 +17,4 @@ export CUDA_HOME="$(echo ${CUDA_PATH} | sed -e 's#\\#\/#g')" cat toolchains/ci_workspaces/WORKSPACE.win.release.tmpl | envsubst > WORKSPACE -echo ${BUILD_VERSION} -echo "BUILD_VERSION=2.4.0" >> ${GITHUB_ENV} echo "RELEASE=1" >> ${GITHUB_ENV} From 324ba3a8cca02de2f61e9f51d138fb6e7e87c98a Mon Sep 17 00:00:00 2001 From: lanluo-nvidia Date: Fri, 5 Jul 2024 16:00:32 -0700 Subject: [PATCH 27/32] test --- .github/workflows/release-wheel-windows.yml | 13 +------------ .github/workflows/release-windows.yml | 2 +- packaging/pre_build_script_windows.sh | 4 +--- 3 files changed, 3 insertions(+), 16 deletions(-) diff --git a/.github/workflows/release-wheel-windows.yml b/.github/workflows/release-wheel-windows.yml index fb8730aa9b..c96953da4c 100644 --- a/.github/workflows/release-wheel-windows.yml +++ b/.github/workflows/release-wheel-windows.yml @@ -70,7 +70,7 @@ permissions: contents: read jobs: - build: + build-release-wheel: strategy: fail-fast: false matrix: ${{ fromJSON(inputs.build-matrix) }} @@ -204,17 +204,6 @@ jobs: if: always() name: Teardown Windows - upload: - needs: build - uses: ./.github/workflows/_binary_upload.yml - if: always() - with: - repository: ${{ inputs.repository }} - ref: ${{ inputs.ref }} - test-infra-repository: ${{ inputs.test-infra-repository }} - test-infra-ref: ${{ inputs.test-infra-ref }} - build-matrix: ${{ inputs.build-matrix }} - trigger-event: ${{ inputs.trigger-event }} concurrency: group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref_name }}-${{ inputs.repository }}-${{ github.event_name == 'workflow_dispatch' }}-${{ inputs.job-name }} diff --git a/.github/workflows/release-windows.yml b/.github/workflows/release-windows.yml index cd3cd6766a..a65cc8179c 100644 --- a/.github/workflows/release-windows.yml +++ b/.github/workflows/release-windows.yml @@ -70,7 +70,7 @@ jobs: env-script: packaging/vc_env_helper.bat smoke-test-script: packaging/smoke_test_windows.py package-name: torch_tensorrt - uses: ./.github/workflows/release-wheel-windows.yml + uses: .github/workflows/release-wheel-windows.yml with: repository: ${{ matrix.repository }} ref: "" diff --git a/packaging/pre_build_script_windows.sh b/packaging/pre_build_script_windows.sh index ebf11127d8..9724e18327 100644 --- a/packaging/pre_build_script_windows.sh +++ b/packaging/pre_build_script_windows.sh @@ -1,6 +1,4 @@ -#set -eou pipefail - -set -x +set -eou pipefail pip install -U numpy packaging pyyaml setuptools wheel From 033e8e27b39a0d67d557059fcfc995d27ab87f0a Mon Sep 17 00:00:00 2001 From: lanluo-nvidia Date: Fri, 5 Jul 2024 19:51:27 -0700 Subject: [PATCH 28/32] test --- .github/workflows/release-linux.yml | 4 +++- .github/workflows/release-wheel-linux.yml | 6 ++++-- .github/workflows/release-windows.yml | 3 +-- 3 files changed, 8 insertions(+), 5 deletions(-) diff --git a/.github/workflows/release-linux.yml b/.github/workflows/release-linux.yml index 11180a8d38..92420aa62f 100644 --- a/.github/workflows/release-linux.yml +++ b/.github/workflows/release-linux.yml @@ -45,10 +45,12 @@ jobs: # NB: Only upload to GitHub after passing smoke tests - name: Upload tarball to GitHub continue-on-error: true - uses: actions/upload-artifact@v3 + uses: actions/upload-artifact@v4 with: name: cxx11-tarball-${{ env.PYTHON_VERSION }}-${{ env.CU_VERSION }} path: /opt/torch_tensorrt/release/ + # no compression, keep the .tar.gz, otherwise it will became a .zip + compression-level: 0 generate-matrix: uses: pytorch/test-infra/.github/workflows/generate_binary_build_matrix.yml@main diff --git a/.github/workflows/release-wheel-linux.yml b/.github/workflows/release-wheel-linux.yml index 67f9aa0c8a..9edea93ba0 100644 --- a/.github/workflows/release-wheel-linux.yml +++ b/.github/workflows/release-wheel-linux.yml @@ -224,17 +224,19 @@ jobs: # NB: Only upload to GitHub after passing smoke tests - name: Upload wheel to GitHub continue-on-error: true - uses: actions/upload-artifact@v3 + uses: actions/upload-artifact@v4 with: name: ${{ env.ARTIFACT_NAME }} path: ${{ inputs.repository }}/release/wheel/ - name: Upload pre-cxx11 tarball to GitHub if: ${{ env.PYTHON_VERSION == '3.10' && env.CU_VERSION == 'cu124' }} continue-on-error: true - uses: actions/upload-artifact@v3 + uses: actions/upload-artifact@v4 with: name: pre-cxx11-tarball-${{ env.PYTHON_VERSION }}-${{ env.CU_VERSION }} path: ${{ inputs.repository }}/release/tarball/ + # no compression, keep the .tar.gz, otherwise it will became a .zip + compression-level: 0 concurrency: group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref_name }}-${{ inputs.repository }}-${{ github.event_name == 'workflow_dispatch' }}-${{ inputs.job-name }} diff --git a/.github/workflows/release-windows.yml b/.github/workflows/release-windows.yml index a65cc8179c..3c56b02a75 100644 --- a/.github/workflows/release-windows.yml +++ b/.github/workflows/release-windows.yml @@ -70,7 +70,7 @@ jobs: env-script: packaging/vc_env_helper.bat smoke-test-script: packaging/smoke_test_windows.py package-name: torch_tensorrt - uses: .github/workflows/release-wheel-windows.yml + uses: ./.github/workflows/release-wheel-windows.yml with: repository: ${{ matrix.repository }} ref: "" @@ -81,4 +81,3 @@ jobs: env-script: ${{ matrix.env-script }} smoke-test-script: ${{ matrix.smoke-test-script }} package-name: ${{ matrix.package-name }} - wheel-build-params: "--release" From bf50c5d0f97c0fe984e08f18f4dd1104533f5b09 Mon Sep 17 00:00:00 2001 From: lanluo-nvidia Date: Fri, 5 Jul 2024 19:53:47 -0700 Subject: [PATCH 29/32] test --- .github/workflows/release-linux.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/release-linux.yml b/.github/workflows/release-linux.yml index 92420aa62f..98fc2e5375 100644 --- a/.github/workflows/release-linux.yml +++ b/.github/workflows/release-linux.yml @@ -17,7 +17,7 @@ permissions: jobs: release-cxx11-tarball-artifacts: env: - PYTHON_VERSION: 3.10 + PYTHON_VERSION: '3.10' CU_VERSION: cu124 name: Release torch-tensorrt cxx11 tarball artifacts runs-on: linux.4xlarge.nvidia.gpu From a3ac2702303a49e440c0056ee03ede0390b56128 Mon Sep 17 00:00:00 2001 From: lanluo-nvidia Date: Fri, 5 Jul 2024 21:15:04 -0700 Subject: [PATCH 30/32] test --- .github/workflows/release-linux.yml | 4 +--- .github/workflows/release-wheel-linux.yml | 6 ++---- .github/workflows/release-wheel-windows.yml | 6 +++--- 3 files changed, 6 insertions(+), 10 deletions(-) diff --git a/.github/workflows/release-linux.yml b/.github/workflows/release-linux.yml index 98fc2e5375..3936fbdb6e 100644 --- a/.github/workflows/release-linux.yml +++ b/.github/workflows/release-linux.yml @@ -45,12 +45,10 @@ jobs: # NB: Only upload to GitHub after passing smoke tests - name: Upload tarball to GitHub continue-on-error: true - uses: actions/upload-artifact@v4 + uses: actions/upload-artifact@v3 with: name: cxx11-tarball-${{ env.PYTHON_VERSION }}-${{ env.CU_VERSION }} path: /opt/torch_tensorrt/release/ - # no compression, keep the .tar.gz, otherwise it will became a .zip - compression-level: 0 generate-matrix: uses: pytorch/test-infra/.github/workflows/generate_binary_build_matrix.yml@main diff --git a/.github/workflows/release-wheel-linux.yml b/.github/workflows/release-wheel-linux.yml index 9edea93ba0..67f9aa0c8a 100644 --- a/.github/workflows/release-wheel-linux.yml +++ b/.github/workflows/release-wheel-linux.yml @@ -224,19 +224,17 @@ jobs: # NB: Only upload to GitHub after passing smoke tests - name: Upload wheel to GitHub continue-on-error: true - uses: actions/upload-artifact@v4 + uses: actions/upload-artifact@v3 with: name: ${{ env.ARTIFACT_NAME }} path: ${{ inputs.repository }}/release/wheel/ - name: Upload pre-cxx11 tarball to GitHub if: ${{ env.PYTHON_VERSION == '3.10' && env.CU_VERSION == 'cu124' }} continue-on-error: true - uses: actions/upload-artifact@v4 + uses: actions/upload-artifact@v3 with: name: pre-cxx11-tarball-${{ env.PYTHON_VERSION }}-${{ env.CU_VERSION }} path: ${{ inputs.repository }}/release/tarball/ - # no compression, keep the .tar.gz, otherwise it will became a .zip - compression-level: 0 concurrency: group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref_name }}-${{ inputs.repository }}-${{ github.event_name == 'workflow_dispatch' }}-${{ inputs.job-name }} diff --git a/.github/workflows/release-wheel-windows.yml b/.github/workflows/release-wheel-windows.yml index c96953da4c..805e88ee4d 100644 --- a/.github/workflows/release-wheel-windows.yml +++ b/.github/workflows/release-wheel-windows.yml @@ -156,15 +156,15 @@ jobs: else export PYTORCH_VERSION="$(${CONDA_RUN} pip show torch | grep ^Version: | sed 's/Version: *//')" fi - + export BUILD_VERSION=${PYTORCH_VERSION} if [[ -z "${ENV_SCRIPT}" ]]; then - BUILD_VERSION=${PYTORCH_VERSION} ${CONDA_RUN} python setup.py bdist_wheel + ${CONDA_RUN} python setup.py bdist_wheel else if [[ ! -f ${ENV_SCRIPT} ]]; then echo "::error::Specified env-script file (${ENV_SCRIPT}) not found" exit 1 else - ${CONDA_RUN} ${ENV_SCRIPT} BUILD_VERSION=${PYTORCH_VERSION} python setup.py bdist_wheel ${BUILD_PARAMS} + ${CONDA_RUN} ${ENV_SCRIPT} python setup.py bdist_wheel ${BUILD_PARAMS} fi fi - name: Run post-script From fcb3f8d384bd736571834dd3ffdc9d21cdb691e1 Mon Sep 17 00:00:00 2001 From: lanluo-nvidia Date: Fri, 5 Jul 2024 22:29:00 -0700 Subject: [PATCH 31/32] test --- .github/workflows/release-linux.yml | 1 - .github/workflows/release-wheel-linux.yml | 2 +- .github/workflows/release-wheel-windows.yml | 5 ++++- 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/.github/workflows/release-linux.yml b/.github/workflows/release-linux.yml index 3936fbdb6e..8312acdd8f 100644 --- a/.github/workflows/release-linux.yml +++ b/.github/workflows/release-linux.yml @@ -1,7 +1,6 @@ name: Release Linux wheels and tarball artifacts on: - pull_request: push: tags: # NOTE: Binary build pipelines should only get triggered on release candidate builds diff --git a/.github/workflows/release-wheel-linux.yml b/.github/workflows/release-wheel-linux.yml index 67f9aa0c8a..d191675379 100644 --- a/.github/workflows/release-wheel-linux.yml +++ b/.github/workflows/release-wheel-linux.yml @@ -187,7 +187,7 @@ jobs: set -euxo pipefail source "${BUILD_ENV_FILE}" - # BUILD_VERSION example: 2.4.0.dev20240610+cu121, we don't want the +cu121 part, so remove +cu121 + # BUILD_VERSION example: 2.4.0+cu121, we don't want the +cu121 part, so remove +cu121 BUILD_VERSION=${BUILD_VERSION%+*} ${CONDA_RUN} python setup.py bdist_wheel --release TRT_VERSION=10.0.1 diff --git a/.github/workflows/release-wheel-windows.yml b/.github/workflows/release-wheel-windows.yml index 805e88ee4d..6a6c993502 100644 --- a/.github/workflows/release-wheel-windows.yml +++ b/.github/workflows/release-wheel-windows.yml @@ -156,7 +156,10 @@ jobs: else export PYTORCH_VERSION="$(${CONDA_RUN} pip show torch | grep ^Version: | sed 's/Version: *//')" fi - export BUILD_VERSION=${PYTORCH_VERSION} + + # BUILD_VERSION example: 2.4.0+cu121, we don't want the +cu121 part, so remove +cu121 + BUILD_VERSION=${BUILD_VERSION%+*} + if [[ -z "${ENV_SCRIPT}" ]]; then ${CONDA_RUN} python setup.py bdist_wheel else From d07dd8069ca0b194494fb62757c76f0ac822c770 Mon Sep 17 00:00:00 2001 From: lanluo-nvidia Date: Fri, 5 Jul 2024 22:53:39 -0700 Subject: [PATCH 32/32] test --- .github/workflows/build-test-linux.yml | 2 +- .github/workflows/build-test-windows.yml | 2 +- setup.py | 1 - 3 files changed, 2 insertions(+), 3 deletions(-) diff --git a/.github/workflows/build-test-linux.yml b/.github/workflows/build-test-linux.yml index 48f41107ee..b862673f0b 100644 --- a/.github/workflows/build-test-linux.yml +++ b/.github/workflows/build-test-linux.yml @@ -1,7 +1,7 @@ name: Build and test Linux wheels on: - # pull_request: + pull_request: push: branches: - main diff --git a/.github/workflows/build-test-windows.yml b/.github/workflows/build-test-windows.yml index fb2d6f9dc2..1bdb52ae8a 100644 --- a/.github/workflows/build-test-windows.yml +++ b/.github/workflows/build-test-windows.yml @@ -1,7 +1,7 @@ name: Build and test Windows wheels on: - #pull_request: + pull_request: push: branches: - main diff --git a/setup.py b/setup.py index 9a24411ee6..c74fb9e130 100644 --- a/setup.py +++ b/setup.py @@ -124,7 +124,6 @@ def load_dep_info(): if RELEASE: __version__ = os.environ.get("BUILD_VERSION") - print(f"lan added __version__={__version__}") else: __version__ = f"{get_base_version()}.dev0+{get_git_revision_short_hash()}"