5#ifndef PROXSUITE_PROXQP_PARALLEL_QPSOLVE_HPP
6#define PROXSUITE_PROXQP_PARALLEL_QPSOLVE_HPP
23 std::max((
size_t)(omp_get_max_threads() / 2),
26 NUM_THREADS = num_threads.value();
31 const long batch_size = long(qps.size());
33#pragma omp parallel for schedule(dynamic)
34 for (i = 0; i < batch_size; i++) {
35 qp_dense& qp = qps[i];
46 std::max((
size_t)(omp_get_max_threads() / 2), (
size_t)(1));
48 NUM_THREADS = num_threads.value();
53 const long batch_size = long(qps.
size());
55#pragma omp parallel for schedule(dynamic)
56 for (i = 0; i < batch_size; i++) {
57 qp_dense& qp = qps[i];
71 std::max((
size_t)(omp_get_max_threads() / 2 - 2), (
size_t)(1));
75 const Eigen::DenseIndex batch_size = qps.
size();
76 Eigen::DenseIndex i = 0;
77#pragma omp parallel for schedule(dynamic)
78 for (i = 0; i < batch_size; i++) {
79 qp_dense& qp = qps[i];
98 std::max((
size_t)(omp_get_max_threads() / 2 - 2), (
size_t)(1));
103 const Eigen::DenseIndex batch_size = qps.size();
104 Eigen::DenseIndex i = 0;
105#pragma omp parallel for schedule(dynamic)
106 for (i = 0; i < batch_size; i++) {
107 qp_dense& qp = qps[i];
108 dense::compute_backward<T>(qp, loss_derivatives[i], eps, rho_new, mu_new);
126 std::max((
size_t)(omp_get_max_threads() / 2 - 2), (
size_t)(1));
131 const Eigen::DenseIndex batch_size = qps.
size();
132 Eigen::DenseIndex i = 0;
133#pragma omp parallel for schedule(dynamic)
134 for (i = 0; i < batch_size; i++) {
135 qp_dense& qp = qps[i];
136 dense::compute_backward<T>(qp, loss_derivatives[i], eps, rho_new, mu_new);
142template<
typename T,
typename I>
148 std::max((
size_t)(omp_get_max_threads() / 2), (
size_t)(1));
150 NUM_THREADS = num_threads.value();
155 const Eigen::DenseIndex batch_size = qps.
size();
156 Eigen::DenseIndex i = 0;
157#pragma omp parallel for schedule(dynamic)
158 for (i = 0; i < batch_size; i++) {
159 qp_sparse& qp = qps[i];
164template<
typename T,
typename I>
170 std::max((
size_t)(omp_get_max_threads() / 2), (
size_t)(1));
172 NUM_THREADS = num_threads.value();
177 const Eigen::DenseIndex batch_size = qps.size();
178 Eigen::DenseIndex i = 0;
179#pragma omp parallel for schedule(dynamic)
180 for (i = 0; i < batch_size; i++) {
181 qp_sparse& qp = qps[i];
TL_OPTIONAL_11_CONSTEXPR T & value() &
void qp_solve_in_parallel(optional< const size_t > num_threads, proxqp::dense::BatchQP< T > &qps)
void qp_solve_backward_in_parallel(optional< const size_t > num_threads, std::vector< proxqp::dense::QP< T > > &qps, std::vector< proxqp::dense::Vec< T > > &loss_derivatives, T eps=1.E-4, T rho_new=1.E-6, T mu_new=1.E-6)
Eigen::Matrix< T, DYN, 1 > Vec
void solve_in_parallel(std::vector< proxqp::dense::QP< T > > &qps, const optional< size_t > num_threads=nullopt)
void solve_in_parallel(proxqp::sparse::BatchQP< T, I > &qps, const optional< size_t > num_threads=nullopt)
constexpr nullopt_t nullopt
void set_default_omp_options(const size_t num_threads=(size_t) omp_get_max_threads())
This class defines the API of PROXQP solver with sparse backend.