1# @generated DO NOT EDIT MANUALLY 2 3# Template is at: .github/templates/macos_binary_build_workflow.yml.j2 4# Generation script: .github/scripts/generate_ci_workflows.py 5name: macos-arm64-binary-wheel 6 7on: 8# TODO: Migrate to new ciflow trigger, reference https://github.com/pytorch/pytorch/pull/70321 9 push: 10 # NOTE: Meta Employees can trigger new nightlies using: https://fburl.com/trigger_pytorch_nightly_build 11 branches: 12 - nightly 13 tags: 14 # NOTE: Binary build pipelines should only get triggered on release candidate builds 15 # Release candidate tags look like: v1.11.0-rc1 16 - v[0-9]+.[0-9]+.[0-9]+-rc[0-9]+ 17 - 'ciflow/binaries/*' 18 - 'ciflow/binaries_wheel/*' 19 workflow_dispatch: 20 21env: 22 # Needed for conda builds 23 ALPINE_IMAGE: "308535385114.dkr.ecr.us-east-1.amazonaws.com/tool/alpine" 24 ANACONDA_USER: pytorch 25 AWS_DEFAULT_REGION: us-east-1 26 BUILD_ENVIRONMENT: macos-arm64-binary-wheel 27 GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} 28 PR_NUMBER: ${{ github.event.pull_request.number }} 29 SKIP_ALL_TESTS: 0 30concurrency: 31 group: macos-arm64-binary-wheel-${{ github.event.pull_request.number || github.ref_name }}-${{ github.ref_type == 'branch' && github.sha }}-${{ github.event_name == 'workflow_dispatch' }} 32 cancel-in-progress: true 33 34jobs: 35 wheel-py3_8-cpu-build: 36 if: ${{ github.repository_owner == 'pytorch' }} 37 runs-on: macos-14-xlarge 38 timeout-minutes: 240 39 env: 40 PYTORCH_ROOT: ${{ github.workspace }}/pytorch 41 BUILDER_ROOT: ${{ github.workspace }}/builder 42 PACKAGE_TYPE: wheel 43 # TODO: This is a legacy variable that we eventually want to get rid of in 44 # favor of GPU_ARCH_VERSION 45 DESIRED_CUDA: cpu 46 GPU_ARCH_TYPE: cpu 47 SKIP_ALL_TESTS: 1 48 DESIRED_PYTHON: "3.8" 49 PYTORCH_EXTRA_INSTALL_REQUIREMENTS: nvidia-cuda-nvrtc-cu12==12.1.105; platform_system == 'Linux' and platform_machine == 'x86_64' | nvidia-cuda-runtime-cu12==12.1.105; platform_system == 'Linux' and platform_machine == 'x86_64' | nvidia-cuda-cupti-cu12==12.1.105; platform_system == 'Linux' and platform_machine == 'x86_64' | nvidia-cudnn-cu12==9.1.0.70; platform_system == 'Linux' and platform_machine == 'x86_64' | nvidia-cublas-cu12==12.1.3.1; platform_system == 'Linux' and platform_machine == 'x86_64' | nvidia-cufft-cu12==11.0.2.54; platform_system == 'Linux' and platform_machine == 'x86_64' | nvidia-curand-cu12==10.3.2.106; platform_system == 'Linux' and platform_machine == 'x86_64' | nvidia-cusolver-cu12==11.4.5.107; platform_system == 'Linux' and platform_machine == 'x86_64' | nvidia-cusparse-cu12==12.1.0.106; platform_system == 'Linux' and platform_machine == 'x86_64' | nvidia-nccl-cu12==2.20.5; platform_system == 'Linux' and platform_machine == 'x86_64' | nvidia-nvtx-cu12==12.1.105; platform_system == 'Linux' and platform_machine == 'x86_64' 50 # For sccache access (only on non-forked PRs) 51 AWS_ACCESS_KEY_ID: ${{ secrets.MACOS_SCCACHE_S3_ACCESS_KEY_ID }} 52 AWS_SECRET_ACCESS_KEY: ${{ secrets.MACOS_SCCACHE_S3_SECRET_ACCESS_KEY }} 53 steps: 54 # NOTE: These environment variables are put here so that they can be applied on every job equally 55 # They are also here because setting them at a workflow level doesn't give us access to the 56 # runner.temp variable, which we need. 57 - name: Populate binary env 58 shell: bash 59 run: | 60 # shellcheck disable=SC2129 61 echo "BINARY_ENV_FILE=${RUNNER_TEMP}/env" >> "${GITHUB_ENV}" 62 # shellcheck disable=SC2129 63 echo "PYTORCH_FINAL_PACKAGE_DIR=${RUNNER_TEMP}/artifacts" >> "${GITHUB_ENV}" 64 # shellcheck disable=SC2129 65 echo "MAC_PACKAGE_WORK_DIR=${RUNNER_TEMP}" >> "${GITHUB_ENV}" 66 - name: Install conda and dependencies 67 run: | 68 # Install conda, setup-miniconda messes with the path that messes with the ruby stuff we do later on 69 curl --retry 3 --retry-all-errors -o "${RUNNER_TEMP}/conda.sh" "https://repo.anaconda.com/miniconda/Miniconda3-py310_23.5.2-0-MacOSX-$(uname -m).sh" 70 chmod +x "${RUNNER_TEMP}/conda.sh" 71 /bin/bash "${RUNNER_TEMP}/conda.sh" -b -p "${RUNNER_TEMP}/anaconda" 72 echo "${RUNNER_TEMP}/anaconda/bin" >> "${GITHUB_PATH}" 73 if [ -d "/Applications/Xcode_14.3.1.app" ]; then 74 echo "DEVELOPER_DIR=/Applications/Xcode_14.3.1.app/Contents/Developer" >> "${GITHUB_ENV}" 75 elif [ -d "/Applications/Xcode_13.3.1.app" ]; then 76 echo "DEVELOPER_DIR=/Applications/Xcode_13.3.1.app/Contents/Developer" >> "${GITHUB_ENV}" 77 fi 78 - name: Checkout PyTorch 79 uses: malfet/checkout@silent-checkout 80 with: 81 submodules: recursive 82 path: pytorch 83 quiet-checkout: true 84 - name: Clean PyTorch checkout 85 run: | 86 # Remove any artifacts from the previous checkouts 87 git clean -fxd 88 working-directory: pytorch 89 - name: Checkout pytorch/builder 90 uses: malfet/checkout@silent-checkout 91 with: 92 ref: release/2.4 93 submodules: recursive 94 repository: pytorch/builder 95 path: builder 96 quiet-checkout: true 97 - name: Clean pytorch/builder checkout 98 run: | 99 # Remove any artifacts from the previous checkouts 100 git clean -fxd 101 working-directory: builder 102 - name: Install sccache (only for non-forked PRs, and pushes to trunk) 103 uses: nick-fields/retry@v2.8.2 104 if: ${{ github.event_name == 'push' || github.event.pull_request.head.repo.full_name == github.repository }} 105 with: 106 timeout_minutes: 5 107 max_attempts: 3 108 retry_wait_seconds: 90 109 command: | 110 sudo curl --retry 3 --retry-all-errors https://s3.amazonaws.com/ossci-macos/sccache_v2.15 --output /usr/local/bin/sccache 111 sudo chmod +x /usr/local/bin/sccache 112 echo "SCCACHE_BUCKET=ossci-compiler-cache-circleci-v2" >> "${GITHUB_ENV}" 113 - name: Populate binary env 114 run: | 115 # shellcheck disable=SC1091 116 source "${RUNNER_TEMP}/anaconda/bin/activate" 117 "${PYTORCH_ROOT}/.circleci/scripts/binary_populate_env.sh" 118 - name: Build PyTorch binary 119 run: | 120 # shellcheck disable=SC1091 121 source "${RUNNER_TEMP}/anaconda/bin/activate" 122 "${PYTORCH_ROOT}/.circleci/scripts/binary_macos_build.sh" 123 - uses: actions/upload-artifact@v3 124 if: always() 125 with: 126 name: wheel-py3_8-cpu 127 retention-days: 14 128 if-no-files-found: error 129 path: "${{ env.PYTORCH_FINAL_PACKAGE_DIR }}" 130 wheel-py3_8-cpu-upload: # Uploading 131 if: ${{ github.repository_owner == 'pytorch' }} 132 permissions: 133 id-token: write 134 contents: read 135 needs: wheel-py3_8-cpu-build 136 with: 137 PYTORCH_ROOT: /pytorch 138 BUILDER_ROOT: /builder 139 PACKAGE_TYPE: wheel 140 # TODO: This is a legacy variable that we eventually want to get rid of in 141 # favor of GPU_ARCH_VERSION 142 DESIRED_CUDA: cpu 143 GPU_ARCH_TYPE: cpu 144 DOCKER_IMAGE: pytorch/manylinux-builder:cpu-2.4 145 DESIRED_PYTHON: "3.8" 146 build_name: wheel-py3_8-cpu 147 use_s3: False 148 secrets: 149 github-token: ${{ secrets.GITHUB_TOKEN }} 150 conda-pytorchbot-token: ${{ secrets.CONDA_PYTORCHBOT_TOKEN }} 151 conda-pytorchbot-token-test: ${{ secrets.CONDA_PYTORCHBOT_TOKEN_TEST }} 152 uses: ./.github/workflows/_binary-upload.yml 153 wheel-py3_9-cpu-build: 154 if: ${{ github.repository_owner == 'pytorch' }} 155 runs-on: macos-14-xlarge 156 timeout-minutes: 240 157 env: 158 PYTORCH_ROOT: ${{ github.workspace }}/pytorch 159 BUILDER_ROOT: ${{ github.workspace }}/builder 160 PACKAGE_TYPE: wheel 161 # TODO: This is a legacy variable that we eventually want to get rid of in 162 # favor of GPU_ARCH_VERSION 163 DESIRED_CUDA: cpu 164 GPU_ARCH_TYPE: cpu 165 SKIP_ALL_TESTS: 1 166 DESIRED_PYTHON: "3.9" 167 PYTORCH_EXTRA_INSTALL_REQUIREMENTS: nvidia-cuda-nvrtc-cu12==12.1.105; platform_system == 'Linux' and platform_machine == 'x86_64' | nvidia-cuda-runtime-cu12==12.1.105; platform_system == 'Linux' and platform_machine == 'x86_64' | nvidia-cuda-cupti-cu12==12.1.105; platform_system == 'Linux' and platform_machine == 'x86_64' | nvidia-cudnn-cu12==9.1.0.70; platform_system == 'Linux' and platform_machine == 'x86_64' | nvidia-cublas-cu12==12.1.3.1; platform_system == 'Linux' and platform_machine == 'x86_64' | nvidia-cufft-cu12==11.0.2.54; platform_system == 'Linux' and platform_machine == 'x86_64' | nvidia-curand-cu12==10.3.2.106; platform_system == 'Linux' and platform_machine == 'x86_64' | nvidia-cusolver-cu12==11.4.5.107; platform_system == 'Linux' and platform_machine == 'x86_64' | nvidia-cusparse-cu12==12.1.0.106; platform_system == 'Linux' and platform_machine == 'x86_64' | nvidia-nccl-cu12==2.20.5; platform_system == 'Linux' and platform_machine == 'x86_64' | nvidia-nvtx-cu12==12.1.105; platform_system == 'Linux' and platform_machine == 'x86_64' 168 # For sccache access (only on non-forked PRs) 169 AWS_ACCESS_KEY_ID: ${{ secrets.MACOS_SCCACHE_S3_ACCESS_KEY_ID }} 170 AWS_SECRET_ACCESS_KEY: ${{ secrets.MACOS_SCCACHE_S3_SECRET_ACCESS_KEY }} 171 steps: 172 # NOTE: These environment variables are put here so that they can be applied on every job equally 173 # They are also here because setting them at a workflow level doesn't give us access to the 174 # runner.temp variable, which we need. 175 - name: Populate binary env 176 shell: bash 177 run: | 178 # shellcheck disable=SC2129 179 echo "BINARY_ENV_FILE=${RUNNER_TEMP}/env" >> "${GITHUB_ENV}" 180 # shellcheck disable=SC2129 181 echo "PYTORCH_FINAL_PACKAGE_DIR=${RUNNER_TEMP}/artifacts" >> "${GITHUB_ENV}" 182 # shellcheck disable=SC2129 183 echo "MAC_PACKAGE_WORK_DIR=${RUNNER_TEMP}" >> "${GITHUB_ENV}" 184 - name: Install conda and dependencies 185 run: | 186 # Install conda, setup-miniconda messes with the path that messes with the ruby stuff we do later on 187 curl --retry 3 --retry-all-errors -o "${RUNNER_TEMP}/conda.sh" "https://repo.anaconda.com/miniconda/Miniconda3-py310_23.5.2-0-MacOSX-$(uname -m).sh" 188 chmod +x "${RUNNER_TEMP}/conda.sh" 189 /bin/bash "${RUNNER_TEMP}/conda.sh" -b -p "${RUNNER_TEMP}/anaconda" 190 echo "${RUNNER_TEMP}/anaconda/bin" >> "${GITHUB_PATH}" 191 if [ -d "/Applications/Xcode_14.3.1.app" ]; then 192 echo "DEVELOPER_DIR=/Applications/Xcode_14.3.1.app/Contents/Developer" >> "${GITHUB_ENV}" 193 elif [ -d "/Applications/Xcode_13.3.1.app" ]; then 194 echo "DEVELOPER_DIR=/Applications/Xcode_13.3.1.app/Contents/Developer" >> "${GITHUB_ENV}" 195 fi 196 - name: Checkout PyTorch 197 uses: malfet/checkout@silent-checkout 198 with: 199 submodules: recursive 200 path: pytorch 201 quiet-checkout: true 202 - name: Clean PyTorch checkout 203 run: | 204 # Remove any artifacts from the previous checkouts 205 git clean -fxd 206 working-directory: pytorch 207 - name: Checkout pytorch/builder 208 uses: malfet/checkout@silent-checkout 209 with: 210 ref: release/2.4 211 submodules: recursive 212 repository: pytorch/builder 213 path: builder 214 quiet-checkout: true 215 - name: Clean pytorch/builder checkout 216 run: | 217 # Remove any artifacts from the previous checkouts 218 git clean -fxd 219 working-directory: builder 220 - name: Install sccache (only for non-forked PRs, and pushes to trunk) 221 uses: nick-fields/retry@v2.8.2 222 if: ${{ github.event_name == 'push' || github.event.pull_request.head.repo.full_name == github.repository }} 223 with: 224 timeout_minutes: 5 225 max_attempts: 3 226 retry_wait_seconds: 90 227 command: | 228 sudo curl --retry 3 --retry-all-errors https://s3.amazonaws.com/ossci-macos/sccache_v2.15 --output /usr/local/bin/sccache 229 sudo chmod +x /usr/local/bin/sccache 230 echo "SCCACHE_BUCKET=ossci-compiler-cache-circleci-v2" >> "${GITHUB_ENV}" 231 - name: Populate binary env 232 run: | 233 # shellcheck disable=SC1091 234 source "${RUNNER_TEMP}/anaconda/bin/activate" 235 "${PYTORCH_ROOT}/.circleci/scripts/binary_populate_env.sh" 236 - name: Build PyTorch binary 237 run: | 238 # shellcheck disable=SC1091 239 source "${RUNNER_TEMP}/anaconda/bin/activate" 240 "${PYTORCH_ROOT}/.circleci/scripts/binary_macos_build.sh" 241 - uses: actions/upload-artifact@v3 242 if: always() 243 with: 244 name: wheel-py3_9-cpu 245 retention-days: 14 246 if-no-files-found: error 247 path: "${{ env.PYTORCH_FINAL_PACKAGE_DIR }}" 248 wheel-py3_9-cpu-upload: # Uploading 249 if: ${{ github.repository_owner == 'pytorch' }} 250 permissions: 251 id-token: write 252 contents: read 253 needs: wheel-py3_9-cpu-build 254 with: 255 PYTORCH_ROOT: /pytorch 256 BUILDER_ROOT: /builder 257 PACKAGE_TYPE: wheel 258 # TODO: This is a legacy variable that we eventually want to get rid of in 259 # favor of GPU_ARCH_VERSION 260 DESIRED_CUDA: cpu 261 GPU_ARCH_TYPE: cpu 262 DOCKER_IMAGE: pytorch/manylinux-builder:cpu-2.4 263 DESIRED_PYTHON: "3.9" 264 build_name: wheel-py3_9-cpu 265 use_s3: False 266 secrets: 267 github-token: ${{ secrets.GITHUB_TOKEN }} 268 conda-pytorchbot-token: ${{ secrets.CONDA_PYTORCHBOT_TOKEN }} 269 conda-pytorchbot-token-test: ${{ secrets.CONDA_PYTORCHBOT_TOKEN_TEST }} 270 uses: ./.github/workflows/_binary-upload.yml 271 wheel-py3_10-cpu-build: 272 if: ${{ github.repository_owner == 'pytorch' }} 273 runs-on: macos-14-xlarge 274 timeout-minutes: 240 275 env: 276 PYTORCH_ROOT: ${{ github.workspace }}/pytorch 277 BUILDER_ROOT: ${{ github.workspace }}/builder 278 PACKAGE_TYPE: wheel 279 # TODO: This is a legacy variable that we eventually want to get rid of in 280 # favor of GPU_ARCH_VERSION 281 DESIRED_CUDA: cpu 282 GPU_ARCH_TYPE: cpu 283 SKIP_ALL_TESTS: 1 284 DESIRED_PYTHON: "3.10" 285 PYTORCH_EXTRA_INSTALL_REQUIREMENTS: nvidia-cuda-nvrtc-cu12==12.1.105; platform_system == 'Linux' and platform_machine == 'x86_64' | nvidia-cuda-runtime-cu12==12.1.105; platform_system == 'Linux' and platform_machine == 'x86_64' | nvidia-cuda-cupti-cu12==12.1.105; platform_system == 'Linux' and platform_machine == 'x86_64' | nvidia-cudnn-cu12==9.1.0.70; platform_system == 'Linux' and platform_machine == 'x86_64' | nvidia-cublas-cu12==12.1.3.1; platform_system == 'Linux' and platform_machine == 'x86_64' | nvidia-cufft-cu12==11.0.2.54; platform_system == 'Linux' and platform_machine == 'x86_64' | nvidia-curand-cu12==10.3.2.106; platform_system == 'Linux' and platform_machine == 'x86_64' | nvidia-cusolver-cu12==11.4.5.107; platform_system == 'Linux' and platform_machine == 'x86_64' | nvidia-cusparse-cu12==12.1.0.106; platform_system == 'Linux' and platform_machine == 'x86_64' | nvidia-nccl-cu12==2.20.5; platform_system == 'Linux' and platform_machine == 'x86_64' | nvidia-nvtx-cu12==12.1.105; platform_system == 'Linux' and platform_machine == 'x86_64' 286 # For sccache access (only on non-forked PRs) 287 AWS_ACCESS_KEY_ID: ${{ secrets.MACOS_SCCACHE_S3_ACCESS_KEY_ID }} 288 AWS_SECRET_ACCESS_KEY: ${{ secrets.MACOS_SCCACHE_S3_SECRET_ACCESS_KEY }} 289 steps: 290 # NOTE: These environment variables are put here so that they can be applied on every job equally 291 # They are also here because setting them at a workflow level doesn't give us access to the 292 # runner.temp variable, which we need. 293 - name: Populate binary env 294 shell: bash 295 run: | 296 # shellcheck disable=SC2129 297 echo "BINARY_ENV_FILE=${RUNNER_TEMP}/env" >> "${GITHUB_ENV}" 298 # shellcheck disable=SC2129 299 echo "PYTORCH_FINAL_PACKAGE_DIR=${RUNNER_TEMP}/artifacts" >> "${GITHUB_ENV}" 300 # shellcheck disable=SC2129 301 echo "MAC_PACKAGE_WORK_DIR=${RUNNER_TEMP}" >> "${GITHUB_ENV}" 302 - name: Install conda and dependencies 303 run: | 304 # Install conda, setup-miniconda messes with the path that messes with the ruby stuff we do later on 305 curl --retry 3 --retry-all-errors -o "${RUNNER_TEMP}/conda.sh" "https://repo.anaconda.com/miniconda/Miniconda3-py310_23.5.2-0-MacOSX-$(uname -m).sh" 306 chmod +x "${RUNNER_TEMP}/conda.sh" 307 /bin/bash "${RUNNER_TEMP}/conda.sh" -b -p "${RUNNER_TEMP}/anaconda" 308 echo "${RUNNER_TEMP}/anaconda/bin" >> "${GITHUB_PATH}" 309 if [ -d "/Applications/Xcode_14.3.1.app" ]; then 310 echo "DEVELOPER_DIR=/Applications/Xcode_14.3.1.app/Contents/Developer" >> "${GITHUB_ENV}" 311 elif [ -d "/Applications/Xcode_13.3.1.app" ]; then 312 echo "DEVELOPER_DIR=/Applications/Xcode_13.3.1.app/Contents/Developer" >> "${GITHUB_ENV}" 313 fi 314 - name: Checkout PyTorch 315 uses: malfet/checkout@silent-checkout 316 with: 317 submodules: recursive 318 path: pytorch 319 quiet-checkout: true 320 - name: Clean PyTorch checkout 321 run: | 322 # Remove any artifacts from the previous checkouts 323 git clean -fxd 324 working-directory: pytorch 325 - name: Checkout pytorch/builder 326 uses: malfet/checkout@silent-checkout 327 with: 328 ref: release/2.4 329 submodules: recursive 330 repository: pytorch/builder 331 path: builder 332 quiet-checkout: true 333 - name: Clean pytorch/builder checkout 334 run: | 335 # Remove any artifacts from the previous checkouts 336 git clean -fxd 337 working-directory: builder 338 - name: Install sccache (only for non-forked PRs, and pushes to trunk) 339 uses: nick-fields/retry@v2.8.2 340 if: ${{ github.event_name == 'push' || github.event.pull_request.head.repo.full_name == github.repository }} 341 with: 342 timeout_minutes: 5 343 max_attempts: 3 344 retry_wait_seconds: 90 345 command: | 346 sudo curl --retry 3 --retry-all-errors https://s3.amazonaws.com/ossci-macos/sccache_v2.15 --output /usr/local/bin/sccache 347 sudo chmod +x /usr/local/bin/sccache 348 echo "SCCACHE_BUCKET=ossci-compiler-cache-circleci-v2" >> "${GITHUB_ENV}" 349 - name: Populate binary env 350 run: | 351 # shellcheck disable=SC1091 352 source "${RUNNER_TEMP}/anaconda/bin/activate" 353 "${PYTORCH_ROOT}/.circleci/scripts/binary_populate_env.sh" 354 - name: Build PyTorch binary 355 run: | 356 # shellcheck disable=SC1091 357 source "${RUNNER_TEMP}/anaconda/bin/activate" 358 "${PYTORCH_ROOT}/.circleci/scripts/binary_macos_build.sh" 359 - uses: actions/upload-artifact@v3 360 if: always() 361 with: 362 name: wheel-py3_10-cpu 363 retention-days: 14 364 if-no-files-found: error 365 path: "${{ env.PYTORCH_FINAL_PACKAGE_DIR }}" 366 wheel-py3_10-cpu-upload: # Uploading 367 if: ${{ github.repository_owner == 'pytorch' }} 368 permissions: 369 id-token: write 370 contents: read 371 needs: wheel-py3_10-cpu-build 372 with: 373 PYTORCH_ROOT: /pytorch 374 BUILDER_ROOT: /builder 375 PACKAGE_TYPE: wheel 376 # TODO: This is a legacy variable that we eventually want to get rid of in 377 # favor of GPU_ARCH_VERSION 378 DESIRED_CUDA: cpu 379 GPU_ARCH_TYPE: cpu 380 DOCKER_IMAGE: pytorch/manylinux-builder:cpu-2.4 381 DESIRED_PYTHON: "3.10" 382 build_name: wheel-py3_10-cpu 383 use_s3: False 384 secrets: 385 github-token: ${{ secrets.GITHUB_TOKEN }} 386 conda-pytorchbot-token: ${{ secrets.CONDA_PYTORCHBOT_TOKEN }} 387 conda-pytorchbot-token-test: ${{ secrets.CONDA_PYTORCHBOT_TOKEN_TEST }} 388 uses: ./.github/workflows/_binary-upload.yml 389 wheel-py3_11-cpu-build: 390 if: ${{ github.repository_owner == 'pytorch' }} 391 runs-on: macos-14-xlarge 392 timeout-minutes: 240 393 env: 394 PYTORCH_ROOT: ${{ github.workspace }}/pytorch 395 BUILDER_ROOT: ${{ github.workspace }}/builder 396 PACKAGE_TYPE: wheel 397 # TODO: This is a legacy variable that we eventually want to get rid of in 398 # favor of GPU_ARCH_VERSION 399 DESIRED_CUDA: cpu 400 GPU_ARCH_TYPE: cpu 401 SKIP_ALL_TESTS: 1 402 DESIRED_PYTHON: "3.11" 403 PYTORCH_EXTRA_INSTALL_REQUIREMENTS: nvidia-cuda-nvrtc-cu12==12.1.105; platform_system == 'Linux' and platform_machine == 'x86_64' | nvidia-cuda-runtime-cu12==12.1.105; platform_system == 'Linux' and platform_machine == 'x86_64' | nvidia-cuda-cupti-cu12==12.1.105; platform_system == 'Linux' and platform_machine == 'x86_64' | nvidia-cudnn-cu12==9.1.0.70; platform_system == 'Linux' and platform_machine == 'x86_64' | nvidia-cublas-cu12==12.1.3.1; platform_system == 'Linux' and platform_machine == 'x86_64' | nvidia-cufft-cu12==11.0.2.54; platform_system == 'Linux' and platform_machine == 'x86_64' | nvidia-curand-cu12==10.3.2.106; platform_system == 'Linux' and platform_machine == 'x86_64' | nvidia-cusolver-cu12==11.4.5.107; platform_system == 'Linux' and platform_machine == 'x86_64' | nvidia-cusparse-cu12==12.1.0.106; platform_system == 'Linux' and platform_machine == 'x86_64' | nvidia-nccl-cu12==2.20.5; platform_system == 'Linux' and platform_machine == 'x86_64' | nvidia-nvtx-cu12==12.1.105; platform_system == 'Linux' and platform_machine == 'x86_64' 404 # For sccache access (only on non-forked PRs) 405 AWS_ACCESS_KEY_ID: ${{ secrets.MACOS_SCCACHE_S3_ACCESS_KEY_ID }} 406 AWS_SECRET_ACCESS_KEY: ${{ secrets.MACOS_SCCACHE_S3_SECRET_ACCESS_KEY }} 407 steps: 408 # NOTE: These environment variables are put here so that they can be applied on every job equally 409 # They are also here because setting them at a workflow level doesn't give us access to the 410 # runner.temp variable, which we need. 411 - name: Populate binary env 412 shell: bash 413 run: | 414 # shellcheck disable=SC2129 415 echo "BINARY_ENV_FILE=${RUNNER_TEMP}/env" >> "${GITHUB_ENV}" 416 # shellcheck disable=SC2129 417 echo "PYTORCH_FINAL_PACKAGE_DIR=${RUNNER_TEMP}/artifacts" >> "${GITHUB_ENV}" 418 # shellcheck disable=SC2129 419 echo "MAC_PACKAGE_WORK_DIR=${RUNNER_TEMP}" >> "${GITHUB_ENV}" 420 - name: Install conda and dependencies 421 run: | 422 # Install conda, setup-miniconda messes with the path that messes with the ruby stuff we do later on 423 curl --retry 3 --retry-all-errors -o "${RUNNER_TEMP}/conda.sh" "https://repo.anaconda.com/miniconda/Miniconda3-py310_23.5.2-0-MacOSX-$(uname -m).sh" 424 chmod +x "${RUNNER_TEMP}/conda.sh" 425 /bin/bash "${RUNNER_TEMP}/conda.sh" -b -p "${RUNNER_TEMP}/anaconda" 426 echo "${RUNNER_TEMP}/anaconda/bin" >> "${GITHUB_PATH}" 427 if [ -d "/Applications/Xcode_14.3.1.app" ]; then 428 echo "DEVELOPER_DIR=/Applications/Xcode_14.3.1.app/Contents/Developer" >> "${GITHUB_ENV}" 429 elif [ -d "/Applications/Xcode_13.3.1.app" ]; then 430 echo "DEVELOPER_DIR=/Applications/Xcode_13.3.1.app/Contents/Developer" >> "${GITHUB_ENV}" 431 fi 432 - name: Checkout PyTorch 433 uses: malfet/checkout@silent-checkout 434 with: 435 submodules: recursive 436 path: pytorch 437 quiet-checkout: true 438 - name: Clean PyTorch checkout 439 run: | 440 # Remove any artifacts from the previous checkouts 441 git clean -fxd 442 working-directory: pytorch 443 - name: Checkout pytorch/builder 444 uses: malfet/checkout@silent-checkout 445 with: 446 ref: release/2.4 447 submodules: recursive 448 repository: pytorch/builder 449 path: builder 450 quiet-checkout: true 451 - name: Clean pytorch/builder checkout 452 run: | 453 # Remove any artifacts from the previous checkouts 454 git clean -fxd 455 working-directory: builder 456 - name: Install sccache (only for non-forked PRs, and pushes to trunk) 457 uses: nick-fields/retry@v2.8.2 458 if: ${{ github.event_name == 'push' || github.event.pull_request.head.repo.full_name == github.repository }} 459 with: 460 timeout_minutes: 5 461 max_attempts: 3 462 retry_wait_seconds: 90 463 command: | 464 sudo curl --retry 3 --retry-all-errors https://s3.amazonaws.com/ossci-macos/sccache_v2.15 --output /usr/local/bin/sccache 465 sudo chmod +x /usr/local/bin/sccache 466 echo "SCCACHE_BUCKET=ossci-compiler-cache-circleci-v2" >> "${GITHUB_ENV}" 467 - name: Populate binary env 468 run: | 469 # shellcheck disable=SC1091 470 source "${RUNNER_TEMP}/anaconda/bin/activate" 471 "${PYTORCH_ROOT}/.circleci/scripts/binary_populate_env.sh" 472 - name: Build PyTorch binary 473 run: | 474 # shellcheck disable=SC1091 475 source "${RUNNER_TEMP}/anaconda/bin/activate" 476 "${PYTORCH_ROOT}/.circleci/scripts/binary_macos_build.sh" 477 - uses: actions/upload-artifact@v3 478 if: always() 479 with: 480 name: wheel-py3_11-cpu 481 retention-days: 14 482 if-no-files-found: error 483 path: "${{ env.PYTORCH_FINAL_PACKAGE_DIR }}" 484 wheel-py3_11-cpu-upload: # Uploading 485 if: ${{ github.repository_owner == 'pytorch' }} 486 permissions: 487 id-token: write 488 contents: read 489 needs: wheel-py3_11-cpu-build 490 with: 491 PYTORCH_ROOT: /pytorch 492 BUILDER_ROOT: /builder 493 PACKAGE_TYPE: wheel 494 # TODO: This is a legacy variable that we eventually want to get rid of in 495 # favor of GPU_ARCH_VERSION 496 DESIRED_CUDA: cpu 497 GPU_ARCH_TYPE: cpu 498 DOCKER_IMAGE: pytorch/manylinux-builder:cpu-2.4 499 DESIRED_PYTHON: "3.11" 500 build_name: wheel-py3_11-cpu 501 use_s3: False 502 secrets: 503 github-token: ${{ secrets.GITHUB_TOKEN }} 504 conda-pytorchbot-token: ${{ secrets.CONDA_PYTORCHBOT_TOKEN }} 505 conda-pytorchbot-token-test: ${{ secrets.CONDA_PYTORCHBOT_TOKEN_TEST }} 506 uses: ./.github/workflows/_binary-upload.yml 507 wheel-py3_12-cpu-build: 508 if: ${{ github.repository_owner == 'pytorch' }} 509 runs-on: macos-14-xlarge 510 timeout-minutes: 240 511 env: 512 PYTORCH_ROOT: ${{ github.workspace }}/pytorch 513 BUILDER_ROOT: ${{ github.workspace }}/builder 514 PACKAGE_TYPE: wheel 515 # TODO: This is a legacy variable that we eventually want to get rid of in 516 # favor of GPU_ARCH_VERSION 517 DESIRED_CUDA: cpu 518 GPU_ARCH_TYPE: cpu 519 SKIP_ALL_TESTS: 1 520 DESIRED_PYTHON: "3.12" 521 PYTORCH_EXTRA_INSTALL_REQUIREMENTS: nvidia-cuda-nvrtc-cu12==12.1.105; platform_system == 'Linux' and platform_machine == 'x86_64' | nvidia-cuda-runtime-cu12==12.1.105; platform_system == 'Linux' and platform_machine == 'x86_64' | nvidia-cuda-cupti-cu12==12.1.105; platform_system == 'Linux' and platform_machine == 'x86_64' | nvidia-cudnn-cu12==9.1.0.70; platform_system == 'Linux' and platform_machine == 'x86_64' | nvidia-cublas-cu12==12.1.3.1; platform_system == 'Linux' and platform_machine == 'x86_64' | nvidia-cufft-cu12==11.0.2.54; platform_system == 'Linux' and platform_machine == 'x86_64' | nvidia-curand-cu12==10.3.2.106; platform_system == 'Linux' and platform_machine == 'x86_64' | nvidia-cusolver-cu12==11.4.5.107; platform_system == 'Linux' and platform_machine == 'x86_64' | nvidia-cusparse-cu12==12.1.0.106; platform_system == 'Linux' and platform_machine == 'x86_64' | nvidia-nccl-cu12==2.20.5; platform_system == 'Linux' and platform_machine == 'x86_64' | nvidia-nvtx-cu12==12.1.105; platform_system == 'Linux' and platform_machine == 'x86_64' 522 # For sccache access (only on non-forked PRs) 523 AWS_ACCESS_KEY_ID: ${{ secrets.MACOS_SCCACHE_S3_ACCESS_KEY_ID }} 524 AWS_SECRET_ACCESS_KEY: ${{ secrets.MACOS_SCCACHE_S3_SECRET_ACCESS_KEY }} 525 steps: 526 # NOTE: These environment variables are put here so that they can be applied on every job equally 527 # They are also here because setting them at a workflow level doesn't give us access to the 528 # runner.temp variable, which we need. 529 - name: Populate binary env 530 shell: bash 531 run: | 532 # shellcheck disable=SC2129 533 echo "BINARY_ENV_FILE=${RUNNER_TEMP}/env" >> "${GITHUB_ENV}" 534 # shellcheck disable=SC2129 535 echo "PYTORCH_FINAL_PACKAGE_DIR=${RUNNER_TEMP}/artifacts" >> "${GITHUB_ENV}" 536 # shellcheck disable=SC2129 537 echo "MAC_PACKAGE_WORK_DIR=${RUNNER_TEMP}" >> "${GITHUB_ENV}" 538 - name: Install conda and dependencies 539 run: | 540 # Install conda, setup-miniconda messes with the path that messes with the ruby stuff we do later on 541 curl --retry 3 --retry-all-errors -o "${RUNNER_TEMP}/conda.sh" "https://repo.anaconda.com/miniconda/Miniconda3-py310_23.5.2-0-MacOSX-$(uname -m).sh" 542 chmod +x "${RUNNER_TEMP}/conda.sh" 543 /bin/bash "${RUNNER_TEMP}/conda.sh" -b -p "${RUNNER_TEMP}/anaconda" 544 echo "${RUNNER_TEMP}/anaconda/bin" >> "${GITHUB_PATH}" 545 if [ -d "/Applications/Xcode_14.3.1.app" ]; then 546 echo "DEVELOPER_DIR=/Applications/Xcode_14.3.1.app/Contents/Developer" >> "${GITHUB_ENV}" 547 elif [ -d "/Applications/Xcode_13.3.1.app" ]; then 548 echo "DEVELOPER_DIR=/Applications/Xcode_13.3.1.app/Contents/Developer" >> "${GITHUB_ENV}" 549 fi 550 - name: Checkout PyTorch 551 uses: malfet/checkout@silent-checkout 552 with: 553 submodules: recursive 554 path: pytorch 555 quiet-checkout: true 556 - name: Clean PyTorch checkout 557 run: | 558 # Remove any artifacts from the previous checkouts 559 git clean -fxd 560 working-directory: pytorch 561 - name: Checkout pytorch/builder 562 uses: malfet/checkout@silent-checkout 563 with: 564 ref: release/2.4 565 submodules: recursive 566 repository: pytorch/builder 567 path: builder 568 quiet-checkout: true 569 - name: Clean pytorch/builder checkout 570 run: | 571 # Remove any artifacts from the previous checkouts 572 git clean -fxd 573 working-directory: builder 574 - name: Install sccache (only for non-forked PRs, and pushes to trunk) 575 uses: nick-fields/retry@v2.8.2 576 if: ${{ github.event_name == 'push' || github.event.pull_request.head.repo.full_name == github.repository }} 577 with: 578 timeout_minutes: 5 579 max_attempts: 3 580 retry_wait_seconds: 90 581 command: | 582 sudo curl --retry 3 --retry-all-errors https://s3.amazonaws.com/ossci-macos/sccache_v2.15 --output /usr/local/bin/sccache 583 sudo chmod +x /usr/local/bin/sccache 584 echo "SCCACHE_BUCKET=ossci-compiler-cache-circleci-v2" >> "${GITHUB_ENV}" 585 - name: Populate binary env 586 run: | 587 # shellcheck disable=SC1091 588 source "${RUNNER_TEMP}/anaconda/bin/activate" 589 "${PYTORCH_ROOT}/.circleci/scripts/binary_populate_env.sh" 590 - name: Build PyTorch binary 591 run: | 592 # shellcheck disable=SC1091 593 source "${RUNNER_TEMP}/anaconda/bin/activate" 594 "${PYTORCH_ROOT}/.circleci/scripts/binary_macos_build.sh" 595 - uses: actions/upload-artifact@v3 596 if: always() 597 with: 598 name: wheel-py3_12-cpu 599 retention-days: 14 600 if-no-files-found: error 601 path: "${{ env.PYTORCH_FINAL_PACKAGE_DIR }}" 602 wheel-py3_12-cpu-upload: # Uploading 603 if: ${{ github.repository_owner == 'pytorch' }} 604 permissions: 605 id-token: write 606 contents: read 607 needs: wheel-py3_12-cpu-build 608 with: 609 PYTORCH_ROOT: /pytorch 610 BUILDER_ROOT: /builder 611 PACKAGE_TYPE: wheel 612 # TODO: This is a legacy variable that we eventually want to get rid of in 613 # favor of GPU_ARCH_VERSION 614 DESIRED_CUDA: cpu 615 GPU_ARCH_TYPE: cpu 616 DOCKER_IMAGE: pytorch/manylinux-builder:cpu-2.4 617 DESIRED_PYTHON: "3.12" 618 build_name: wheel-py3_12-cpu 619 use_s3: False 620 secrets: 621 github-token: ${{ secrets.GITHUB_TOKEN }} 622 conda-pytorchbot-token: ${{ secrets.CONDA_PYTORCHBOT_TOKEN }} 623 conda-pytorchbot-token-test: ${{ secrets.CONDA_PYTORCHBOT_TOKEN_TEST }} 624 uses: ./.github/workflows/_binary-upload.yml 625