Skip to content
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

Try to build CUDA wheels #106

Closed
wants to merge 238 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
238 commits
Select commit Hold shift + click to select a range
faa582d
Try to build CUDA wheels
frostedoyster Feb 12, 2024
52aea84
Try again
frostedoyster Feb 12, 2024
72e4fec
Try yet another version
frostedoyster Feb 12, 2024
c52e0d0
Typo
frostedoyster Feb 12, 2024
2dee430
Try with miniconda
frostedoyster Feb 13, 2024
90d1691
Debug
frostedoyster Feb 13, 2024
a614ea2
Debug
frostedoyster Feb 13, 2024
3d8899d
Debug
frostedoyster Feb 13, 2024
6cc261c
Back to cibw
frostedoyster Feb 13, 2024
b679bb2
Try again?
frostedoyster Feb 13, 2024
00a045a
Extract setup into its own file
frostedoyster Feb 13, 2024
f5aa849
Test torch 2.1.0
frostedoyster Feb 13, 2024
bd29242
Debug
frostedoyster Feb 13, 2024
de679c0
Debug
frostedoyster Feb 13, 2024
47544b1
Debug
frostedoyster Feb 13, 2024
194acac
Debug
frostedoyster Feb 13, 2024
5af3030
Debug
frostedoyster Feb 13, 2024
e7f0b28
debug
frostedoyster Feb 13, 2024
3a5bb19
debug
frostedoyster Feb 13, 2024
fb56feb
debug
frostedoyster Feb 13, 2024
b6ffd8b
debug
frostedoyster Feb 13, 2024
6eab11b
debug
frostedoyster Feb 13, 2024
d423094
Run set-up script?
frostedoyster Feb 13, 2024
347910f
Free disk space
frostedoyster Feb 13, 2024
4836d45
Only python 3.11
frostedoyster Feb 13, 2024
76c745e
Try again
frostedoyster Feb 13, 2024
23312f9
Print where it fails
frostedoyster Feb 13, 2024
5540e6b
Find nvcc
frostedoyster Feb 13, 2024
3e2237c
Find the CUDA compiler everywhere
frostedoyster Feb 13, 2024
cf3b46f
Found.
frostedoyster Feb 13, 2024
ed4995f
Debug
frostedoyster Feb 13, 2024
e346ac8
Try with architectures
frostedoyster Feb 13, 2024
de1a880
Obey nvcc's orders
frostedoyster Feb 13, 2024
958e30c
Debug
frostedoyster Feb 13, 2024
31665af
Try again
frostedoyster Feb 13, 2024
a1961df
Debug
frostedoyster Feb 13, 2024
0d43033
Set CUDA compiler explicitly
frostedoyster Feb 13, 2024
f499acc
Try again
frostedoyster Feb 13, 2024
4080c74
Try installing full cuda toolkit
frostedoyster Feb 13, 2024
9220348
Set torch cuda architectures
frostedoyster Feb 13, 2024
e2f12e8
Add one more exclude
frostedoyster Feb 13, 2024
a76a784
Exclude more
frostedoyster Feb 13, 2024
1f6018c
Build multiple Python versions
frostedoyster Feb 14, 2024
2a3a8bb
Build for multiple CUDA versions
frostedoyster Feb 14, 2024
e484c6e
Try "all" architectures
frostedoyster Feb 14, 2024
4eaf83a
Try All instead of all for torch
frostedoyster Feb 14, 2024
2954252
Remove comma bug after cp311
frostedoyster Feb 14, 2024
248094f
Custom build backend to pin torch+cuda version
frostedoyster Feb 14, 2024
d6c896a
Try again
frostedoyster Feb 14, 2024
60b393f
Try with a new dependency?
frostedoyster Feb 14, 2024
3967c79
Try to get backend.py copied inside docker environmet
frostedoyster Feb 14, 2024
6cbbfb1
Try again
frostedoyster Feb 14, 2024
4d9c9a5
Fix bug
frostedoyster Feb 14, 2024
db72817
Try again
frostedoyster Feb 14, 2024
4f1d087
Make it work
frostedoyster Feb 14, 2024
772530a
Try again
frostedoyster Feb 14, 2024
c4b2434
Debug
frostedoyster Feb 14, 2024
de8770b
Try again
frostedoyster Feb 14, 2024
484fefb
Debug
frostedoyster Feb 14, 2024
508351b
Debug
frostedoyster Feb 14, 2024
e514149
???
frostedoyster Feb 14, 2024
61ecc74
Try again
frostedoyster Feb 14, 2024
a9edab7
Try again
frostedoyster Feb 14, 2024
165d583
More bugs
frostedoyster Feb 14, 2024
b12db15
More torch versions
frostedoyster Feb 14, 2024
5c26471
Debug
frostedoyster Feb 14, 2024
912187e
Bug?
frostedoyster Feb 14, 2024
b0c1f20
Do not run on pwsh
frostedoyster Feb 14, 2024
c79908a
Debug
frostedoyster Feb 14, 2024
92bc818
Try again
frostedoyster Feb 14, 2024
3ab255d
??
frostedoyster Feb 14, 2024
1568d77
1.13.0 does not support cuda 11.8?
frostedoyster Feb 14, 2024
f81b3db
Take out torch 1.13
frostedoyster Feb 14, 2024
276ecf6
Try to exclude Python 3.12 from torch 2.0 and 2.1
frostedoyster Mar 26, 2024
a94ec4f
Merge branch 'main' into cuda-wheels
frostedoyster Mar 28, 2024
db46abf
Merge branch 'main' into cuda-wheels
nickjbrowning Nov 1, 2024
59682f6
Merge branch 'main' into cuda-wheels
nickjbrowning Nov 1, 2024
a7a1f1e
update
nickjbrowning Nov 1, 2024
eb9c257
update
nickjbrowning Nov 1, 2024
2fa074e
update
nickjbrowning Nov 1, 2024
efe5e7f
stop cuda wheel actions.
nickjbrowning Nov 1, 2024
0939da0
aarch64 update
nickjbrowning Nov 1, 2024
25a905d
added dockerfiles
nickjbrowning Nov 1, 2024
b38974e
path change
nickjbrowning Nov 1, 2024
9a7bb6a
docker file updates
nickjbrowning Nov 1, 2024
d4083fe
dockerfile update.
nickjbrowning Nov 1, 2024
b7d49fc
x
nickjbrowning Nov 1, 2024
01ccc37
dockerfile updates
nickjbrowning Nov 1, 2024
42cda7f
dockerfile updates
nickjbrowning Nov 1, 2024
26110ca
docker file updates
nickjbrowning Nov 1, 2024
0438400
QEMU
nickjbrowning Nov 1, 2024
0a787dc
update.
nickjbrowning Nov 1, 2024
3aab1b8
update
nickjbrowning Nov 1, 2024
6fa992e
update only use 2.4 for now.
nickjbrowning Nov 1, 2024
364e13f
disable unecessary cibw script.
nickjbrowning Nov 1, 2024
2647254
pip index url.
nickjbrowning Nov 1, 2024
22808b3
debug
nickjbrowning Nov 1, 2024
cb7b3e2
try no isolation
nickjbrowning Nov 1, 2024
21da7f1
added deps
nickjbrowning Nov 1, 2024
bcef36d
x
nickjbrowning Nov 1, 2024
f6c1fe5
test
nickjbrowning Nov 1, 2024
8db9115
retry
nickjbrowning Nov 3, 2024
3f2eafa
swapped to nightly.
nickjbrowning Nov 4, 2024
4ab5734
update to aarch64
nickjbrowning Nov 4, 2024
de1e330
test + linting
nickjbrowning Nov 4, 2024
5615f36
test
nickjbrowning Nov 4, 2024
74fb5e7
x
nickjbrowning Nov 4, 2024
e4f2b6f
test
nickjbrowning Nov 4, 2024
4955a48
test
nickjbrowning Nov 4, 2024
5e2daf5
test
nickjbrowning Nov 4, 2024
5b8856c
test
nickjbrowning Nov 15, 2024
8487603
moved away from nightly.
nickjbrowning Nov 15, 2024
5612be8
backtrack to 2.4.1
nickjbrowning Nov 15, 2024
7d4f43b
adjustments
nickjbrowning Nov 15, 2024
052d434
revert
nickjbrowning Nov 15, 2024
8de8169
small updates
nickjbrowning Nov 15, 2024
bdf55a9
changed how pytorch is installed
nickjbrowning Nov 15, 2024
201db81
removed sphericart wheel build.
nickjbrowning Nov 15, 2024
dd80dec
updated build backend
nickjbrowning Nov 15, 2024
3abd603
added setup tools
nickjbrowning Nov 15, 2024
0136bd7
added some print statments
nickjbrowning Nov 15, 2024
395da79
added torch version print
nickjbrowning Nov 15, 2024
f96fb0d
shuffle build-backend
nickjbrowning Nov 15, 2024
cdfc7bc
test
nickjbrowning Nov 15, 2024
f5c99e8
changed to before_all
nickjbrowning Nov 15, 2024
b18a95c
remove versioning requirement
nickjbrowning Nov 16, 2024
02e7ec6
update build-system
nickjbrowning Nov 16, 2024
f4eac49
removed build, changed PIP_EXTRA_INDEX
nickjbrowning Nov 16, 2024
8a3437e
removed |
nickjbrowning Nov 16, 2024
1f05b8e
typo.
nickjbrowning Nov 16, 2024
6f32cc2
updated backend.py
nickjbrowning Nov 16, 2024
b8b1cd7
removed CIBW_BEFORE_ALL
nickjbrowning Nov 16, 2024
381990e
print debug
nickjbrowning Nov 16, 2024
c6e6678
fixed build-backend
nickjbrowning Nov 16, 2024
cc79ddd
debug print pytorch version from cmakelist.
nickjbrowning Nov 16, 2024
9bbc797
added cibw-python
nickjbrowning Nov 16, 2024
9fccacb
not sure if stream guard is needed.
nickjbrowning Nov 17, 2024
7f1bd93
forgot one.
nickjbrowning Nov 17, 2024
8404ccd
added CUDAToolkit_INCLUDE_DIRS to cmakelist
nickjbrowning Nov 17, 2024
af044b9
added DL libs
nickjbrowning Nov 17, 2024
cc41d19
added TORCH_INCLUDE_DIRS
nickjbrowning Nov 17, 2024
316e818
added cu specifier to SPHERICART_TORCH_BUILD_WITH_TORCH_VERSION
nickjbrowning Nov 17, 2024
29a5a63
try this?
nickjbrowning Nov 17, 2024
b16ee48
rebuild with original torch spec.
nickjbrowning Nov 17, 2024
58c0ed6
x
nickjbrowning Nov 17, 2024
c8bd01b
test
nickjbrowning Nov 17, 2024
bcd611f
fixed build with cpu torch
nickjbrowning Nov 17, 2024
5d103d2
update latest
nickjbrowning Nov 18, 2024
47b7471
removed build messages.
nickjbrowning Nov 18, 2024
f86c6fb
formatting.
nickjbrowning Nov 18, 2024
e3a38ee
removed merge-torch-wheels for now.
nickjbrowning Nov 18, 2024
2ed8d14
added CUDAToolkit_INCLUDE_DIRS
nickjbrowning Nov 18, 2024
18c4c83
added print statement for CMAKE_CUDA_TOOLKIT_INCLUDE_DIRECTORIES
nickjbrowning Nov 18, 2024
37f3d1c
add target_compile_definitions
nickjbrowning Nov 18, 2024
6acbbb4
changed to PUBLIC
nickjbrowning Nov 18, 2024
b3c57f3
change C10_CUDA_NO_CMAKE_CONFIGURE_FILE to PRIVATE
nickjbrowning Nov 18, 2024
4a3418c
updates to docker and cibuildwheels calls.
nickjbrowning Dec 2, 2024
8b34def
tmp fix to enable docker to find remove script.
nickjbrowning Dec 2, 2024
4026bc4
lets try aarch64...
nickjbrowning Dec 2, 2024
8fcd1a1
build matrix update for aarch64
nickjbrowning Dec 2, 2024
ac93fa1
x
nickjbrowning Dec 2, 2024
0099796
env update.
nickjbrowning Dec 2, 2024
0edc8b6
updated aarch64 dockerfile.
nickjbrowning Dec 2, 2024
0357482
try again.
nickjbrowning Dec 2, 2024
8a5f2f7
fixes.
nickjbrowning Dec 2, 2024
b28653c
copy removed_unused_python.
nickjbrowning Dec 2, 2024
92aad85
removed prints.
nickjbrowning Dec 2, 2024
892217c
remove aarch64.
nickjbrowning Dec 2, 2024
6af1ed1
try to force the torch build.
nickjbrowning Dec 2, 2024
9b8abb5
test
nickjbrowning Dec 2, 2024
d69de58
test
nickjbrowning Dec 2, 2024
a8b7766
undo
nickjbrowning Dec 2, 2024
1d839d8
try explicitly command line.
nickjbrowning Dec 2, 2024
1886b38
turn off arch_native.
nickjbrowning Dec 2, 2024
313926e
lets try aarch64 again.
nickjbrowning Dec 2, 2024
fb67e95
re-add qemu
nickjbrowning Dec 2, 2024
8c69988
qemu update
nickjbrowning Dec 2, 2024
d282955
git unused.
nickjbrowning Dec 2, 2024
f6ebbbb
disable wheels.
nickjbrowning Dec 2, 2024
eea95e0
jax updates.
nickjbrowning Dec 2, 2024
690bcbb
add artifact upload.
nickjbrowning Dec 2, 2024
53e89d4
bug fix.
nickjbrowning Dec 2, 2024
d93ec56
try jax
nickjbrowning Dec 2, 2024
164acce
aded pybind11
nickjbrowning Dec 2, 2024
16d0ad2
added ALL CUDA architecture.
nickjbrowning Dec 2, 2024
1bc8d22
force a retrigger
nickjbrowning Dec 2, 2024
11750c0
some fixes for jax.
nickjbrowning Dec 2, 2024
570e756
removed double enableCuda
nickjbrowning Dec 2, 2024
9a7cd5f
updated cmake requirements
nickjbrowning Dec 2, 2024
059c299
Update .github/workflows/build-torch-wheels.yml
frostedoyster Dec 8, 2024
27cd6ba
Update .github/workflows/build-torch-wheels.yml
frostedoyster Dec 8, 2024
c5ac8ae
Clean up and install build dependencies
frostedoyster Dec 8, 2024
6964f37
Build dependencies
frostedoyster Dec 8, 2024
7ad957b
Remove useless python installation?
frostedoyster Dec 8, 2024
4f2d8a8
Merge wheels
frostedoyster Dec 8, 2024
ad933be
x
nickjbrowning Dec 9, 2024
e730c6c
modify puproject.
nickjbrowning Dec 9, 2024
526bd54
latest stable pytorch version.
nickjbrowning Dec 9, 2024
e236c83
mistake
nickjbrowning Dec 9, 2024
12619bd
formatting and typos.
nickjbrowning Dec 9, 2024
eb761c2
x
nickjbrowning Dec 9, 2024
0583a4f
fix for multilib.
nickjbrowning Dec 9, 2024
1ee23e8
fixes to loading.
nickjbrowning Dec 9, 2024
9ec5e15
formatting.
nickjbrowning Dec 9, 2024
af83505
fixed dynamic_cuda.
nickjbrowning Dec 9, 2024
ae59cee
reverted back to nifty counter.
nickjbrowning Dec 9, 2024
cd8bffc
update to universal_wheels.
nickjbrowning Dec 9, 2024
7ddea63
removed jax bdistwheel overide.
nickjbrowning Dec 9, 2024
0943ad7
format.
nickjbrowning Dec 9, 2024
3becf46
updated jax wheel build
nickjbrowning Dec 9, 2024
4821ec4
Update .github/workflows/build-jax-wheels.yml
nickjbrowning Dec 16, 2024
fff4578
Update sphericart-jax/CMakeLists.txt
nickjbrowning Dec 16, 2024
fe3232c
Update .github/workflows/build-torch-wheels.yml
nickjbrowning Dec 16, 2024
bfb3634
fix to guillaumes change.
nickjbrowning Dec 16, 2024
dd8f57b
update for guillaumes suggestion.
nickjbrowning Dec 16, 2024
940c309
test remove-python script inside dockerfile.
nickjbrowning Dec 16, 2024
addfbd8
review updates.
nickjbrowning Dec 16, 2024
23b4671
dockerfile update.
nickjbrowning Dec 16, 2024
ef50c31
added the script back in.
nickjbrowning Dec 16, 2024
2d34ab4
added more torch versions.
nickjbrowning Dec 16, 2024
d634472
name update.
nickjbrowning Dec 16, 2024
8918923
update minimum torch to 2.4.1
nickjbrowning Dec 16, 2024
c39f4ed
removed cu version from args.
nickjbrowning Dec 16, 2024
1dd7a45
removed pip_extra_index_url
nickjbrowning Dec 16, 2024
209e7cd
added sphericart wheels
nickjbrowning Dec 17, 2024
a3664c9
removed cudaFree
nickjbrowning Dec 18, 2024
21d6793
added singleton pattern.
nickjbrowning Dec 18, 2024
08f9455
formatting.
nickjbrowning Dec 18, 2024
2e28a8f
added multiple python versions.
nickjbrowning Dec 18, 2024
97378d6
added bdist_wheel change.
nickjbrowning Dec 18, 2024
eef302b
dont need multiple python versions now.
nickjbrowning Dec 18, 2024
a51bc53
review updates
nickjbrowning Dec 18, 2024
6ff9637
removed pip upgrade
nickjbrowning Dec 18, 2024
56b8d7a
test removing the remove_unused_python script.
nickjbrowning Dec 18, 2024
bf3bb5c
removed unecessary scripts.
nickjbrowning Dec 18, 2024
3992b73
see if cu124 fixes jax error in daint ci.
nickjbrowning Dec 18, 2024
89d6d68
Try a more typical cibuildwheel setup (#156)
Luthaf Dec 22, 2024
eb0ce6c
Build sphericart wheels for macos (#157)
Luthaf Jan 10, 2025
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
63 changes: 63 additions & 0 deletions .github/workflows/build-jax-wheels.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
name: Build Jax Wheels

on:
push:
branches: [main]
tags: ["*"]
pull_request:
# Check all PR

concurrency:
group: jax-wheels-${{ github.ref }}
cancel-in-progress: ${{ github.ref != 'refs/heads/main' }}

jobs:
build-jax-wheels:
runs-on: ${{ matrix.os }}
strategy:
matrix:
python-version: ["39", "310", "311", "312", "313"]
arch: ["arm64", "x86_64"]
os: ["ubuntu-22.04", "macos-14"]
exclude:
# remove mismatched arch/os pairs
- {os: macos-14, arch: x86_64}
- {os: ubuntu-22.04, arch: arm64}

name: "Py${{matrix.python-version}} ${{matrix.os}} ${{matrix.arch}}"

steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Build custom manylinux Docker Image with CUDA
if: matrix.os == 'ubuntu-22.04'
run: |
docker build --no-cache \
-t sphericart_manylinux2014_"${{ matrix.arch }}" \
scripts/manylinux2014_"${{ matrix.arch }}"

- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.12"

- name: Install cibuildwheel
run: python -m pip install cibuildwheel

- name: Build jax wheels
run: python -m cibuildwheel ./sphericart-jax
env:
CIBW_BUILD_VERBOSITY: 1
CIBW_BUILD: "cp${{ matrix.python-version }}-*"
CIBW_SKIP: "*-musllinux*"
CIBW_ARCHS: "${{ matrix.arch }}"
CIBW_MANYLINUX_X86_64_IMAGE: sphericart_manylinux2014_x86_64
CIBW_ENVIRONMENT: >
SPHERICART_ARCH_NATIVE=OFF
SPHERICART_NO_LOCAL_DEPS=1

- uses: actions/upload-artifact@v4
with:
name: "sphericart-jax-py-${{ matrix.python-version }}-${{ matrix.os }}-${{ matrix.arch }}"
path: ./wheelhouse/*.whl
141 changes: 141 additions & 0 deletions .github/workflows/build-torch-wheels.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,141 @@
name: Build Torch Wheels

on:
push:
branches: [main]
tags: ["*"]
pull_request:
# Check all PR

concurrency:
group: torch-wheels-${{ github.ref }}
cancel-in-progress: ${{ github.ref != 'refs/heads/main' }}

jobs:
build-torch-wheels:
runs-on: ${{ matrix.os }}
strategy:
matrix:
pytorch-version: ["2.4", "2.5"]
arch: ["arm64", "x86_64"]
os: ["ubuntu-22.04", "macos-14"]
exclude:
# remove mismatched arch/os pairs
- {os: macos-14, arch: x86_64}
- {os: ubuntu-22.04, arch: arm64}

name: "Torch ${{matrix.pytorch-version}} ${{matrix.os}} ${{matrix.arch}}"

steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Build custom manylinux Docker Image with CUDA
if: matrix.os == 'ubuntu-22.04'
run: |
docker build --no-cache \
-t sphericart_manylinux2014_"${{ matrix.arch }}" \
scripts/manylinux2014_"${{ matrix.arch }}"

- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.12"

- name: Install cibuildwheel
run: python -m pip install cibuildwheel

- name: Build torch wheels
run: python -m cibuildwheel ./sphericart-torch
env:
CIBW_BUILD_VERBOSITY: 1
CIBW_BUILD: "cp312-*"
CIBW_SKIP: "*-musllinux*"
CIBW_ARCHS: "${{ matrix.arch }}"
CIBW_MANYLINUX_X86_64_IMAGE: sphericart_manylinux2014_x86_64
CIBW_REPAIR_WHEEL_COMMAND_LINUX: |
auditwheel repair \
--exclude libc10.so \
--exclude libtorch.so \
--exclude libtorch_cpu.so \
--exclude libtorch_cuda.so \
--exclude libc10_cuda.so \
-w {dest_dir} {wheel}
CIBW_REPAIR_WHEEL_COMMAND_MACOS: |
delocate-wheel --ignore-missing-dependencies \
--require-archs {delocate_archs} \
-w {dest_dir} -v {wheel}
CIBW_ENVIRONMENT: >
SPHERICART_ARCH_NATIVE=OFF
SPHERICART_NO_LOCAL_DEPS=1
TORCH_CUDA_ARCH_LIST="8.0 8.6 8.9 9.0"
SPHERICART_TORCH_BUILD_WITH_TORCH_VERSION=${{ matrix.pytorch-version }}.*

- uses: actions/upload-artifact@v4
with:
name: torch-single-version-wheel-${{ matrix.os }}-${{ matrix.arch }}-torch-${{ matrix.pytorch-version }}
path: ./wheelhouse/*.whl

merge-torch-wheels:
needs: build-torch-wheels
runs-on: ubuntu-22.04
name: merge wheels for ${{ matrix.name }}
strategy:
matrix:
include:
- name: x86_64 Linux
os: ubuntu-22.04
arch: x86_64
- name: arm64 macOS
os: macos-14
arch: arm64
steps:
- uses: actions/checkout@v4

- name: Download wheels
uses: actions/download-artifact@v4
with:
pattern: torch-single-version-wheel-${{ matrix.os }}-${{ matrix.arch }}-*
merge-multiple: false
path: dist

- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.12"

- name: install dependencies
run: python -m pip install twine wheel

- name: merge wheels
run: |
# collect all torch versions used for the build
REQUIRES_TORCH=$(find dist -name "*.whl" -exec unzip -p {} "sphericart_torch-*.dist-info/METADATA" \; | grep "Requires-Dist: torch")
MERGED_TORCH_REQUIRE=$(python scripts/create-torch-versions-range.py "$REQUIRES_TORCH")

echo MERGED_TORCH_REQUIRE=$MERGED_TORCH_REQUIRE

# unpack all single torch versions wheels in the same directory
mkdir dist/unpacked
find dist -name "*.whl" -print -exec python -m wheel unpack --dest dist/unpacked/ {} ';'

sed -i "s/Requires-Dist: torch.*/$MERGED_TORCH_REQUIRE/" dist/unpacked/sphericart_torch-*/sphericart_torch-*.dist-info/METADATA

echo "\n\n METADATA = \n\n"
cat dist/unpacked/sphericart_torch-*/sphericart_torch-*.dist-info/METADATA

# check the right metadata was added to the file. grep will exit with
# code `1` if the line is not found, which will stop CI
grep "$MERGED_TORCH_REQUIRE" dist/unpacked/sphericart_torch-*/sphericart_torch-*.dist-info/METADATA

# repack the directory as a new wheel
mkdir wheelhouse
python -m wheel pack --dest wheelhouse/ dist/unpacked/*

- name: check wheels with twine
run: twine check wheelhouse/*

- uses: actions/upload-artifact@v4
with:
name: sphericart-torch-wheel-${{ matrix.os }}-${{ matrix.arch }}
path: ./wheelhouse/*.whl
154 changes: 45 additions & 109 deletions .github/workflows/build-wheels.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Build Python wheels
Luthaf marked this conversation as resolved.
Show resolved Hide resolved
name: Build Wheels

on:
push:
Expand All @@ -7,124 +7,60 @@ on:
pull_request:
# Check all PR

env:
SPHERICART_NO_LOCAL_DEPS: "1"
MACOSX_DEPLOYMENT_TARGET: "11.0"
concurrency:
group: wheels-${{ github.ref }}
cancel-in-progress: ${{ github.ref != 'refs/heads/main' }}

jobs:
build-wheels:
runs-on: ${{ matrix.os }}
name: ${{ matrix.os }}
name: ${{matrix.name}}
strategy:
matrix:
# TODO: add windows builder
os: [ubuntu-20.04, macos-13]
include:
- name: x86_64 Linux
os: ubuntu-22.04
arch: x86_64
- name: x86_64 macOS
os: macos-13
arch: x86_64
- name: arm64 macOS
os: macos-14
arch: arm64

steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Checkout code
uses: actions/checkout@v4

- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: "3.12"
- name: Build custom manylinux Docker Image with CUDA
if: matrix.os == 'ubuntu-22.04'
run: |
docker build --no-cache \
-t sphericart_manylinux2014_"${{ matrix.arch }}" \
scripts/manylinux2014_"${{ matrix.arch }}"

- name: Install cibuildwheel
run: python -m pip install cibuildwheel build
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.12"

- name: Build sphericart wheels
run: |
# ensure we build the wheel from the sdist, not the checkout
python -m build --sdist . --outdir dist
python -m cibuildwheel dist/*.tar.gz --output-dir dist
env:
CIBW_BUILD_VERBOSITY: 3
# build wheels on CPython 3.12
CIBW_BUILD: cp312-*
# skip musl and 32-bit builds
CIBW_SKIP: "*-musllinux* *-win32 *-manylinux_i686"
# on macOS, build both Intel & Apple Silicon versions
CIBW_ARCHS_MACOS: x86_64 arm64
CIBW_MANYLINUX_X86_64_IMAGE: manylinux2014
# do not build wheels with -march=native
CIBW_ENVIRONMENT: SPHERICART_ARCH_NATIVE=OFF
- name: Install cibuildwheel
run: python -m pip install cibuildwheel

- name: Build sphericart-torch wheels
run: |
# ensure we build the wheel from the sdist, not the checkout
python -m build --sdist sphericart-torch --outdir sphericart-torch/dist
python -m cibuildwheel sphericart-torch/dist/*.tar.gz --output-dir sphericart-torch/dist
env:
CIBW_BUILD_VERBOSITY: 3
CIBW_BUILD: cp310-*
CIBW_SKIP: "*-musllinux* *-win32 *-manylinux_i686"
# we can not build wheels for macos-arm64, since the host is always
# x86_64, and we assume we can link against the host version of libtorch
CIBW_ARCHS_MACOS: x86_64
CIBW_MANYLINUX_X86_64_IMAGE: manylinux2014
# Use the CPU only version of torch when building/running the code
CIBW_ENVIRONMENT: SPHERICART_ARCH_NATIVE=OFF PIP_EXTRA_INDEX_URL=https://download.pytorch.org/whl/cpu
# do not complain for missing libtorch.so in sphericart-torch wheel
CIBW_REPAIR_WHEEL_COMMAND_MACOS: |
delocate-wheel --ignore-missing-dependencies --require-archs {delocate_archs} -w {dest_dir} -v {wheel}
CIBW_REPAIR_WHEEL_COMMAND_LINUX: |
auditwheel repair --exclude libtorch.so --exclude libtorch_cpu.so --exclude libc10.so -w {dest_dir} {wheel}
- name: Build wheels
run: python -m cibuildwheel .
env:
CIBW_BUILD_VERBOSITY: 1
CIBW_BUILD: "cp312-*"
CIBW_SKIP: "*-musllinux*"
CIBW_ARCHS: "${{ matrix.arch }}"
CIBW_MANYLINUX_X86_64_IMAGE: sphericart_manylinux2014_x86_64
CIBW_ENVIRONMENT: >
SPHERICART_ARCH_NATIVE=OFF
SPHERICART_NO_LOCAL_DEPS=1
MACOSX_DEPLOYMENT_TARGET=11.0

- name: Build sphericart-jax wheels
run: |
# ensure we build the wheel from the sdist, not the checkout
python -m build --sdist sphericart-jax --outdir sphericart-jax/dist
python -m cibuildwheel sphericart-jax/dist/*.tar.gz --output-dir sphericart-jax/dist
env:
CIBW_BUILD_VERBOSITY: 3
CIBW_BUILD: cp310-*
CIBW_SKIP: "*-musllinux* *-win32 *-manylinux_i686"
CIBW_MANYLINUX_X86_64_IMAGE: manylinux2014
CIBW_ENVIRONMENT: SPHERICART_ARCH_NATIVE=OFF

- uses: actions/upload-artifact@v3
with:
name: wheels
# only upload sphericart wheels, not sphericart-torch or sphericart-jax
path: dist/*.whl

- name: upload wheel to GitHub release
if: startsWith(github.ref, 'refs/tags/')
uses: softprops/action-gh-release@v1
with:
# only upload sphericart wheels, not sphericart-torch or sphericart-jax
files: dist/*.whl
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

build-sdist:
runs-on: ubuntu-20.04
name: sdist
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: "3.12"
- name: build sdist
run: |
python -m pip install build

python -m build --sdist . --outdir ./dist
python -m build --sdist sphericart-torch --outdir ./dist
python -m build --sdist sphericart-jax --outdir ./dist

- uses: actions/upload-artifact@v3
with:
name: wheels
path: dist/*.tar.gz
- name: upload sdist to GitHub release
if: startsWith(github.ref, 'refs/tags/')
uses: softprops/action-gh-release@v1
with:
files: dist/*.tar.gz
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- uses: actions/upload-artifact@v4
with:
name: sphericart-wheel-${{ matrix.os }}-${{ matrix.arch }}
path: ./wheelhouse/*.whl
4 changes: 4 additions & 0 deletions .github/workflows/docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@ on:
pull_request:
# Check all PR

concurrency:
group: docs-${{ github.ref }}
cancel-in-progress: ${{ github.ref != 'refs/heads/main' }}

jobs:
build-and-publish:
runs-on: ubuntu-20.04
Expand Down
Loading