Skip to content
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

Add loop and initial design of prune combinator #857

Merged
merged 6 commits into from Apr 11, 2019

Conversation

kikofernandez
Copy link
Contributor

This PR adds the loop combinator and the initial design of the prune combinator (i.e. no killing yet).

  • loop :: Par[t] -> (t -> Par[t']) -> (t' -> bool) -> Par[t'] this combinator for performing useful computations until all elements in the ParT satisfy an exit condition. Elements that satisfy the exit condition do not need to continue iterating and can be asynchronously "streamed" to other ParT combinators. This combinator has been added based on experience from the SAT solver case study.

  • prune :: (Fut[Maybe[t]] -> Par[t']) -> Par[t]) -> Par[t'] this combinator puts in the future the first computation that finishes from the Par[t] (second argument). The function call is executed immediately, returning a new ParT (Par[t']). At the C level, the implementation uses a lock-free algorithm to ensure that only one item in the ParT fulfils the future. The killing part of remaining computations needs a bit more work and will be submitted in another PR. This should keep things simple and the review of the killing deserves its own PR (work-in-progress)

I have added tests to the loop and prune combinators.

Kiko Fernandez Reyes added 6 commits August 11, 2017 16:47
add a Task pool for each use of the loop combinator. the task pool uses
a round-robin lock-free algorithm to dispatch work to each worker. it
loads balances a task to each actor. this may not be the best strategy
if an actor gets more complex tasks. if necessary, we can fix this in
the next iteration. load balancing with relaxed memory semantics.
prune can be seen as a ParT that streams a single value.

    prune :: (Fut[Maybe[t]] -> Par[t']) -> Par[t] -> Par[t']

given its signature, we can understand that the ParT given as second
argument streams the first value out of it to the future in the first
argument. after that, we proceed by trying to kill the remaining
computations. the killing part is not finished yet.
@kikofernandez kikofernandez merged commit 9c57366 into parapluu:development Apr 11, 2019
@kikofernandez kikofernandez deleted the parT/prune branch April 11, 2019 13:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants