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.

Reply via email to