Skip to content

Commit 7d62e53

Browse files
jeongseok-metameta-codesync[bot]
authored andcommitted
Enable PyPI publishing (#725)
Summary: This PR enables building wheel files for pymomentum and publishing to PyPI ([`pymomentum-gpu`](https://pypi.org/project/pymomentum-gpu/) and [`pymomentum-cpu`](https://pypi.org/project/pymomentum-cpu/)). * New PyPI workflow with CPU/GPU wheel builds * Template-based config system for platform-specific PyTorch versions * CI cost optimizations (concurrency control, Python 3.13 skipping) * Ubuntu CUDA 12.9.0 installer workaround * Disk space optimization for GPU builds * Comprehensive documentation added ## Checklist: - [x] Adheres to the [style guidelines](https://facebookresearch.github.io/momentum/docs/developer_guide/style_guide) - [x] Codebase formatted by running `pixi run lint` Pull Request resolved: #725 Test Plan: https://fb.workplace.com/groups/1222607168126483/permalink/2638230143230838/ * CI wheel builds (no publishing) * CI publish to PyPI on git tag * Local testing with pixi commands (e.g., `pixi run -e py313 build_pypi_wheel`) Reviewed By: yutingye Differential Revision: D85481027 Pulled By: jeongseok-meta fbshipit-source-id: 76cfa74ba47e22bebe3e2ef62abc1600883fff99
1 parent 79b7949 commit 7d62e53

File tree

16 files changed

+6383
-1525
lines changed

16 files changed

+6383
-1525
lines changed
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
name: 'Setup CUDA Toolkit'
2+
description: 'Install CUDA toolkit and configure Conda environment variables for pixi'
3+
4+
inputs:
5+
cuda-version:
6+
description: 'CUDA version to install (e.g., 12.9.0)'
7+
required: true
8+
9+
runs:
10+
using: 'composite'
11+
steps:
12+
- name: Install CUDA Toolkit (Windows only)
13+
# Skip Ubuntu due to CUDA 12.9.0 installer bug: boost::filesystem::copy_file error
14+
# For wheel builds, we only need CONDA_OVERRIDE_CUDA (PyTorch includes CUDA runtime)
15+
if: runner.os == 'Windows'
16+
uses: Jimver/[email protected]
17+
with:
18+
cuda: ${{ inputs.cuda-version }}
19+
20+
- name: Check CUDA Version (Windows only)
21+
if: runner.os == 'Windows'
22+
shell: bash
23+
run: |
24+
nvcc --version
25+
26+
- name: Set Conda environment variables
27+
shell: bash
28+
run: |
29+
CUDA_MAJOR=$(echo ${{ inputs.cuda-version }} | cut -d'.' -f1)
30+
echo "CONDA_OVERRIDE_CUDA=$CUDA_MAJOR" >> $GITHUB_ENV
31+
if [[ "$RUNNER_OS" == "Linux" ]]; then
32+
echo "Skipping CUDA installation on Ubuntu (using mock CUDA $CUDA_MAJOR for pixi)"
33+
fi

.github/workflows/ci_macos.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,10 @@ on:
1313
- "**/website/**"
1414
workflow_dispatch:
1515

16+
concurrency:
17+
group: ${{ github.workflow }}-${{ github.ref }}
18+
cancel-in-progress: true
19+
1620
jobs:
1721
momentum:
1822
# Enabled for minimal macOS platform coverage

.github/workflows/ci_ubuntu.yml

Lines changed: 9 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,10 @@ on:
1313
- "**/website/**"
1414
workflow_dispatch:
1515

16+
concurrency:
17+
group: ${{ github.workflow }}-${{ github.ref }}
18+
cancel-in-progress: true
19+
1620
jobs:
1721
momentum:
1822
name: cpp${{ matrix.simd == 'ON' && '-simd' || '' }}-${{ matrix.mode == '' && 'opt' || 'dev' }}-ubuntu
@@ -62,8 +66,8 @@ jobs:
6266
fail-fast: false
6367
matrix:
6468
include:
65-
- pixi_env: "cpu"
66-
- pixi_env: "gpu"
69+
- pixi_env: "py312"
70+
- pixi_env: "py312-cuda129"
6771
cuda_version: "12.9.0"
6872
env:
6973
FULL_CUDA_VERSION: ${{ matrix.cuda_version }}
@@ -82,23 +86,11 @@ jobs:
8286
- name: Checkout
8387
uses: actions/checkout@v5
8488

85-
- name: Install CUDA Toolkit
89+
- name: Setup CUDA
8690
if: ${{ contains(matrix.pixi_env, 'cuda') || contains(matrix.pixi_env, 'gpu') }}
87-
uses: Jimver/[email protected]
88-
id: cuda-toolkit
91+
uses: ./.github/actions/setup-cuda
8992
with:
90-
# Available versions: https://github.com/Jimver/cuda-toolkit/blob/v0.2.24/src/links/linux-links.ts
91-
cuda: ${{ matrix.cuda_version }}
92-
93-
- name: Check CUDA Version
94-
if: ${{ contains(matrix.pixi_env, 'cuda') || contains(matrix.pixi_env, 'gpu') }}
95-
run: |
96-
nvcc --version
97-
98-
- name: Set Conda environment variables
99-
if: ${{ contains(matrix.pixi_env, 'cuda') || contains(matrix.pixi_env, 'gpu') }}
100-
run: |
101-
echo "CONDA_OVERRIDE_CUDA=$(echo $FULL_CUDA_VERSION | cut -d'.' -f1)" >> $GITHUB_ENV
93+
cuda-version: ${{ matrix.cuda_version }}
10294

10395
- name: Set up pixi
10496
uses: prefix-dev/[email protected]

.github/workflows/ci_windows.yml

Lines changed: 9 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,10 @@ on:
1313
- "**/website/**"
1414
workflow_dispatch:
1515

16+
concurrency:
17+
group: ${{ github.workflow }}-${{ github.ref }}
18+
cancel-in-progress: true
19+
1620
jobs:
1721
momentum:
1822
if: false # Temporarily disabled to reduce CI cost
@@ -54,35 +58,21 @@ jobs:
5458
fail-fast: false
5559
matrix:
5660
include:
57-
- pixi_env: "cpu"
61+
- pixi_env: "py312"
5862
# GPU disabled to reduce CI cost
59-
# - pixi_env: "gpu"
63+
# - pixi_env: "py312-cuda129"
6064
# cuda_version: "12.9.0"
6165
env:
6266
FULL_CUDA_VERSION: ${{ matrix.cuda_version }}
6367
steps:
6468
- name: Checkout
6569
uses: actions/checkout@v5
6670

67-
- name: Install CUDA Toolkit
71+
- name: Setup CUDA
6872
if: ${{ contains(matrix.pixi_env, 'cuda') || contains(matrix.pixi_env, 'gpu') }}
69-
uses: Jimver/[email protected]
70-
id: cuda-toolkit
73+
uses: ./.github/actions/setup-cuda
7174
with:
72-
# Available versions: https://github.com/Jimver/cuda-toolkit/blob/v0.2.24/src/links/linux-links.ts
73-
cuda: ${{ matrix.cuda_version }}
74-
75-
- name: Check CUDA Version
76-
if: ${{ contains(matrix.pixi_env, 'cuda') || contains(matrix.pixi_env, 'gpu') }}
77-
run: |
78-
nvcc --version
79-
80-
- name: Set Conda environment variables
81-
if: ${{ contains(matrix.pixi_env, 'cuda') || contains(matrix.pixi_env, 'gpu') }}
82-
shell: pwsh
83-
run: |
84-
$majorVersion = $Env:FULL_CUDA_VERSION.Split('.')[0]
85-
"CONDA_OVERRIDE_CUDA=$majorVersion" | Out-File -FilePath $Env:GITHUB_ENV -Encoding utf8 -Append
75+
cuda-version: ${{ matrix.cuda_version }}
8676

8777
- name: Set up pixi
8878
uses: prefix-dev/[email protected]

0 commit comments

Comments
 (0)