I have been playing around with a couple of things,
If I write
f1_batch = function (p) # Para
prob_func(prob,i,repeat) = remake(prob;p=p[:,i])
ensemble_prob = EnsembleProblem(prob,prob_func=prob_func)
sol = solve(ensemble_prob,Tsit5(),EnsembleThreads();saveat=t,trajectories=size(p,2))
# Now sol[i] is the solution for the ith set of parameters
# create the output array:
out = [[sol[i][1,:]; sol[i][2,:]] for i in 1:size(p,2)]
end
This one generates an error with
ERROR: MethodError: no method matching *(::Vector{Float64}, ::Vector{Float64})
Some of the types have been truncated in the stacktrace for improved reading. To emit complete information
in the stack trace, evaluate `TruncatedStacktraces.VERBOSE[] = true` and re-run the code.
Closest candidates are:
*(::Any, ::Any, ::Any, ::Any...)
@ Base operators.jl:578
*(::StridedMatrix{T}, ::StridedVector{S}) where {T<:Union{Float32, Float64, ComplexF64, ComplexF32}, S<:Real}
@ LinearAlgebra /opt/julia-1.9.0-rc1/share/julia/stdlib/v1.9/LinearAlgebra/src/matmul.jl:49
*(::StridedVecOrMat, ::Adjoint{<:Any, <:LinearAlgebra.LQPackedQ})
@ LinearAlgebra /opt/julia-1.9.0-rc1/share/julia/stdlib/v1.9/LinearAlgebra/src/lq.jl:269
...
Stacktrace:
[1] _broadcast_getindex_evalf
@ ./broadcast.jl:683 [inlined]
[2] _broadcast_getindex
@ ./broadcast.jl:656 [inlined]
[3] getindex
@ ./broadcast.jl:610 [inlined]
[4] copy
@ ./broadcast.jl:912 [inlined]
[5] materialize
@ ./broadcast.jl:873 [inlined]
[6] (::GlobalSensitivity.var"#36#57"{Vector{Vector{Vector{Float64}}}, Vector{Vector{Float64}}, Vector{Vector{Float64}}})(k::Int64)
@ GlobalSensitivity ./none:0
[7] iterate
@ ./generator.jl:47 [inlined]
[8] collect
@ ./array.jl:782 [inlined]
[9] gsa_sobol_all_y_analysis(method::Sobol, all_y::Vector{Vector{Float64}}, d::Int64, n::Int64, Ei_estimator::Symbol, y_size::Nothing, #unused#::Val{false})
@ GlobalSensitivity ~/.julia/packages/GlobalSensitivity/4fbWQ/src/sobol_sensitivity.jl:179
[10] gsa(f::var"#142#144", method::Sobol, A::Matrix{Float64}, B::Matrix{Float64}; batch::Bool, Ei_estimator::Symbol, distributed::Val{false}, kwargs::Base.Pairs{Symbol, Union{}, Tuple{}, NamedTuple{(), Tuple{}}})
@ GlobalSensitivity ~/.julia/packages/GlobalSensitivity/4fbWQ/src/sobol_sensitivity.jl:139
[11] top-level scope
@ ./timing.jl:273 [inlined]
[12] top-level scope
@ ~/Downloads/MWE_GSA_TS.jl:0
Then trying to compare the parallel to the serial function
f1_batch(A)[50] = f1(A)[50]
Gives me a result which is consistent for all i not just 50.
So the error when I run sobol_result_batch = gsa(f1_batch,Sobol(),A,B, batch=true)
implies as if this is an error with with broadcasting in the batching?