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

Support for parallel maps? #29

Closed
juliohm opened this issue Jun 15, 2020 · 4 comments
Closed

Support for parallel maps? #29

juliohm opened this issue Jun 15, 2020 · 4 comments

Comments

@juliohm
Copy link

juliohm commented Jun 15, 2020

I am considering the package for a simulation script. Does it already support parallel maps like the progress_pmap function from ProgressMeter.jl?

@tkf
Copy link
Collaborator

tkf commented Jun 15, 2020

There is https://juliafolds.github.io/Transducers.jl/dev/manual/#Transducers.withprogress

using Transducers
tcollect(Map(f), withprogress(xs))

or equivalently

using ThreadsX
ThreadsX.map(f, withprogress(xs))

might work. withprogress is also usable with Distributed.jl:

using Transducers
dcollect(Map(f), withprogress(xs))

They use ProgressLogging behind the scene.

@juliohm
Copy link
Author

juliohm commented Jun 15, 2020

Nice, I should be using Transducers.jl instead of the lower level packages then. Is there a way to print variables in the loop with dcollect(Map(f), withprogress(xs))?

@tkf
Copy link
Collaborator

tkf commented Jun 15, 2020

You can put Map(x -> (@show(x); x)) anywhere in the transducer chain. Like

dcollect(Map(x -> (@show(x); x)) |> Filter(p) |> Map(f), withprogress(xs))

@juliohm
Copy link
Author

juliohm commented Jun 15, 2020

Nice, will try to rewrite my scripts accordingly. :)

@juliohm juliohm closed this as completed Jun 15, 2020
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

No branches or pull requests

2 participants