ProgressMeter.jl icon indicating copy to clipboard operation
ProgressMeter.jl copied to clipboard

feat: add thread-safe progress meter

Open younes-io opened this issue 1 year ago • 6 comments

younes-io avatar Nov 13 '24 19:11 younes-io

@timholy could you please take a look at this? thank you

younes-io avatar Nov 17 '24 15:11 younes-io

it looks ok but is there a problem you came up across? Does this test something that wasn't tested before?

MarcMush avatar Nov 17 '24 15:11 MarcMush

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

Project coverage is 96.77%. Comparing base (807496a) to head (5a73a83). Report is 22 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master     #334      +/-   ##
==========================================
+ Coverage   93.48%   96.77%   +3.29%     
==========================================
  Files           1        1              
  Lines         399      559     +160     
==========================================
+ Hits          373      541     +168     
+ Misses         26       18       -8     

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

codecov[bot] avatar Nov 17 '24 15:11 codecov[bot]

it looks ok but is there a problem you came up across? Does this test something that wasn't tested before?

I added this to test how threads behave when they're all trying to update the same thing at once, but with different timing patterns. This can catch subtle issues that simpler tests might miss.

younes-io avatar Nov 18 '24 11:11 younes-io

we've had problems with threading (#232 and linked discussions) and there can be more done to improve multi-threading (#333, #157)

I wrote this to try to catch unsafe threading https://github.com/timholy/ProgressMeter.jl/blob/cd0414fa75b51fae39c16436021002cfee21bb88/test/core.jl#L174-L184

I think no sleep is a worst-case, and sleep yields (cpu can do other stuff) which is not a realistic workload either

I would have no problem adding these tests but i don't see what they add. If you have more insight on threaded stuff please say, I'm pretty new to it

MarcMush avatar Nov 18 '24 12:11 MarcMush

@MarcMush you're right, those tests were just simulating artificial computation.. I wasn't aware of this issue, so I pushed a commit to implement @timholy's recommendation using Threads.@spawn Obviously, this is just a start.. Please, let me know your thoughts

younes-io avatar Nov 18 '24 19:11 younes-io