@@ -48,146 +48,56 @@ jobs:
4848{% - for config in build_configs %}
4949 !{{ config["build_name"] }}-build:
5050 if: ${{ github.repository_owner == 'pytorch' }}
51- runs-on: linux.4xlarge
52- timeout-minutes: !{{ common.timeout_minutes }}
53- !{{ upload.binary_env(config) }}
54- steps:
55- !{{ common.setup_ec2_linux() }}
56- !{{ common.checkout(deep_clone=False, directory="pytorch") }}
57- !{{ common.checkout(deep_clone=False, directory="builder", repository="pytorch/builder", branch=common.builder_branch) }}
58- {% - if config ["gpu_arch_type" ] == 'cuda' and config ["gpu_arch_version" ].startswith ('11' ) %}
59- - name: Set BUILD_SPLIT_CUDA
60- run: |
61- echo "BUILD_SPLIT_CUDA='ON'" >> "$GITHUB_ENV"
62- {% - endif %}
63- - name: Pull Docker image
64- run: |
65- !{{ common.add_retry_to_env() }}
66- retry docker pull "${DOCKER_IMAGE}"
67- - name: Build PyTorch binary
68- run: |
69- set -x
70- mkdir -p artifacts/
71- container_name=$(docker run \
72- -e BINARY_ENV_FILE \
73- -e BUILDER_ROOT \
74- -e BUILD_ENVIRONMENT \
75- -e BUILD_SPLIT_CUDA \
76- -e DESIRED_CUDA \
77- -e DESIRED_DEVTOOLSET \
78- -e DESIRED_PYTHON \
79- -e GITHUB_ACTIONS \
80- -e GPU_ARCH_TYPE \
81- -e GPU_ARCH_VERSION \
82- -e LIBTORCH_VARIANT \
83- -e PACKAGE_TYPE \
84- -e PYTORCH_FINAL_PACKAGE_DIR \
85- -e PYTORCH_ROOT \
86- -e SKIP_ALL_TESTS \
87- --tty \
88- --detach \
89- -v "${GITHUB_WORKSPACE}/pytorch:/pytorch" \
90- -v "${GITHUB_WORKSPACE}/builder:/builder" \
91- -v "${RUNNER_TEMP}/artifacts:/artifacts" \
92- -w / \
93- "${DOCKER_IMAGE}"
94- )
95- docker exec -t -w "${PYTORCH_ROOT}" "${container_name}" bash -c "bash .circleci/scripts/binary_populate_env.sh"
96- docker exec -t "${container_name}" bash -c "source ${BINARY_ENV_FILE} && bash /builder/!{{ config["package_type"] }}/build.sh"
97- !{{ common.chown_dir("${RUNNER_TEMP}/artifacts") }}
98- - uses: !{{ common.upload_artifact_s3_action }}
99- with:
100- name: !{{ config["build_name"] }}
101- retention-days: 14
102- if-no-files-found: error
103- path:
104- ${{ runner.temp }}/artifacts/*
105- !{{ common.teardown_ec2_linux("pytorch/") }}
51+ uses: ./.github/workflows/_binary-build-linux.yml
52+ with:!{{ upload.binary_env_as_input(config) }}
53+ build_name: !{{ config["build_name"] }}
54+ build_environment: !{{ build_environment }}
55+ secrets:
56+ github-token: ${{ secrets.GITHUB_TOKEN }}
57+
10658 !{{ config["build_name"] }}-test: # Testing
10759 if: ${{ github.repository_owner == 'pytorch' }}
10860 needs: !{{ config["build_name"] }}-build
109- {% - if config ["gpu_arch_type" ] == "rocm" %}
110- runs-on: linux.rocm.gpu
111- {% - elif config ["gpu_arch_type" ] == "cuda" %}
112- runs-on: linux.4xlarge.nvidia.gpu
61+ {% - if config ["gpu_arch_type" ] != "rocm" %}
62+ uses: ./.github/workflows/_binary-test-linux.yml
63+ with:!{{ upload.binary_env_as_input(config) }}
64+ build_name: !{{ config["build_name"] }}
65+ build_environment: !{{ build_environment }}
66+ {% - if config ["gpu_arch_type" ] == "rocm" %}
67+ runs_on: linux.rocm.gpu
68+ {% - elif config ["gpu_arch_type" ] == "cuda" %}
69+ runs_on: linux.4xlarge.nvidia.gpu
70+ {% - else %}
71+ runs_on: linux.4xlarge
72+ {% - endif %}
73+ secrets:
74+ github-token: ${{ secrets.GITHUB_TOKEN }}
11375{% - else %}
114- runs-on: linux.4xlarge
115- {% - endif %}
76+ runs-on: linux.rocm.gpu
11677 timeout-minutes: !{{ common.timeout_minutes }}
11778 !{{ upload.binary_env(config) }}
11879 steps:
119- {% - if config ["gpu_arch_type" ] == "rocm" %}
12080 !{{ common.setup_rocm_linux() }}
121- {% - else %}
122- !{{ common.setup_ec2_linux() }}
123- {% - endif %}
12481 - uses: !{{ common.download_artifact_s3_action }}
12582 name: Download Build Artifacts
12683 with:
12784 name: !{{ config["build_name"] }}
12885 path: "${{ runner.temp }}/artifacts/"
12986 !{{ common.checkout(deep_clone=False, directory="pytorch") }}
13087 !{{ common.checkout(deep_clone=False, directory="builder", repository="pytorch/builder", branch=common.builder_branch) }}
131- {% - if config ["gpu_arch_type" ] == "rocm" %}
13288 - name: ROCm set GPU_FLAG
13389 run: |
13490 echo "GPU_FLAG=--device=/dev/mem --device=/dev/kfd --device=/dev/dri --group-add video --group-add daemon" >> "${GITHUB_ENV}"
135- {% - elif config ["gpu_arch_type" ] == "cuda" %}
136- - uses: nick-fields/retry@71062288b76e2b6214ebde0e673ce0de1755740a
137- name: Install nvidia driver, nvidia-docker runtime, set GPU_FLAG
138- with:
139- timeout_minutes: 10
140- max_attempts: 3
141- command: |
142- set -ex
143- pushd pytorch
144- bash .github/scripts/install_nvidia_utils_linux.sh
145- echo "GPU_FLAG=--gpus all" >> "${GITHUB_ENV}"
146- popd
147- {% - endif %}
14891 - name: Pull Docker image
149- run: |
150- !{{ common.add_retry_to_env() }}
151- retry docker pull "${DOCKER_IMAGE}"
152- - name: Test PyTorch binary
153- run: |
154- set -x
155- # shellcheck disable=SC2086,SC2090
156- container_name=$(docker run \
157- ${GPU_FLAG:-} \
158- -e BINARY_ENV_FILE \
159- -e BUILDER_ROOT \
160- -e BUILD_ENVIRONMENT \
161- -e BUILD_SPLIT_CUDA \
162- -e DESIRED_CUDA \
163- -e DESIRED_DEVTOOLSET \
164- -e DESIRED_PYTHON \
165- -e GITHUB_ACTIONS \
166- -e GPU_ARCH_TYPE \
167- -e GPU_ARCH_VERSION \
168- -e LIBTORCH_VARIANT \
169- -e PACKAGE_TYPE \
170- -e PYTORCH_FINAL_PACKAGE_DIR \
171- -e PYTORCH_ROOT \
172- -e SKIP_ALL_TESTS \
173- --tty \
174- --detach \
175- -v "${GITHUB_WORKSPACE}/pytorch:/pytorch" \
176- -v "${GITHUB_WORKSPACE}/builder:/builder" \
177- -v "${RUNNER_TEMP}/artifacts:/final_pkgs" \
178- -w / \
179- "${DOCKER_IMAGE}"
180- )
181- docker exec -t -w "${PYTORCH_ROOT}" "${container_name}" bash -c "bash .circleci/scripts/binary_populate_env.sh"
182- # Generate test script
183- docker exec -t -w "${PYTORCH_ROOT}" -e OUTPUT_SCRIPT="/run.sh" "${container_name}" bash -c "bash .circleci/scripts/binary_linux_test.sh"
184- docker exec -t "${container_name}" bash -c "source ${BINARY_ENV_FILE} && bash -x /run.sh"
185- {% - if config ["gpu_arch_type" ] == "rocm" %}
92+ uses: ./pytorch/.github/actions/pull-docker-image
93+ with:
94+ docker-image: !{{ config["container_image"] }}
95+ - name: Test Pytorch binary
96+ uses: ./pytorch/.github/actions/test-pytorch-binary
18697 !{{ common.teardown_rocm_linux() }}
187- {% - else %}
188- !{{ common.teardown_ec2_linux("pytorch/") }}
18998{% - endif %}
190- {% - if branches == "nightly" %}
99+
100+ {% - if branches == "nightly" %}
191101 !{{ upload.upload_binaries(config) }}
192- {% - endif %}
102+ {% - endif %}
193103{% - endfor %}
0 commit comments