Skip to content

[CI] Apple Silicon Support for TorchRL #1338

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 18 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .github/scripts/pre_build_script_m1.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#!/bin/bash

python3 -mpip install git+https://github.com/pytorch-labs/tensordict.git
42 changes: 42 additions & 0 deletions .github/workflows/build-wheels-m1.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
name: Build M1 Wheels

on:
pull_request:
push:
branches:
- nightly
- main
- release/*
tags:
# NOTE: Binary build pipelines should only get triggered on release candidate builds
# Release candidate tags look like: v1.11.0-rc1
- v[0-9]+.[0-9]+.[0-9]+-rc[0-9]+
workflow_dispatch:

jobs:
generate-matrix:
uses: pytorch/test-infra/.github/workflows/generate_binary_build_matrix.yml@main
with:
package-type: wheel
os: macos-arm64
test-infra-repository: pytorch/test-infra
test-infra-ref: main
build:
needs: generate-matrix
name: pytorch/rl
uses: pytorch/test-infra/.github/workflows/build_wheels_macos.yml@main
with:
repository: pytorch/rl
ref: ""
test-infra-repository: pytorch/test-infra
test-infra-ref: main
build-matrix: ${{ needs.generate-matrix.outputs.matrix }}
pre-script: .github/scripts/pre_build_script_m1.sh
post-script: ""
package-name: torchrl
runner-type: macos-m1-12
smoke-test-script: ""
trigger-event: ${{ github.event_name }}
secrets:
AWS_PYTORCH_UPLOADER_ACCESS_KEY_ID: ${{ secrets.AWS_PYTORCH_UPLOADER_ACCESS_KEY_ID }}
AWS_PYTORCH_UPLOADER_SECRET_ACCESS_KEY: ${{ secrets.AWS_PYTORCH_UPLOADER_SECRET_ACCESS_KEY }}
41 changes: 41 additions & 0 deletions .github/workflows/wheels.yml
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,47 @@ jobs:
name: torchrl-batch.whl
path: dist/*.whl

build-wheel-m1:
runs-on: macos-m1-12
strategy:
matrix:
python_version: [["3.8", "3.8"], ["3.9", "3.9"], ["3.10", "3.10.3"], ["3.11", "3.11"]]
steps:
- name: Checkout torchrl
uses: actions/checkout@v2
- uses: conda-incubator/setup-miniconda@v2
with:
python-version: ${{ matrix.python-version[1] }}
- name: Binary Build in Conda Environment
run: |
set -euxo pipefail
conda clean --all --quiet --yes
conda create \
--yes \
--quiet \
-n buildenv \
python=${{ matrix.python_version[1] }}

conda activate buildenv

# Install PyTorch RC
python3 -mpip install torch --extra-index-url https://download.pytorch.org/whl/cpu

# Build Wheel
export CC=clang CXX=clang++
python3 -mpip install wheel
BUILD_VERSION=0.1.1 python3 setup.py bdist_wheel
- name: Upload wheel for the test-wheel job
uses: actions/upload-artifact@v2
with:
name: torchrl-mac-${{ matrix.python_version[0] }}.whl
path: dist/torchrl-*.whl
- name: Upload wheel for download
uses: actions/upload-artifact@v2
with:
name: torchrl-batch.whl
path: dist/*.whl

build-wheel-windows:
runs-on: windows-latest
strategy:
Expand Down