coin-or / SHOT

A solver for mixed-integer nonlinear optimization problems
https://shotsolver.dev
Eclipse Public License 2.0
117 stars 25 forks source link

Dual.MIP.NumberOfThreads ignored for Gurobi #160

Closed svigerske closed 1 year ago

svigerske commented 1 year ago

When I run with

Dual.MIP.Solver = 1
Dual.MIP.NumberOfThreads = 1

Gurobi still seems to use all available cores:

Gurobi Optimizer version 9.5.2 build v9.5.2rc0 (linux64)
Thread count: 4 physical cores, 8 logical processors, using up to 8 threads

PS: This is SHOT 033622c6 (current master)

andreaslundell commented 1 year ago

I cannot reproduce this unfortunately (at least when calling the SHOT executable directly). I get the following (with Dual.MIP.NumberOfThreads=1):

Thread count: 10 physical cores, 20 logical processors, using up to 1 threads

Did you call SHOT from GAMS?

svigerske commented 1 year ago

Yes.

andreaslundell commented 1 year ago

And it changes the threads if CPLEX is used, so it is just Gurobi that is the issue?

At least when I run SHOT directly with a gms-file as input directly it works using both an options file and passing options through the command line.

So I guess it must be something with reading the options-file. Can you send me the whole console output?

svigerske commented 1 year ago

With CPLEX, it looks good.

      | Parallel mode: none, using 1 thread. 

When SHOT is called from GAMS, Dual.MIP.NumberOfThreads is set via the API and not an options file: https://github.com/coin-or/SHOT/blob/master/src/ModelingSystem/ModelingSystemGAMS.cpp#L175

Might be until tomorrow that I can try to reproduce this. (My access to a proper Gurobi license is through ZIB, which is offline today.)

svigerske commented 1 year ago

OK. There seems to be something messed up with the headers on our side.

We have a gurobi_c++.h with the parameter enums as of Gurobi 9.1.1 and a public.h (included by Common.h) with the C++ API from Gurobi 9.5. When using the latter, the number of threads looks correct.