Pyomo + MPI => 1 environment per process
AnsweredHello,
I am using the third-party modeling framework, Pyomo, as well as MPI (mpi4py) to run several instances of Gurobi in parallel.
How can I have each process create its own environment?
Many thanks,
Jake
-
Unfortunately, it's not currently possible to explicitly manage Gurobi environments in Pyomo. There is an open issue in the Pyomo GitHub repository about this (Pyomo/pyomo#2408).
0 -
Hi Eli,
Is there a workaround to use multiprocessing with Pyomo to ensure that I won't have more than one thread within a single environment?
Thanks,
Jake
0 -
Do you mean that for each process, you would like to re-use a single environment for all models solved by that process? This would be the best way to limit your token usage. I believe Pyomo creates a new environment for each model. This would explain why you run out of tokens, as you mention in your other community post.
As far as I know, re-using a single environment like this isn't possible in Pyomo unless you modify Pyomo's source code yourself to support it. The other workaround is to build your model using Gurobi's native Python API.
0 -
Hi Eli,
I instead dispose of the environment. This is a fine solution, given the model isn't costly to build.
Thanks,
Jake
0
Please sign in to leave a comment.
Comments
4 comments