1
{% import 'common.yml.j2' as common %}
2
{% import 'upload.yml.j2' as upload %}
5
# Template is at: .github/templates/linux_binary_build_workflow.yml.j2
6
# Generation script: .github/scripts/generate_ci_workflows.py
7
name: !{{ build_environment }}
13
{%- if branches == "nightly" %}
14
# NOTE: Meta Employees can trigger new nightlies using: https://fburl.com/trigger_pytorch_nightly_build
18
{%- if branches == "nightly" %}
20
# NOTE: Binary build pipelines should only get triggered on release candidate builds
21
# Release candidate tags look like: v1.11.0-rc1
22
- v[0-9]+.[0-9]+.[0-9]+-rc[0-9]+
24
{%- for label in ciflow_config.labels | sort %}
25
{%- if loop.first and branches != "nightly" %}
33
# Needed for conda builds
34
{%- if "aarch64" in build_environment %}
35
ALPINE_IMAGE: "arm64v8/alpine"
37
ALPINE_IMAGE: "308535385114.dkr.ecr.us-east-1.amazonaws.com/tool/alpine"
39
ANACONDA_USER: pytorch
40
AWS_DEFAULT_REGION: us-east-1
41
BINARY_ENV_FILE: /tmp/env
42
BUILD_ENVIRONMENT: !{{ build_environment }}
43
BUILDER_ROOT: /builder
44
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
45
PR_NUMBER: ${{ github.event.pull_request.number }}
46
PYTORCH_FINAL_PACKAGE_DIR: /artifacts
47
PYTORCH_ROOT: /pytorch
48
SHA1: ${{ github.event.pull_request.head.sha || github.sha }}
50
!{{ common.concurrency(build_environment) }}
53
{%- for config in build_configs %}
54
!{{ config["build_name"] }}-build:
55
if: ${{ github.repository_owner == 'pytorch' }}
56
uses: ./.github/workflows/_binary-build-linux.yml
57
with:!{{ upload.binary_env_as_input(config) }}
58
{%- if "aarch64" in build_environment %}
59
runs_on: linux.arm64.2xlarge
60
ALPINE_IMAGE: "arm64v8/alpine"
61
{%- elif "conda" in build_environment and config["gpu_arch_type"] == "cuda" %}
62
runs_on: linux.24xlarge
64
build_name: !{{ config["build_name"] }}
65
build_environment: !{{ build_environment }}
66
{%- if config.pytorch_extra_install_requirements is defined and config.pytorch_extra_install_requirements|d('')|length > 0 %}
67
PYTORCH_EXTRA_INSTALL_REQUIREMENTS: !{{ config.pytorch_extra_install_requirements }}
70
github-token: ${{ secrets.GITHUB_TOKEN }}
71
!{{ config["build_name"] }}-test: # Testing
72
if: ${{ github.repository_owner == 'pytorch' }}
73
needs: !{{ config["build_name"] }}-build
74
{%- if config["gpu_arch_type"] != "rocm" %}
75
uses: ./.github/workflows/_binary-test-linux.yml
76
with:!{{ upload.binary_env_as_input(config) }}
77
build_name: !{{ config["build_name"] }}
78
build_environment: !{{ build_environment }}
79
{%- if "aarch64" in build_environment %}
80
runs_on: linux.arm64.2xlarge
81
ALPINE_IMAGE: "arm64v8/alpine"
82
{%- elif config["gpu_arch_type"] == "rocm" %}
83
runs_on: linux.rocm.gpu
84
{%- elif config["gpu_arch_type"] == "cuda" %}
85
runs_on: linux.4xlarge.nvidia.gpu
87
runs_on: linux.4xlarge
90
github-token: ${{ secrets.GITHUB_TOKEN }}
92
runs-on: linux.rocm.gpu
93
timeout-minutes: !{{ common.timeout_minutes }}
94
!{{ upload.binary_env(config) }}
97
uses: ./.github/actions/setup-rocm
98
- uses: !{{ common.download_artifact_action }}
99
name: Download Build Artifacts
101
name: !{{ config["build_name"] }}
102
path: "${{ runner.temp }}/artifacts/"
103
!{{ common.checkout(deep_clone=False, directory="pytorch") }}
104
!{{ common.checkout(deep_clone=False, directory="builder", repository=common.builder_repo, branch=common.builder_branch) }}
105
- name: ROCm set GPU_FLAG
107
echo "GPU_FLAG=--device=/dev/mem --device=/dev/kfd --device=/dev/dri --group-add video --group-add daemon" >> "${GITHUB_ENV}"
108
- name: Pull Docker image
109
uses: pytorch/test-infra/.github/actions/pull-docker-image@main
111
docker-image: !{{ config["container_image"] }}
112
- name: Test Pytorch binary
113
uses: ./pytorch/.github/actions/test-pytorch-binary
114
- name: Teardown ROCm
115
uses: ./.github/actions/teardown-rocm
118
{%- if branches == "nightly" %}
119
!{{ upload.upload_binaries(config) }}