Skip to content
This repository has been archived by the owner on Jul 21, 2021. It is now read-only.

Add parallel execution #40

Merged
merged 4 commits into from
Nov 20, 2020
Merged

Add parallel execution #40

merged 4 commits into from
Nov 20, 2020

Conversation

GuillaumeDesforges
Copy link
Contributor

  • Use performP instead of perfom, so that it uses PKleisli

* Use performP instead of perfom, so that it uses PKleisli
Copy link
Contributor

@dorranh dorranh left a 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)

@@ -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
Copy link
Contributor

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.

Copy link
Contributor Author

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

@GuillaumeDesforges
Copy link
Contributor Author

Waiting for NixOS/nixpkgs#94930 to be merged, so that I can push the currently oprhan instance to upstream kernmantle.

@dorranh
Copy link
Contributor

dorranh commented Sep 21, 2020

@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.

@GuillaumeDesforges
Copy link
Contributor Author

Looks like it just got merged, I'll wait for it to reach Hydra before updating the haskell.nix sources

@GuillaumeDesforges GuillaumeDesforges added this to Backlog in v2.0 Sep 23, 2020
@dorranh dorranh moved this from Backlog to Next steps in v2.0 Nov 18, 2020
@dorranh
Copy link
Contributor

dorranh commented Nov 20, 2020

For the record, I explored providing a flag to control whether perform or performP is used but ran into some annoying technical issues (runFlowWithConfig won't type check since the type of all of the core components gets inferred using the concrete type in the perform or performP signature, and the core generation can't be split out into a separate function since it needs to be wrapped in the bracketed call to withStore).

Merging this as-is for now since users can still control parallelism using the standard Control.Arrow building blocks.

@dorranh dorranh merged commit a314514 into master Nov 20, 2020
@dorranh dorranh deleted the pkleisli branch November 20, 2020 09:34
@dorranh dorranh moved this from Next steps to Doing in v2.0 Nov 23, 2020
@dorranh dorranh moved this from Doing to Done in v2.0 Nov 23, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
No open projects
v2.0
Done
Development

Successfully merging this pull request may close these issues.

None yet

2 participants