Open ZedongPeng opened 1 year ago
I checked again. Multi threads are used when building pyomo
models. More exactly, this line.
module = import_module("unitcommit_200_100_2_mod_7")
How are you identifying that multiple threads are being used? While Pyomo does make use of multithreading to manage the console output from subprocess solves (particularly for tee=True
), there is nothing in the Pyomo code that should invoke multithreading while importing the model. Further, looking at top
on Linux, I don't see the python process exceeding 100% CPU (which again doesn't point to multithreading).
Summary
I am doing some benchmark tests with
MindtPy
. For the fairness of these benchmarks, I want to limit each benchmark test using only one thread. However, I found a weird situation in Pyomo. I can successfully pass thethreads
option to solvers likeCPLEX
and solvers will only use one thread. However, at the stage beforeCPLEX
solves the model. Multiple threads are used. Is there some magic stuff like generating LP inside Pyomo using multiple threads?Steps to reproduce the issue
module = import_module("unitcommit_200_100_2_mod_7") opt = SolverFactory('cplex') opt.options['threads'] = 1 results = opt.solve(module.m, tee=True) print(results)