# How does JuMP.jl (Gurobi solver) take full advantage of the performance of multi-core CPUs

**URL:** <https://discourse.julialang.org/t/how-does-jump-jl-gurobi-solver-take-full-advantage-of-the-performance-of-multi-core-cpus/69103>\
**Category:** Optimization (Mathematical)\
**Tags:** question, jump\
**Created:** [October 2, 2021, 9:20am UTC](https://discourse.julialang.org/t/how-does-jump-jl-gurobi-solver-take-full-advantage-of-the-performance-of-multi-core-cpus/69103 "2021-10-02T09:20:43Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![iiitr](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/iiitr/32/24586_2.png) [@iiitr](https://discourse.julialang.org/u/iiitr)\
**Post date:** [October 2, 2021, 9:20am UTC](https://discourse.julialang.org/t/how-does-jump-jl-gurobi-solver-take-full-advantage-of-the-performance-of-multi-core-cpus/69103/1 "2021-10-02T09:20:43Z")

</div>

Hi all,

In the past, I usually used Yalmip to complete the modeling of mathematical optimization. When I construct a large-scale mixed integer linear programming, I don’t need any additional settings, and Gurobi can always make full use of the performance of CPU.

However, now I use JuMP.jl for modeling. Although I enjoy the acceleration brought by Julia/JuMP in model construction, I find that Gurobi cannot make full use of CPU performance when solving. I check through the task manager of windows. The highest CPU utilization is only 45%, and the solution is still in progress. MIPGap is still far from my expected setting.

How do I need to set up to make full use of my CPU performance?

Incidentally, I use vscode to write code. When executing the code, it is copied into Julia REPL.

Thank you very much!

 ![无标题_看图王](https://global.discourse-cdn.com/julialang/original/3X/0/f/0fa1d4a7d09bba2879a44495410da4e12cd416dc.png)

---

<div class="post-metadata">

**Author:** ![NiclasMattsson](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/niclasmattsson/32/21988_2.png) [@NiclasMattsson](https://discourse.julialang.org/u/NiclasMattsson)\
**Post date:** [October 2, 2021, 9:59am UTC](https://discourse.julialang.org/t/how-does-jump-jl-gurobi-solver-take-full-advantage-of-the-performance-of-multi-core-cpus/69103/2 "2021-10-02T09:59:27Z")

</div>

You need to tell Gurobi to use more threads:

```julia
using JuMP, Gurobi

model = Model(Gurobi.Optimizer)
set_optimizer_attribute(model, "Threads", 12)

```

Try 12 threads to max out your CPU, or a lower value to reserve some capacity for your computer to do other things. Don’t expect much benefit from going higher than 6 (the number of cores in your CPU).

---

<div class="post-metadata">

**Author:** ![iiitr](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/iiitr/32/24586_2.png) [@iiitr](https://discourse.julialang.org/u/iiitr)\
**Post date:** [October 2, 2021, 11:07am UTC](https://discourse.julialang.org/t/how-does-jump-jl-gurobi-solver-take-full-advantage-of-the-performance-of-multi-core-cpus/69103/3 "2021-10-02T11:07:24Z")

</div>

Thank you very much for your reply. Your suggestion is effective!
