Closed juliohm closed 4 years ago
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.
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))
?
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))
Nice, will try to rewrite my scripts accordingly. :)
I am considering the package for a simulation script. Does it already support parallel maps like the
progress_pmap
function from ProgressMeter.jl?