You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
It would be nice if the @progress macro were thread-safe and supported the Threads.@threads macro call.
This would require a bit of a rewrite, since the current _progress function does not update the fraction in a thread-safe manner, so a small rewrite would have to take place to change the fraction variables to use atomics. In my own code, the following has worked in a thread-safe manner-
@withprogressbegin
it = Threads.Atomic{Int}(0)
N =length(iter)
Threads.@threadsfor i in N
# body
Threads.atomic_add!(it, 1)
@logprogress it[] / N
endend
Is there any plan to implement this? If not, can someone post a more detailed working example of @mileslucas 's solution? I've tried to incorporate it in my code and it's not working - which is not surprising since I don't understand it :< Fwiw, I'm trying to use ProgressLogging in Pluto where I've parallelized a compute-intensive for loop with Threads.@threads. Works great with the single-threaded for loop...
It would be nice if the
@progress
macro were thread-safe and supported theThreads.@threads
macro call.This would require a bit of a rewrite, since the current
_progress
function does not update the fraction in a thread-safe manner, so a small rewrite would have to take place to change the fraction variables to use atomics. In my own code, the following has worked in a thread-safe manner-Parsing the input should be as simple as
I'm not really sure what is required beyond that to make it work, or I would have given it a shot myself.
The text was updated successfully, but these errors were encountered: