pytorch

Форк
0
/
linux_binary_build_workflow.yml.j2 
121 строка · 4.4 Кб
1
{% import 'common.yml.j2' as common %}
2
{% import 'upload.yml.j2' as upload %}
3

4
{%- block name -%}
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 }}
8
{%- endblock %}
9

10

11
on:
12
  push:
13
    {%- if branches == "nightly" %}
14
    # NOTE: Meta Employees can trigger new nightlies using: https://fburl.com/trigger_pytorch_nightly_build
15
    {%- endif %}
16
    branches:
17
      - !{{ branches }}
18
    {%- if branches == "nightly" %}
19
    tags:
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]+
23
    {%- endif %}
24
{%- for label in ciflow_config.labels | sort %}
25
    {%- if loop.first and branches != "nightly" %}
26
    tags:
27
    {%- endif %}
28
      - '!{{ label }}/*'
29
{%- endfor %}
30
  workflow_dispatch:
31

32
env:
33
  # Needed for conda builds
34
  {%- if "aarch64" in build_environment %}
35
  ALPINE_IMAGE: "arm64v8/alpine"
36
  {%- else %}
37
  ALPINE_IMAGE: "308535385114.dkr.ecr.us-east-1.amazonaws.com/tool/alpine"
38
  {%- endif %}
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 }}
49
  SKIP_ALL_TESTS: 1
50
!{{ common.concurrency(build_environment) }}
51

52
jobs:
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
63
      {%- endif %}
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 }}
68
      {%- endif %}
69
    secrets:
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
86
      {%- else %}
87
      runs_on: linux.4xlarge
88
      {%- endif %}
89
    secrets:
90
      github-token: ${{ secrets.GITHUB_TOKEN }}
91
{%- else %}
92
    runs-on: linux.rocm.gpu
93
    timeout-minutes: !{{ common.timeout_minutes }}
94
    !{{ upload.binary_env(config) }}
95
    steps:
96
      - name: Setup ROCm
97
        uses: ./.github/actions/setup-rocm
98
      - uses: !{{ common.download_artifact_action }}
99
        name: Download Build Artifacts
100
        with:
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
106
        run: |
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
110
        with:
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
116
{%- endif %}
117

118
{%- if branches == "nightly" %}
119
  !{{ upload.upload_binaries(config) }}
120
{%- endif %}
121
{% endfor %}
122

Использование cookies

Мы используем файлы cookie в соответствии с Политикой конфиденциальности и Политикой использования cookies.

Нажимая кнопку «Принимаю», Вы даете АО «СберТех» согласие на обработку Ваших персональных данных в целях совершенствования нашего веб-сайта и Сервиса GitVerse, а также повышения удобства их использования.

Запретить использование cookies Вы можете самостоятельно в настройках Вашего браузера.