Skip to content

Commit 25616a0

Browse files
authored
Add CI for Windows CUDA build (#3775)
1 parent 1d20ba3 commit 25616a0

26 files changed

Lines changed: 836 additions & 714 deletions

File tree

.github/actions/build-cuda-release/action.yml

Lines changed: 0 additions & 31 deletions
This file was deleted.

.github/actions/build-docs/action.yml

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -5,32 +5,36 @@ runs:
55
using: "composite"
66
steps:
77
- name: Setup machine
8-
uses: ./.github/actions/setup-linux
8+
id: setup
9+
uses: ./.github/actions/setup
10+
with:
11+
ccache-key: 'release'
12+
ccache-save: false
913

1014
- name: Install dependencies
1115
shell: bash
16+
env:
17+
CMAKE_ARGS: ${{ steps.setup.outputs.cmake-args }}
1218
run: |
1319
sudo apt-get install -y doxygen
14-
source .venv/bin/activate
15-
pip install -r docs/requirements.txt
16-
pip install . -v
17-
20+
uv pip install -r docs/requirements.txt
21+
uv pip install . -v
22+
1823
- name: Build documentation
1924
shell: bash
2025
run: |
21-
source .venv/bin/activate
2226
cd docs
2327
doxygen
2428
make html O=-W
25-
29+
2630
- name: Create artifact tar
2731
shell: bash
2832
run: tar -cf artifact.tar -C docs --dereference build/html index.html
2933

3034
# Do it manually because upload-pages-artifact requires gtar
3135
- name: Upload artifact
3236
id: upload-artifact
33-
uses: actions/upload-artifact@v5
37+
uses: actions/upload-artifact@v7
3438
with:
3539
name: github-pages
3640
path: artifact.tar

.github/actions/build-linux-release/action.yml

Lines changed: 0 additions & 42 deletions
This file was deleted.

.github/actions/build-linux/action.yml

Lines changed: 0 additions & 38 deletions
This file was deleted.

.github/actions/build-macos-release/action.yml

Lines changed: 0 additions & 63 deletions
This file was deleted.
Lines changed: 115 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,115 @@
1+
name: 'Build wheel'
2+
description: 'Build the Python wheels for release on all platforms'
3+
4+
inputs:
5+
cmake-args:
6+
description: 'The args for generating CMake project'
7+
required: true
8+
build-frontend:
9+
description: 'Build the frontend mlx package'
10+
required: false
11+
default: 'true'
12+
build-backend:
13+
description: 'Build the backend mlx-cpu/mlx-cuda/mlx-metal packages'
14+
required: false
15+
default: 'true'
16+
macos-target:
17+
description: 'The target macOS version to build for'
18+
required: false
19+
default: '26.2'
20+
arch-tag:
21+
description: 'Platform architecture tag'
22+
required: false
23+
default: |-
24+
${{ case(runner.arch == 'x64', 'x86_64',
25+
runner.arch == 'x86', 'i686',
26+
runner.arch == 'arm', 'armv7l',
27+
runner.arch == 'arm64', 'aarch64',
28+
'unknown')
29+
}}
30+
31+
runs:
32+
using: 'composite'
33+
steps:
34+
- name: Install dependencies
35+
shell: bash
36+
run: |
37+
echo "::group::Install dependencies"
38+
uv pip install 'build<=1.4.2' setuptools
39+
if ${{ runner.os == 'Linux' }} ; then
40+
uv pip install auditwheel patchelf
41+
fi
42+
mkdir -p wheelhouse
43+
echo "::endgroup::"
44+
45+
- name: Build frontend package
46+
if: inputs.build-frontend == 'true'
47+
shell: bash
48+
env:
49+
CMAKE_ARGS: ${{ inputs.cmake-args }}
50+
MACOSX_DEPLOYMENT_TARGET: ${{ inputs.macos-target }}
51+
run: |
52+
echo "::group::Build frontend package"
53+
python setup.py clean --all
54+
MLX_BUILD_STAGE=1 python -m build -w
55+
echo "::endgroup::"
56+
57+
- name: Post-process frontend package
58+
if: inputs.build-frontend == 'true'
59+
shell: bash
60+
run: |
61+
echo "::group::Post-process frontend package"
62+
if ${{ runner.os == 'Linux' }} ; then
63+
auditwheel repair dist/mlx-*.whl \
64+
--plat manylinux_2_35_${{ inputs.arch-tag }} \
65+
--exclude libmlx.so* \
66+
--only-plat
67+
else
68+
mv dist/mlx-*.whl wheelhouse/
69+
fi
70+
echo "::endgroup::"
71+
72+
- name: Build backend package
73+
if: inputs.build-backend == 'true'
74+
shell: bash
75+
env:
76+
CMAKE_ARGS: ${{ inputs.cmake-args }}
77+
MACOSX_DEPLOYMENT_TARGET: ${{ inputs.macos-target }}
78+
run: |
79+
echo "::group::Build backend package"
80+
python setup.py clean --all
81+
MLX_BUILD_STAGE=2 python -m build -w
82+
echo "::endgroup::"
83+
84+
- name: Post-process backend package
85+
if: inputs.build-backend == 'true'
86+
shell: bash
87+
run: |
88+
echo "::group::Post-process backend package"
89+
if ${{ runner.os == 'Linux' }} ; then
90+
if [ -f dist/mlx_cpu*.whl ]; then
91+
auditwheel repair dist/mlx_cpu*.whl \
92+
--plat manylinux_2_35_${{ inputs.arch-tag }}
93+
fi
94+
if [ -f dist/mlx_cuda*.whl ]; then
95+
auditwheel repair dist/mlx_cuda*.whl \
96+
--plat manylinux_2_35_${{ inputs.arch-tag }} \
97+
--exclude libcublas* \
98+
--exclude libcuda* \
99+
--exclude libcudnn* \
100+
--exclude libcufft* \
101+
--exclude libnccl* \
102+
--exclude libnvrtc*
103+
fi
104+
else
105+
if [ -f dist/mlx_cpu*.whl ]; then
106+
mv dist/mlx_cpu*.whl wheelhouse/
107+
fi
108+
if [ -f dist/mlx_cuda*.whl ]; then
109+
mv dist/mlx_cuda*.whl wheelhouse/
110+
fi
111+
if [ -f dist/mlx_metal*.whl ]; then
112+
mv dist/mlx_metal*.whl wheelhouse/
113+
fi
114+
fi
115+
echo "::endgroup::"

.github/actions/build-windows/action.yml

Lines changed: 0 additions & 26 deletions
This file was deleted.

0 commit comments

Comments
 (0)