-
Notifications
You must be signed in to change notification settings - Fork 23
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
[parallel] If not num_threads, use queue instead of tail recursion #306
[parallel] If not num_threads, use queue instead of tail recursion #306
Conversation
91e67e7
to
50c2d1d
Compare
Better late than never 😄 While trying to resolve your feedback, I came to the conclusion that having one class that's doing very different things in the sequential vs. the parallel case is not very maintainable. So, I decided to split the two functionalities into two subclasses of a common abstract superclass. The consequence of this is that @mzuenni's fix for the fuzzer in #327 is no longer necessary: the user of |
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.
Mostly LGTM; just some small comments.
Still not entirely convinced we actually need this but happy to merge either way.
50c2d1d
to
896b747
Compare
Previously, running `bt fuzz --jobs 0` would crash with a stack overflow after 244 iterations (±4 stack frames per iteration). This happened because after every GeneratorTask, a new task was started by calling Parallel.put, which in turn called its lambda, which called the new GeneratorTask, which called Parallel.put again in finish_task, etc. I've rewritten the task handling in the case of `not num_threads` by moving it all to Parallel.done. Parallel.put now puts the task in the same priority queue as in the case where we _do_ want parallelism (num_threads > 0). The fuzzer should now be able to run more than 244 iterations again 😄
This reverts commit 97ab1d7.
896b747
to
f348174
Compare
Previously, running
bt fuzz --jobs 0
would crash with a stack overflow after 244 iterations (±4 stack frames per iteration). This happened because after every GeneratorTask, a new task was started by calling Parallel.put, which in turn called its lambda, which called the new GeneratorTask, which called Parallel.put again in finish_task, etc.I've rewritten the task handling in the case of
not num_threads
by moving it all to Parallel.done. Parallel.put now puts the task in the same priority queue as in the case where we do want parallelism (num_threads > 0). The fuzzer should now be able to run more than 244 iterations again 😄I created a PR instead of simply pushing to
master
, since I haven't touched all of this parallel stuff that often, so some extra eyes would be nice 🙂To quickly reproduce the bug with `bt fuzz -j0`, I added a minimal generator to the test problem "hellowholeworld", which makes 244 iterations take about 2 minutes: