How to use parallel sover from Python?
mhechthz opened this issue · 7 comments
I use MiniZinc 2.5.5 on Windows 10 and want to use CBC with parallelization. I'm not sure if MiniZinc is compiled with parallel CBC. Setting environment variable OMP_NUM_THREADS doesn't work. I can not find any way to hand over something like "-threads 4" for instance.
I have a parallel CBC version on my computer. But how to use this instead of the build in version?
What would be the best way to activate parallel solving with Python and MiniZinc.
CBC (for windows non-parallel) is build into MiniZinc. To use Parallel CBC on windows you will have to recompile MiniZinc with the correct version of CBC and set this MiniZinc version to be used on the path.
See the instructions in the MiniZinc documentation: https://www.minizinc.org/doc-2.5.5/en/installation_detailed_windows.html#coin-or-cbc
(Note that the answer to the general question in the title is to set the processes
argument in the solve
method: https://minizinc-python.readthedocs.io/en/latest/api.html#minizinc.instance.Instance.solve, but this is only supported when supported by the solver)
Ok, so there is no chance to use the existing 'external' parallel CBC? I wanted to avoid to recompile because this usually doesn't work out of the box an produces long lasting pain ...
I cannot use Visual Studio, so is it possible to compile with MinGW?
And what about Gecode? Does it support parallelization?
MiniZinc currently does not have an interface for an external version of CBC.
Gecode does support multiple threads using the -p
flag. So do Gurobi and OR-Tools (and I think CPLEX does as well)
Ok, bad for CBC, but nevertheless we come closer to what I need. How can I activate multiple threads for Gecode when running from minizinc-python?
(Note that the answer to the general question in the title is to set the
processes
argument in thesolve
method: https://minizinc-python.readthedocs.io/en/latest/api.html#minizinc.instance.Instance.solve, but this is only supported when supported by the solver)
^^^^^
Oh, sorry and thank you. I totally missed this parameter.
So at least I can run problems in parallel using Gecode. And I hope someone will manage to provide a parallel CBC, since - according to the web - it seems to be quite difficult to compile a parallel CBC with MiniZinc on Windows (even if one can download parallel CBC stand-alone binaries for windows).
Thank you very much again!!!