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

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!

1 Like

You need to tell Gurobi to use more threads:

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).


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