-
Notifications
You must be signed in to change notification settings - Fork 547
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Multicore improvements #69
Conversation
Ignore the clippy errors and warnings; they are being addressed separately. |
type Item = T; | ||
type Error = E; | ||
impl<T> Waiter<T> { | ||
/// Wait for the result. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As far as I can see, this is inaccurate: std::Option::take will never wait.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It won't, but this is emulating the threaded API. Both instances are effectively blocking, one just blocks for longer.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
utACK with suggestions.
…CPUS (cherry picked from commit 37686f8)
(cherry picked from commit dca4c5a) pick: Only the changes to bellman::multicore.
(cherry picked from commit c55d5e4) Changes during pick: - Excluded GPU-related changes (not upstreamed yet). - Added fix for change to Field::double API. - Fixed no-multicore Worker impl. Co-authored-by: Jack Grigg <thestr4d@gmail.com>
If a waiter is used from within a thread pool it might deadlock. Don't do that. (cherry picked from commit dc13606)
The Worker/Waiter model creates a Worker that requests that threads be spawned to complete some work. Since there is no bound to the number of requests for work, it's possible to exhaust memory with pending closures waiting to be processed. This was not an issue when 'everything was bounded by a single thread pool', however that setup has race conditions built into it. We have recently spent time splitting that model out, and this should be the final step required. This code places a limit on the number of requests that can be queued in an attempt to lessen the chance of memory exhaustion due to pending requests. It does this by placing a limit that is a simple multiple of the number of cores available (and in testing is far below observed crash criteria). When the number of requests for spawning new threads reaches that limit, instead of adding a new request, we block on execution to help clear the backlog. (cherry picked from commit 74947c0) pick: Also includes log change from b481a34
(cherry picked from commit 007487f)
…dpool This occurring is a programming error. Co-authored-by: Daira Hopwood <daira@jacaranda.org>
Co-authored-by: Daira Hopwood <daira@jacaranda.org>
Co-authored-by: Daira Hopwood <daira@jacaranda.org>
Rebased on |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
utACK
Signed-off-by: Daira Hopwood <daira@jacaranda.org>
… is expected to play more nicely with other uses of rayon in the same process (avoiding excess parallelism). Signed-off-by: Daira Hopwood <daira@jacaranda.org>
Signed-off-by: Daira Hopwood <daira@jacaranda.org>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
utACK with suggested changes in #71.
Co-authored-by: str4d <thestr4d@gmail.com>
…icore) implementation. Signed-off-by: Daira Hopwood <daira@jacaranda.org>
Use global rayon threadpool for multicore
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
utACK mod comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
utACK (modulo @str4d's suggested change to a comment).
Cherry-picked from https://github.com/filecoin-project/bellperson
Part of #7.
Closes #21.