-
Notifications
You must be signed in to change notification settings - Fork 0
Add parallel execution #40
Conversation
GuillaumeDesforges
commented
Aug 21, 2020
- Use performP instead of perfom, so that it uses PKleisli
* Use performP instead of perfom, so that it uses PKleisli
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.
Nice! I just had one question (see above)
funflow/src/Funflow/Run.hs
Outdated
@@ -92,7 +92,8 @@ runFlow flow input = | |||
-- The `Just n` is a number that is used to compute caching hashes, changing it will recompute all | |||
& runReader (localStoreWithId store $ defaultCachingId) | |||
-- Finally, run | |||
& perform input | |||
-- Using `performP` will call the instance PKleisli for which (***) and traverse' compute in parallel | |||
& performP input |
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.
If I'm understanding things correctly, this would enable parallel interpretation for basically any of the funflow effects whose inputs are independent from upstream outputs. Is that a correct understanding, and if so, would it be possible to also provide an option for disabling this? I can imagine someone will want a way to opt out of parallel execution while debugging at some point. IMO having it enabled by default is a reasonable default though.
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.
If I'm understanding things correctly, this would enable parallel interpretation for basically any of the funflow effects whose inputs are independent from upstream outputs.
Any branching would be parrallel, i.e.
() >- A -> a >- B -> (b, c) >- D -> d
>- C ->
you would have B and C run in parallel once a has been returned.
@YPares will confirm/invalidate this statement.
would it be possible to also provide an option for disabling this?
Yes, it can be done (& (if parallelExecution then performP else perform) input
).
This will require to put back a "config" argument to runFlow
I guess.
IMO having it enabled by default is a reasonable default though.
Agreed
Waiting for NixOS/nixpkgs#94930 to be merged, so that I can push the currently oprhan instance to upstream kernmantle. |
@GuillaumeDesforges, just took a look at NixOS/nixpkgs#94930 and saw that it is still open. If that doesn't get merged soon we can always include the patch in this repo as well then remove it once your patch gets merged upstream. |
Looks like it just got merged, I'll wait for it to reach Hydra before updating the haskell.nix sources |
6febe56
to
2f7517e
Compare
For the record, I explored providing a flag to control whether Merging this as-is for now since users can still control parallelism using the standard Control.Arrow building blocks. |