Convert inductor jobs to Linux Amazon 2023 (#133352) #2
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Build libtorch docker images | |
on: | |
push: | |
branches: | |
- main | |
- release/* | |
tags: | |
# NOTE: Binary build pipelines should only get triggered on release candidate or nightly builds | |
# Release candidate tags look like: v1.11.0-rc1 | |
- v[0-9]+.[0-9]+.[0-9]+-rc[0-9]+ | |
paths: | |
- '.ci/docker/libtorch/*' | |
- '.ci/docker/common/*' | |
- .github/workflows/build-libtorch-images.yml | |
pull_request: | |
paths: | |
- '.ci/docker/libtorch/*' | |
- '.ci/docker/common/*' | |
- .github/workflows/build-libtorch-images.yml | |
env: | |
DOCKER_REGISTRY: "docker.io" | |
DOCKER_BUILDKIT: 1 | |
DOCKER_ID: ${{ secrets.DOCKER_ID }} | |
DOCKER_TOKEN: ${{ secrets.DOCKER_TOKEN }} | |
WITH_PUSH: ${{ github.event_name == 'push' && (github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/heads/release')) }} | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.sha }}-${{ github.event_name == 'workflow_dispatch' }} | |
cancel-in-progress: true | |
jobs: | |
build-docker-cuda: | |
runs-on: linux.9xlarge.ephemeral | |
strategy: | |
matrix: | |
cuda_version: ["12.4", "12.1", "11.8"] | |
env: | |
GPU_ARCH_TYPE: cuda | |
GPU_ARCH_VERSION: ${{ matrix.cuda_version }} | |
steps: | |
- name: Checkout PyTorch | |
uses: pytorch/pytorch/.github/actions/checkout-pytorch@main | |
with: | |
submodules: false | |
- name: Calculate docker image | |
if: env.WITH_PUSH == 'false' | |
uses: pytorch/test-infra/.github/actions/calculate-docker-image@main | |
with: | |
docker-image-name: libtorch-cxx11-builder-cuda${{matrix.cuda_version}} | |
docker-build-dir: .ci/docker/libtorch | |
always-rebuild: true | |
push: true | |
- name: Authenticate if WITH_PUSH | |
if: env.WITH_PUSH == 'true' | |
run: | | |
if [[ "${WITH_PUSH}" == true ]]; then | |
echo "${DOCKER_TOKEN}" | docker login -u "${DOCKER_ID}" --password-stdin | |
fi | |
- name: Build Docker Image | |
if: env.WITH_PUSH == 'true' | |
run: | | |
.ci/docker/libtorch/build.sh libtorch-cxx11-builder:cuda${{matrix.cuda_version}} | |
build-docker-rocm: | |
runs-on: linux.9xlarge.ephemeral | |
strategy: | |
matrix: | |
rocm_version: ["6.1", "6.2"] | |
env: | |
GPU_ARCH_TYPE: rocm | |
GPU_ARCH_VERSION: ${{ matrix.rocm_version }} | |
steps: | |
- name: Checkout PyTorch | |
uses: pytorch/pytorch/.github/actions/checkout-pytorch@main | |
with: | |
submodules: false | |
- name: Calculate docker image | |
if: env.WITH_PUSH == 'false' | |
uses: pytorch/test-infra/.github/actions/calculate-docker-image@main | |
with: | |
docker-image-name: libtorch-cxx11-builder-rocm${{matrix.rocm_version}} | |
docker-build-dir: .ci/docker/libtorch | |
always-rebuild: true | |
push: true | |
- name: Authenticate if WITH_PUSH | |
if: env.WITH_PUSH == 'true' | |
run: | | |
if [[ "${WITH_PUSH}" == true ]]; then | |
echo "${DOCKER_TOKEN}" | docker login -u "${DOCKER_ID}" --password-stdin | |
fi | |
- name: Build Docker Image | |
if: env.WITH_PUSH == 'true' | |
run: | | |
.ci/docker/libtorch/build.sh libtorch-cxx11-builder:rocm${{matrix.rocm_version}} | |
build-docker-cpu: | |
runs-on: linux.9xlarge.ephemeral | |
steps: | |
- name: Checkout PyTorch | |
uses: pytorch/pytorch/.github/actions/checkout-pytorch@main | |
with: | |
submodules: false | |
- name: Calculate docker image | |
if: env.WITH_PUSH == 'false' | |
uses: pytorch/test-infra/.github/actions/calculate-docker-image@main | |
with: | |
docker-image-name: libtorch-cxx11-builder-cpu | |
docker-build-dir: .ci/docker/libtorch | |
always-rebuild: true | |
push: true | |
- name: Authenticate if WITH_PUSH | |
if: env.WITH_PUSH == 'true' | |
run: | | |
if [[ "${WITH_PUSH}" == true ]]; then | |
echo "${DOCKER_TOKEN}" | docker login -u "${DOCKER_ID}" --password-stdin | |
fi | |
- name: Build Docker Image | |
if: env.WITH_PUSH == 'true' | |
run: | | |
.ci/docker/libtorch/build.sh libtorch-cxx11-builder:cpu |