how to print progress of a long running parallel() loop?
Dukc
ajieskola at gmail.com
Mon Dec 7 12:48:40 UTC 2020
On Monday, 7 December 2020 at 08:16:50 UTC, mw wrote:
> r = Parallel(n_jobs=2, verbose=10)(delayed(sleep)(.2) for _ in
> range(10))
>
> to print out the progress.
>
> How to do this in D's parallel loop?
>
> thanks.
Allocate a `shared int` before the foreach loop. In the loop
when, let's say `!(i & 0xFFF)`, atomically increment the shared
variable and print it's number.
Disclaimer: no experience about using `shared`, but this is what
I'd try.
More information about the Digitalmars-d-learn
mailing list