Skip to content

cuda OSQP examples #681

Oct 5, 2024 · 2 comments · 2 replies
Discussion options

You must be logged in to vote

@Eqedos - the repo osqp-benchmarks has a lot of sample problems. In particular, the Huber class of problems benefit from the CUDA backend, for higher dimensions of problems. See a benchmark graphic below (blue is built-in backend, orange is cuda backend):

A sample standalone script representing the Huber problem would be:

import numpy as np
import scipy.sparse as spa
from osqp import OSQP


class HuberExample:

    def __init__(self, n, seed=1):
        np.random.seed(seed)

        self.n = int(n)  # Number of features
        self.m = int(self.n * 100)  # Number of data-points

        self.Ad = spa.random(self.m, self.n, density=0.15, data_rvs=np.random.randn)
        self.x_true = np…

Replies: 2 comments 2 replies

Comment options

You must be logged in to vote
0 replies
Answer selected by Eqedos
Comment options

You must be logged in to vote
2 replies
@imciner2
Comment options

@Eqedos
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
3 participants