|
| 1 | +name: Build and publish versioned monarch wheels |
| 2 | + |
| 3 | +on: |
| 4 | + workflow_dispatch |
| 5 | + |
| 6 | +concurrency: |
| 7 | + group: ${{ github.workflow }}-${{ github.ref == 'refs/heads/main' && github.run_number || github.ref }} |
| 8 | + cancel-in-progress: true |
| 9 | +jobs: |
| 10 | + build: |
| 11 | + name: cuda12.6-py${{ matrix.python-version }}-${{ matrix.name }} |
| 12 | + strategy: |
| 13 | + fail-fast: false # Changed to false to see results from all Python versions |
| 14 | + matrix: |
| 15 | + python-version: ["3.10", "3.11", "3.12", "3.13"] |
| 16 | + include: |
| 17 | + - name: 4xlarge |
| 18 | + runs-on: linux.g5.4xlarge.nvidia.gpu |
| 19 | + install-args: '--pre --extra-index-url https://download.pytorch.org/whl/cu126' |
| 20 | + gpu-arch-type: "cuda" |
| 21 | + gpu-arch-version: "12.6" |
| 22 | + uses: pytorch/test-infra/.github/workflows/linux_job_v2.yml@main |
| 23 | + with: |
| 24 | + timeout: 60 |
| 25 | + runner: ${{ matrix.runs-on }} |
| 26 | + gpu-arch-type: ${{ matrix.gpu-arch-type }} |
| 27 | + gpu-arch-version: ${{ matrix.gpu-arch-version }} |
| 28 | + submodules: recursive |
| 29 | + upload-artifact: monarch-${{ matrix.python-version }}-${{ matrix.gpu-arch-type }}${{ matrix.gpu-arch-version }} |
| 30 | + script: | |
| 31 | + source scripts/common-setup.sh |
| 32 | + setup_build_environment ${{ matrix.python-version }} "${{ matrix.install-args }}" |
| 33 | +
|
| 34 | + # Setup Tensor Engine dependencies |
| 35 | + setup_tensor_engine |
| 36 | +
|
| 37 | + cargo install --path monarch_hyperactor |
| 38 | +
|
| 39 | + # Build wheel |
| 40 | + export MONARCH_PACKAGE_NAME="torchmonarch" |
| 41 | + export MONARCH_VERSION=$(date +'%Y.%m.%d') |
| 42 | + export CUDA_LIB_DIR=/usr/lib64 |
| 43 | +
|
| 44 | + python setup.py bdist_wheel |
| 45 | +
|
| 46 | + # hacky until the right distribution wheel can be made... |
| 47 | + find dist -name "*linux_x86_64.whl" -type f -exec bash -c 'mv "$1" "${1/linux_x86_64.whl/manylinux2014_x86_64.whl}"' _ {} \; |
| 48 | + ls -la dist/ |
| 49 | +
|
| 50 | + # Run tests |
| 51 | + install_python_test_dependencies |
| 52 | + pip install dist/*.whl |
| 53 | + python -c "import monarch" |
| 54 | + publish: |
| 55 | + name: Publish to PyPI |
| 56 | + needs: build |
| 57 | + runs-on: ubuntu-latest |
| 58 | + if: ${{ github.event_name == 'schedule' || github.event_name == 'workflow_dispatch' }} |
| 59 | + permissions: |
| 60 | + id-token: write # Required for PyPI trusted publishing |
| 61 | + contents: read |
| 62 | + steps: |
| 63 | + - name: Download all artifacts |
| 64 | + uses: actions/download-artifact@v4 |
| 65 | + with: |
| 66 | + path: dist |
| 67 | + merge-multiple: true |
| 68 | + |
| 69 | + - name: Display structure of downloaded files |
| 70 | + run: ls -R dist/ |
| 71 | + |
| 72 | + - name: Publish to PyPI |
| 73 | + uses: pypa/gh-action-pypi-publish@release/v1 |
| 74 | + with: |
| 75 | + verbose: true |
0 commit comments