Skip to content

Commit 18307a7

Browse files
committed
Test building cuda wheels
1 parent 0d135c1 commit 18307a7

File tree

3 files changed

+101
-22
lines changed

3 files changed

+101
-22
lines changed

.github/workflows/build.yml

Lines changed: 46 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,36 +1,60 @@
1-
name: Build CUDA Linux
1+
# Taken from osqp-python
2+
3+
name: Build Wheels
24

35
on:
6+
# Triggers the workflow on push or pull request events
47
push:
58
branches:
6-
- master
7-
tags:
8-
- '*'
9+
- "*"
10+
- "*/*"
11+
- "**"
912
pull_request:
10-
branches:
11-
- master
13+
branches: [main]
1214

1315
jobs:
16+
build_sdist:
17+
name: Build source
18+
runs-on: ubuntu-latest
19+
strategy:
20+
fail-fast: false
21+
steps:
22+
- uses: actions/checkout@master
23+
with:
24+
submodules: "recursive"
25+
26+
- name: Build source and wheel
27+
run: |
28+
python -m pip install build
29+
python -m build --outdir=wheelhouse
30+
31+
- name: Upload sdist and wheel to github
32+
uses: actions/upload-artifact@v4
33+
with:
34+
name: wheels-sdist
35+
path: wheelhouse/*
36+
if-no-files-found: error
37+
1438
build_wheels:
15-
name: Build wheel on ${{ matrix.os }}
39+
name: Building wheels on ${{ matrix.os }}
1640
runs-on: ${{ matrix.os }}
1741
strategy:
1842
fail-fast: false
1943
matrix:
20-
os: [ubuntu-latest]
44+
os: [ubuntu-latest, macos-13, macos-latest, windows-latest]
2145

2246
steps:
23-
- uses: actions/checkout@master
24-
25-
- name: Build wheels
26-
uses: pypa/cibuildwheel@v2.23
27-
with:
28-
package-dir: backend/cuda
29-
config-file: backend/cuda/cibuildwheel.toml
30-
output-dir: wheelhouse
31-
32-
- name: Upload artifacts to github
33-
uses: actions/upload-artifact@v4
34-
with:
35-
name: wheels-cuda-${{ matrix.os }}
36-
path: ./wheelhouse
47+
- uses: actions/checkout@v4
48+
with:
49+
fetch-depth: 0
50+
submodules: true
51+
52+
- uses: pypa/cibuildwheel@v2.21
53+
env:
54+
CIBW_SKIP: "pp38-*"
55+
56+
- name: Upload wheels
57+
uses: actions/upload-artifact@v4
58+
with:
59+
name: cibw-wheels-${{ matrix.os }}
60+
path: wheelhouse/*.whl

.github/workflows/built_cuda.yml

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
# Taken from osqp-python
2+
3+
name: Build CUDA Linux
4+
5+
on:
6+
# Triggers the workflow on push or pull request events
7+
push:
8+
branches:
9+
- "*"
10+
- "*/*"
11+
- "**"
12+
pull_request:
13+
branches: [main]
14+
15+
jobs:
16+
build_wheels:
17+
name: Build wheel on ${{ matrix.os }}
18+
runs-on: ${{ matrix.os }}
19+
strategy:
20+
fail-fast: false
21+
matrix:
22+
os: [ubuntu-latest]
23+
24+
steps:
25+
- uses: actions/checkout@master
26+
27+
- name: Build wheels
28+
uses: pypa/cibuildwheel@v2.23
29+
with:
30+
package-dir: backend/cuda
31+
config-file: backend/cuda/cibuildwheel.toml
32+
output-dir: wheelhouse
33+
34+
- name: Upload artifacts to github
35+
uses: actions/upload-artifact@v4
36+
with:
37+
name: wheels-cuda-${{ matrix.os }}
38+
path: ./wheelhouse

backends/cuda/cibuildwheel.toml

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
[tool.cibuildwheel]
2+
build = "cp3*"
3+
skip = ["cp36-*", "cp37-*", "*-win32", "*-manylinux_i686", "*-musllinux_*"]
4+
build-verbosity = 1
5+
before-build = "rm -rf {package}/osqp_sources/build"
6+
repair-wheel-command = ""
7+
8+
[tool.cibuildwheel.linux]
9+
before-all = [
10+
"yum-config-manager --add-repo https://developer.download.nvidia.com/compute/cuda/repos/rhel9/x86_64/cuda-rhel9.repo",
11+
"yum search cuda-toolkit*",
12+
"yum install -y cuda-toolkit-12-6"
13+
]
14+
environment = { CMAKE_CUDA_COMPILER = "/usr/local/cuda-12.6/bin/nvcc" }
15+
16+
[tool.cibuildwheel.windows]
17+
environment = { CMAKE_CUDA_COMPILER = "C:/Program Files/NVIDIA GPU Computing Toolkit/CUDA/v12.6/bin/nvcc.exe", CUDA_TOOLKIT_ROOT_DIR = "C:/Program Files/NVIDIA GPU Computing Toolkit/CUDA/v12.6", CMAKE_GENERATOR_TOOLSET = "cuda=C:/Program Files/NVIDIA GPU Computing Toolkit/CUDA/v12.6" }

0 commit comments

Comments
 (0)