-
Notifications
You must be signed in to change notification settings - Fork 2.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We��ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
SetNumThreads
has no effect on Gurobi?
#2815
Comments
Indeed. You should be able to work around by setting the solver specific parameter as string using the Gurobi names. |
Thanks for the quick reply! Just to make sure I understand, is it the case that |
For the benefit of future generations, the work-around mentioned above is to replace solver.SetNumThreads(4) with solver.SetSolverSpecificParametersAsString('Threads 4') I have confirmed that this works. Thanks, @lperron! |
For the record: up to v9.1 or-tools/ortools/linear_solver/gurobi_interface.cc Lines 68 to 69 in 86d4c54
Which is only use at instantiation (in the ctor) or-tools/ortools/linear_solver/gurobi_interface.cc Lines 617 to 618 in 86d4c54
While we should see (IMHO) something like in sat_interface.cc :
or-tools/ortools/linear_solver/sat_interface.cc Lines 294 to 297 in 86d4c54
or-tools/ortools/linear_solver/sat_interface.cc Lines 287 to 288 in 86d4c54
and then setup during the solve() call or-tools/ortools/linear_solver/sat_interface.cc Lines 142 to 143 in 86d4c54
|
What version of OR-Tools and what language are you using?
Version: v9.0.9048
Language: Python
Which solver are you using (e.g. CP-SAT, Routing Solver, GLOP, BOP, Gurobi)
Gurobi
What operating system (Linux, Windows, ...) and version?
macOS Big Sur v11.6
What did you do?
Steps to reproduce the behavior:
pip3 install ortools
MWE.py
. This script is very similar to the example shown here: https://developers.google.com/optimization/lp/lp_example. However, there are a few changes:python3 MWE.py
What did you expect to see
Thread count: 8 physical cores, 16 logical processors, using up to 4 threads
Thread count was 4 (of 16 available processors)
What did you see instead?
Thread count: 8 physical cores, 16 logical processors, using up to 16 threads
Thread count was 16 (of 16 available processors)
Anything else we should know about your project / environment
When I was initially trying to set up ortools to use Gurobi on this machine, I had some trouble getting ortools to find Gurobi. In my efforts to solve the problem, I installed a fresh copy of Gurobi from https://www.gurobi.com. I also manually set up the GUROBI_HOME variable in my .zshenv. I believe this is the reason that I see the following whenever I run the above code.
I'm not sure whether or not this is relevant.
The text was updated successfully, but these errors were encountered: