Open pfitzseb opened 3 years ago
Here's what I do to make this work:
mutable struct Prog
N::Int
@atomic count::Int
end
Prog(N) = Prog(N, 0)
inc!(p::Prog) = @atomic p.count += 1
macro inc(p)
quote
local M = $inc!($p) # It seems to be important to separate this out from the `@logprogress` step since `@logprogress` can double-evaluate
$ProgressLogging.@logprogress M / $p.N
end |> esc
end
and then
using OhMyThreads: tforeach
p = Prog(N)
@withprogress tforeach(1:N) do i
sleep(2)
@inc p
end
Would be nice to support logging progress increments, so that e.g. something like
works.