-
Notifications
You must be signed in to change notification settings - Fork 4
128 lines (123 loc) · 4.47 KB
/
pytorch-cpu.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
# See https://github.com/pytorch/pytorch/blob/master/.github/workflows/generated-macos-binary-wheel-nightly.yml
name: pytorch-cpu
on:
workflow_call:
inputs:
BUILD_ENVIRONMENT:
type: string
CROSS_COMPILE_ARM64:
type: string
required: false
secrets:
AWS_ACCESS_KEY_ID:
required: true
AWS_SECRET_ACCESS_KEY:
required: true
env:
# Needed for conda builds
ALPINE_IMAGE: "308535385114.dkr.ecr.us-east-1.amazonaws.com/tool/alpine"
ANACONDA_USER: pytorch
AWS_DEFAULT_REGION: us-east-1
BUILD_ENVIRONMENT: ${{ inputs.BUILD_ENVIRONMENT }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SKIP_ALL_TESTS: 1
CROSS_COMPILE_ARM64: ${{ inputs.CROSS_COMPILE_ARM64 }}
# functorch doesn't work with nogil :(
BUILD_FUNCTORCH: 0
VERSION: 1.13.1
jobs:
wheel-py3_9-cpu-build:
runs-on: macos-12-xl
timeout-minutes: 240
env:
PYTORCH_ROOT: ${{ github.workspace }}/pytorch
BUILDER_ROOT: ${{ github.workspace }}/builder
PACKAGE_TYPE: wheel
# TODO: This is a legacy variable that we eventually want to get rid of in
# favor of GPU_ARCH_VERSION
DESIRED_CUDA: cpu
GPU_ARCH_TYPE: cpu
SKIP_ALL_TESTS: 1
DESIRED_PYTHON: "3.9"
# For sccache access (only on non-forked PRs)
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
steps:
# NOTE: These environment variables are put here so that they can be applied on every job equally
# They are also here because setting them at a workflow level doesn't give us access to the
# runner.temp variable, which we need.
- name: Populate binary env
shell: bash
run: |
# shellcheck disable=SC2129
echo "BINARY_ENV_FILE=${RUNNER_TEMP}/env" >> "${GITHUB_ENV}"
# shellcheck disable=SC2129
echo "PYTORCH_FINAL_PACKAGE_DIR=${RUNNER_TEMP}/artifacts" >> "${GITHUB_ENV}"
# shellcheck disable=SC2129
echo "MAC_PACKAGE_WORK_DIR=${RUNNER_TEMP}" >> "${GITHUB_ENV}"
- name: Install nogil Python
uses: colesbury/setup-python@nogil
with:
python-version: 'nogil-3.9'
- name: Checkout PyTorch
uses: malfet/checkout@silent-checkout
with:
repository: colesbury/pytorch
ref: v${{ env.VERSION }}-nogil
submodules: recursive
path: pytorch
quiet-checkout: true
- name: Clean PyTorch checkout
run: |
# Remove any artifacts from the previous checkouts
git clean -fxd
working-directory: pytorch
- name: Tag PyTorch checkout
run: |
git tag -f v${{ env.VERSION }}
working-directory: pytorch
- name: Checkout pytorch/builder
uses: malfet/checkout@silent-checkout
with:
ref: ${{ env.VERSION }}-nogil
submodules: recursive
repository: colesbury/builder
path: builder
quiet-checkout: true
- name: Clean pytorch/builder checkout
run: |
# Remove any artifacts from the previous checkouts
git clean -fxd
working-directory: builder
- name: Install sccache
uses: nick-fields/retry@v2.8.2
with:
timeout_minutes: 5
max_attempts: 3
retry_wait_seconds: 90
command: |
sudo curl --retry 3 --retry-all-errors https://s3.amazonaws.com/ossci-macos/sccache_v2.15 --output /usr/local/bin/sccache
sudo chmod +x /usr/local/bin/sccache
echo "SCCACHE_BUCKET=nogil-compiler-cache-circleci-v2" >> "${GITHUB_ENV}"
- name: Populate binary env
run: |
# shellcheck disable=SC1091
#source "${RUNNER_TEMP}/anaconda/bin/activate"
"${PYTORCH_ROOT}/.circleci/scripts/binary_populate_env.sh"
- name: Build PyTorch binary
run: |
# shellcheck disable=SC1091
#source "${RUNNER_TEMP}/anaconda/bin/activate"
"${PYTORCH_ROOT}/.circleci/scripts/binary_macos_build.sh"
- name: Rename wheel
run: |
cd "${{ env.PYTORCH_FINAL_PACKAGE_DIR }}"
file=$(find . -name 'torch-*.whl')
file2=$(echo $file | sed 's/cp39-none/nogil39-nogil_39b_darwin/g')
mv "$file" "$file2"
- uses: actions/upload-artifact@v3
if: always()
with:
retention-days: 14
if-no-files-found: error
path: "${{ env.PYTORCH_FINAL_PACKAGE_DIR }}"