for example if I have a m= Mean()
can I call fit!(m,some_number)
from multiple threads and get correct answers?
a quick google did not turn up much
Usually, in-place functions like fit!
cannot be used to mutate shared objects concurrently from multiple tasks. If you want to use OnlineStats.jl with threads, you'd need to create the OnlineStat object for each task and merge them using _merge!
API: https://github.com/joshday/OnlineStatsBase.jl#interface
If you want a quick approach, ThreadsX.jl can be used with OnlineStats.jl as in ThreadsX.reduce(Mean(), 1:10)
: https://github.com/tkf/ThreadsX.jl#onlinestatsjl
Last updated: Nov 06 2024 at 04:40 UTC