Skip to content

Commit 0af6796

Browse files
committed
Trying osqp-cu12 wheels
1 parent 6e8b452 commit 0af6796

File tree

11 files changed

+82
-134
lines changed

11 files changed

+82
-134
lines changed

.github/workflows/build_cuda.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: Build CUDA
1+
name: Build CUDA Linux
22

33
on:
44
push:

.github/workflows/build_cuda_windows.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: Build CUDA
1+
name: Build CUDA Windows
22

33
on:
44
push:
@@ -11,8 +11,8 @@ on:
1111
- master
1212

1313
env:
14-
CUDATOOLKIT_URL: https://developer.download.nvidia.com/compute/cuda/12.5.1/local_installers/cuda_12.5.1_555.85_windows.exe
15-
CUDATOOLKIT_COMPONENTS: nvcc_12.5 cudart_12.5 cublas_dev_12.5 curand_dev_12.5 cusparse_dev_12.5 thrust_12.5 visual_studio_integration_12.5
14+
CUDATOOLKIT_URL: https://developer.download.nvidia.com/compute/cuda/12.6.3/local_installers/cuda_12.6.3_561.17_windows.exe
15+
CUDATOOLKIT_COMPONENTS: nvcc_12.6 cudart_12.6 cublas_dev_12.6 curand_dev_12.6 cusparse_dev_12.6 thrust_12.6 visual_studio_integration_12.6
1616

1717
jobs:
1818
build_wheels:

.github/workflows/build_default.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ jobs:
7979

8080
publish_to_pypi:
8181
name: Publish wheels to PyPi
82-
if: github.event_name == 'push' && startsWith(github.event.ref, 'refs/tags')
82+
if: false
8383
needs: [build_sdist, build_wheels]
8484
runs-on: ubuntu-latest
8585
steps:

.github/workflows/build_mkl.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: Build MKL
1+
name: Build MKL Mac/Linux
22

33
on:
44
push:

.github/workflows/build_mkl_windows.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: Build MKL
1+
name: Build MKL Windows
22

33
on:
44
push:

.github/workflows/release.yml

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

backend/cuda/cibuildwheel.toml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,9 @@ repair-wheel-command = ""
88
[tool.cibuildwheel.linux]
99
before-all = [
1010
"yum-config-manager --add-repo https://developer.download.nvidia.com/compute/cuda/repos/rhel7/x86_64/cuda-rhel7.repo",
11-
"yum install -y cuda-toolkit-12-4"
11+
"yum install -y cuda-toolkit-12-6"
1212
]
13-
environment = { CMAKE_CUDA_COMPILER = "/usr/local/cuda-12.4/bin/nvcc" }
13+
environment = { CMAKE_CUDA_COMPILER = "/usr/local/cuda-12.6/bin/nvcc" }
1414

1515
[tool.cibuildwheel.windows]
16-
environment = { CMAKE_CUDA_COMPILER = "C:/Program Files/NVIDIA GPU Computing Toolkit/CUDA/v12.5/bin/nvcc.exe", CUDA_TOOLKIT_ROOT_DIR = "C:/Program Files/NVIDIA GPU Computing Toolkit/CUDA/v12.5", CMAKE_GENERATOR_TOOLSET = "cuda=C:/Program Files/NVIDIA GPU Computing Toolkit/CUDA/v12.5" }
16+
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" }

backend/cuda/pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ requires = ["scikit-build-core", "pybind11"]
33
build-backend = "scikit_build_core.build"
44

55
[project]
6-
name = "osqp-cuda"
6+
name = "osqp-cu12"
77
dynamic = ["version"]
88
description = "OSQP: The Operator Splitting QP Solver"
99
requires-python = ">=3.8"

examples/update_matrices.py

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
import osqp
2+
import numpy as np
3+
from scipy import sparse
4+
5+
if __name__ == '__main__':
6+
# Define problem data
7+
P = sparse.csc_matrix([[4, 1], [1, 2]])
8+
q = np.array([1, 1])
9+
A = sparse.csc_matrix([[1, 1], [1, 0], [0, 1]])
10+
l = np.array([1, 0, 0])
11+
u = np.array([1, 0.7, 0.7])
12+
13+
# Create an OSQP object
14+
prob = osqp.OSQP()
15+
16+
# Setup workspace
17+
prob.setup(P, q, A, l, u)
18+
19+
# Solve problem
20+
res = prob.solve()
21+
22+
# Update problem
23+
# IMPORTANT: The sparsity structure of P/A should remain the same,
24+
# so we only update Px and Ax
25+
# (i.e. the actual data values at indices with nonzero values)
26+
# NB: Update only upper triangular part of P
27+
P_new = sparse.csc_matrix([[5, 1.5], [1.5, 1]])
28+
A_new = sparse.csc_matrix([[1.2, 1.1], [1.5, 0], [0, 0.8]])
29+
prob.update(Px=sparse.triu(P_new).data, Ax=A_new.data)
30+
31+
# Solve updated problem
32+
res = prob.solve()
33+
34+
print('Status:', res.info.status)
35+
print('Objective value:', res.info.obj_val)
36+
print('Optimal solution x:', res.x)

examples/update_vectors.py

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
import osqp
2+
import numpy as np
3+
from scipy import sparse
4+
5+
if __name__ == '__main__':
6+
# Define problem data
7+
P = sparse.csc_matrix([[4, 1], [1, 2]])
8+
q = np.array([1, 1])
9+
A = sparse.csc_matrix([[1, 1], [1, 0], [0, 1]])
10+
l = np.array([1, 0, 0])
11+
u = np.array([1, 0.7, 0.7])
12+
13+
# Create an OSQP object
14+
prob = osqp.OSQP()
15+
16+
# Setup workspace
17+
prob.setup(P, q, A, l, u)
18+
19+
# Solve problem
20+
res = prob.solve()
21+
22+
# Update problem
23+
q_new = np.array([2, 3])
24+
l_new = np.array([2, -1, -1])
25+
u_new = np.array([2, 2.5, 2.5])
26+
prob.update(q=q_new, l=l_new, u=u_new)
27+
28+
# Solve updated problem
29+
res = prob.solve()
30+
31+
print('Status:', res.info.status)
32+
print('Objective value:', res.info.obj_val)
33+
print('Optimal solution x:', res.x)

0 commit comments

Comments
 (0)