Repository navigation
Replies: 5 comments 2 replies
|
Please would you comment @filikat or @galabovaa |
|
You're right! Calling We removed the call to This also means that within the same process it is possible to have multiple Highs instances running in parallel (again, parallelism obtained independently of the Highs scheduler), each using a different number of threads (I left wrong comments that now need updating in #3141). If these parallel Highs instances rely on the default number of threads, it is quite likely that there will be performance degradation due to too many threads being active at the same time. |
|
We definitely need to document the behaviour of the scheduler better. Parallel scheduler: initialization, shutdown and thread safetyTerminology
Each application thread has its own schedulerA scheduler is tied to the application thread that created it, not to a
Because every scheduler adds worker threads, running HiGHS from many application threads with the default thread count can create far more threads than you have cores, which slows everything down. In that case set the ShutdownA scheduler is shut down when its owning thread exits, or when you call Resetting only affects the scheduler of the calling thread. If the calling thread has no scheduler, the call does nothing. Other threads' schedulers are not affected. Thread safetyCall
Do not call it from inside a HiGHS parallel task or from a worker thread. That would stop the whole scheduler while other workers may still be running tasks. After a reset, the next Using the C APIThe C API follows the same rules. Each application thread that calls |
|
Good catch everyone. Although we must keep the name 'resetGlobalScheduler' for back-compatibility, to me it sounds wrong now, since it's associated with a particular application thread. Perhaps 'resetGlobalScheduler' could be renamed something like 'resetApplicationScheduler', with a method 'resetGlobalScheduler' that just calls 'resetApplicationScheduler'. Otherwise this statement reads well - and is comprehensible! - to me |
|
Thanks for the confirmation. I was asking about this as in https://github.com/google/or-tools/blob/7e7ecbff53afee3ff556f928998dcae99f62abb0/ortools/math_opt/solvers/highs_solver.cc#L226-L233 we explicitly disallow changing the number of threads because we assumed there was no thread-safe way of doing it. I'll change our code. |
Uh oh!
There was an error while loading. Please reload this page.
Highs::resetGlobalScheduler()documentation clearly states:But this comment has been written on change 8b7f996, before change 3728cbb landed and added a
thread_localexecutor.It seems the C API (
highs/interfaces/highs_c_api.cpp) also callshighs.resetGlobalScheduler(true)at the end of each solve.So my question is: is the documentation of
resetGlobalScheduler()still correct, or it is now safe to call this function on the thread that instantiated aHighsand used it to solve a model even if other threads may have instantiated otherHighs?All reactions