I am trying to put the the output (just one data point) of the solution of an ODE that is solved with uncertainty (measrument.jl) multiple times with different initial conditions within a distributed for loop in a SharedArray. I get this error stating
TaskFailedException:
On worker 2:
MethodError: no method matching Float64(::Measurement{Float64})
Closest candidates are:
Float64(::Real, !Matched::RoundingMode) where
I believe it does’t like the way that I have initialized my SharedArray which is
Alpha2 = SharedArray(zeros(100))
The main code is pretty long and might be confusing, so here is something very simple with the exact same problem
using SharedArrays, Distributed, Measurements
A=SharedArray(zeros(10))
@sync @time for i= 1:10
A[i]=i±1
end
which after running returns the same error as
MethodError: no method matching Float64(::Measurement{Float64})
Closest candidates are:
Float64(::Real, !Matched::RoundingMode) where T<:AbstractFloat at rounding.jl:200
Float64(::T) where T<:Number at boot.jl:718
Float64(!Matched::Int8) at float.jl:60
Can someone please point me in the right direction? How should I initialize the SharedArrays so I can put Measurement{Float64}
inside it within a @distributed for
loop?