Repository navigation
Parallel scheduler documentation - #3449
Conversation
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## latest #3449 +/- ##
==========================================
+ Coverage 75.10% 75.14% +0.04%
==========================================
Files 460 460
Lines 112008 112233 +225
Branches 17757 17792 +35
==========================================
+ Hits 84125 84341 +216
- Misses 27601 27610 +9
Partials 282 282 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
Opt-Mucca
left a comment
There was a problem hiding this comment.
I like the new documentation! It's clear and addresses everything that I imagine a user would be interested in. Thanks for fixing some outdated lines on parallel MIP too.
| * undefined behavior and may cause crashes, but cannot be detected and hence | ||
| * is fully in the callers responsibility. | ||
| * this function while on a worker thread or during the execution of a Highs | ||
| * function may cause crashes, but cannot be detected and hence is fully in the |
There was a problem hiding this comment.
Better and correct: "fully the caller's resonsibility."
|
|
||
| - The first time an application thread calls `run()` or `presolve()`, HiGHS creates a scheduler for that thread. The thread becomes its owning thread. | ||
| - All `Highs` instances used on the same application thread share that thread's scheduler. | ||
| - Application threads never share a scheduler. If several application threads each use HiGHS, each gets its own scheduler and its own worker threads. They do not interfere with each other. |
There was a problem hiding this comment.
Better "If several application threads use HiGHS, each gets ..." or (possibly) "If each of several application threads uses HiGHS, each gets..." or
jajhall
left a comment
There was a problem hiding this comment.
I'm unable to create the documentation locally to see how it looks in a browser, but I've previewed the changes to partallel.md and solvers.md in GitHub.
Other than the couple of grammatical corrections, I thought that just presenting the general documentation for the scheduler might be intimidating for someone whose code is serial and they are simply calling run() for a single Highs instance. Perhaps there could be a documentation section explaining the use of the scheduler in this simplest (but common) special case.
Yes, it is indeed a bit daunting to see so many details. |
|
|
||
| - An **application thread** is any thread not created by HiGHS. A **worker thread** is created by HiGHS as part of a scheduler. The **owning thread** is the application thread that created a scheduler, and it participates in the parallel work. | ||
| - The scheduler is `thread_local`. It is created lazily by the first `run()` or `presolve()` on an application thread, and is shared by all `Highs` instances used on that thread. It is never visible to other application threads. | ||
| - A scheduler of size `N` consists of the owning thread and `N - 1` workers. `N` is fixed at creation, so later changes to the `threads` option have no effect until the scheduler is reset. The default is the number of physical cores in the process's CPU affinity mask. |
There was a problem hiding this comment.
... changes to the threads option have no effect ...
If threads is changed, doesn't the code print a log message and return an error?
| def readSolution(self, file_path: str, style: int) -> HighsStatus: ... | ||
| @staticmethod | ||
| def resetThreadScheduler(blocking: bool) -> None: ... | ||
| def resetGlobalScheduler(blocking: bool) -> None: ... |
There was a problem hiding this comment.
I think the line @staticmethod has be repeated for the resetGlobalScheduler?
|
|
||
| All of this applies to the C API and to other languages as well. | ||
|
|
||
| You only need the advanced section below if you run HiGHS from several threads of your own, or if you need to stop HiGHS's threads explicitly, for example before unloading a library. |
There was a problem hiding this comment.
HiGHS': no s after the apostrophe when a singular noun ends in "s"
Otherwise this is great!
I think we'll see the benefit of taking time over composing this documentation
|
Great. |
Description
resetGlobalSchedulerin C and Cpp API.resetGlobalSchedulertoresetThreadScheduler, since the scheduler is not global but is owned by the thread that created it. I am open to other names if people have better ideas.resetGlobalScheduleris retained for compatibility, but I put it in the list of deprecated methods. I cannot give adeprecationMessagethough, as it's a static function.There is a large diff because many tests call
resetGlobalScheduler.@galabovaa I added
resetThreadSchedulerto the python binding in the same way asresetGlobalScheduler. I'm not sure if something else is needed.Checklist
latestbranch