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
I'm currently trying to get into multi-threading and I was excited to find your package/macros to do this. So first thanks for making all this!
Following up on the odds/even floop from the docs I noticed a behaviour where I'm not sure if it's a bug or supposed to be that way. When replacing the append!! with an equivalent push!! code, the output is wrong in multi-threaded execution.
using FLoops
using BangBang
using Random
function run_append(niter; ex=ThreadedEx())
@floop ex for i in 1:niter
@init θ = zeros(1)
θ .= rand()
@reduce(θsamples = append!!(Vector{Float64}(), θ))
end
θsamples
end
# returns Vector{Float64} with 1000 elements as expected
run_append(1000)
function run_push(niter; ex=ThreadedEx())
@floop ex for i in 1:niter
@init θ = zeros(1)
θ .= rand()
@reduce(θsamples = push!!(Vector{Float64}(), θ[1]))
end
θsamples
end
# returns Vector{Any} with some 252 elements (unexpected)
run_push(1000)
# would run correctly in single-thread
run_push(1000, ex=SequentialEx())
Would be really happy to understand what's going on!
Best
The text was updated successfully, but these errors were encountered:
Hey,
I'm currently trying to get into multi-threading and I was excited to find your package/macros to do this. So first thanks for making all this!
Following up on the odds/even floop from the docs I noticed a behaviour where I'm not sure if it's a bug or supposed to be that way. When replacing the
append!!
with an equivalentpush!!
code, the output is wrong in multi-threaded execution.Would be really happy to understand what's going on!
Best
The text was updated successfully, but these errors were encountered: