# Multi-core parallel support for JuMP supported solvers?

**URL:** <https://discourse.julialang.org/t/multi-core-parallel-support-for-jump-supported-solvers/112392>\
**Category:** Optimization (Mathematical)\
**Tags:** question, jump, parallel, nonlinear\
**Created:** [April 2, 2024, 12:24am UTC](https://discourse.julialang.org/t/multi-core-parallel-support-for-jump-supported-solvers/112392 "2024-04-02T00:24:09Z")\
**Posts on this page:** 1\
**Showing post:** 16

<div class="post-metadata">

**Author:** ![abulak](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/abulak/32/28314_2.png) [@abulak](https://discourse.julialang.org/u/abulak)\
**Post date:** [April 10, 2024, 10:54pm UTC](https://discourse.julialang.org/t/multi-core-parallel-support-for-jump-supported-solvers/112392/16 "2024-04-10T22:54:05Z")

</div>

@charshaw I modified the script a bit to run mwe twice; here are my results of `@time optimize!` within:

```bash
for n in {1..8} do                
OMP_NUM_THREADS=$n julia using_JuMP_multithreading.jl;

```

I fixed `n = 450`;

passing

```julia
scs_opt = optimizer_with_attributes(
    SCS.Optimizer,
    "linear_solver"=>SCS.MKLDirectSolver,
    "eps_abs"=>1e-8, # to increase the iteration count
    "verbose"=>false,
)

```

to `mwe_program` I get

```julia
Creating the problem instance... n = 450, OMP_NUM_THREADS = 1
  7.061236 seconds (1.04 k allocations: 90.613 MiB)

Creating the problem instance... n = 450, OMP_NUM_THREADS = 2
  5.475805 seconds (1.04 k allocations: 90.613 MiB)

Creating the problem instance... n = 450, OMP_NUM_THREADS = 3
  5.021955 seconds (1.04 k allocations: 90.613 MiB)

Creating the problem instance... n = 450, OMP_NUM_THREADS = 4
  4.565751 seconds (1.04 k allocations: 90.613 MiB)

Creating the problem instance... n = 450, OMP_NUM_THREADS = 5
  4.389557 seconds (1.04 k allocations: 90.613 MiB)

Creating the problem instance... n = 450, OMP_NUM_THREADS = 6
  4.413405 seconds (1.04 k allocations: 90.613 MiB)

Creating the problem instance... n = 450, OMP_NUM_THREADS = 7
  4.360352 seconds (1.04 k allocations: 90.613 MiB)

Creating the problem instance... n = 450, OMP_NUM_THREADS = 8
  4.339999 seconds (1.04 k allocations: 90.613 MiB)

```

so about 1.6 faster leveling around 4-5 threads. This comes from the following two lines: [Code search results · GitHub](https://github.com/search?q=repo%3Acvxgrp%2Fscs+%22%23pragma+omp%22&type=code)

So either

- you have plenty of psd constraints and project in parallel (mwe has only one), or
- the (sparse CSC) matrix `A` defining the problem has enough density so that parallelizing `A'x` over its columns is beneficial.

* * *

Note: I don’t observe the same scaling with `SCS.DirectSolver`, solve time stays around `7`s.

---

_[View the full topic](https://discourse.julialang.org/t/multi-core-parallel-support-for-jump-supported-solvers/112392)._
