blubin / JOpt

A simple wrapper for linear and mixed integer program solvers
BSD 3-Clause "New" or "Revised" License
6 stars 1 forks source link

Make CPLEX deterministic mode the default #21

Open beyeler opened 4 years ago

beyeler commented 4 years ago

When diving into the deterministc mode and timeout of cplex I came across the following page: https://www.ibm.com/support/knowledgecenter/SSSA5P_12.8.0/ilog.odms.cplex.help/CPLEX/UsrMan/topics/parallel_optim/multi_threaded_parallel/07_determinism.html

There it says: In addition to the threads parameter, you can use the parallel mode switch (ParallelMode, CPX_PARAM_PARALLELMODE) to control the invocation of opportunistic algorithms. With its default setting of 0 (zero), only deterministic algorithms are used, unless the threads parameter is changed to a value strictly greater than one.

So when a Thread parameter is specified CPLEX might not work in a deterministic mode, which is not what we normally want by default. Therfore, Ben suggest to set SolveParam.PARALLEL_MODE to 1 by default in Jopt.

Reference: https://www.ibm.com/support/knowledgecenter/SSSA5P_12.9.0/ilog.odms.cplex.help/CPLEX/Parameters/topics/ParallelMode.html

@islerfab could you make this quick change and release a new version again? Thank you very much.

islerfab commented 4 years ago

Thanks for this catch and your thoughts. If I'm taking Ben's position of the past, I would probably not approve changing a default, since it would break dependent experiments. Now with the clear versioning that may be acceptable, but we should definitely mention this prominently in the change log.

A lighter alternative would be to catch cases where the thread count is larger than 1, and where the PARALLEL_MODE is set to 0, and write a warning that this does not lead to deterministic outcomes; And add instructions on how to achieve that with the parameters; And mention that the default will be changed to 1 in a future version of JOpt.

Just a proposition - I let this be you and Ben's call.

beyeler commented 4 years ago

I don't have a strong opinion on this. For me this default can also be set in mechlib.

It propably won't break dependent experiments, as the experiments are not reproducable anyway if they are not run in deterministic mode. But let's @blubin decide whether to change the default or not.

blubin commented 4 years ago

Changing from a default of non-deterministic to a default of deterministic should be okay. I would be worried about going the other way (but we aren't in this case). I think the default should be parallel-deterministic mode on, and you need to explicitly switch it off if you want the speed boost from becoming non-deterministic. I think most users will want the determinism most of the time...

Does this make sense?

thanks! -Ben

On Mon, Jun 15, 2020 at 10:13 AM beyeler notifications@github.com wrote:

I don't have a strong opinion on this. For me this default can also be set in mechlib.

It propably won't break dependent experiments, as the experiments are not reproducable anyway if they are not run in deterministic mode. But let's @blubin https://github.com/blubin decide whether to change the default or not.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/blubin/JOpt/issues/21#issuecomment-644160274, or unsubscribe https://github.com/notifications/unsubscribe-auth/ADLQ5UOYU3NAXRBNOEM3VVLRWYUBLANCNFSM4N3WYL6A .

islerfab commented 4 years ago

Yes! That's fine with me.