Why use EnsembleProblems?

What’s the main intended use case for using an EnsembleProblem in DifferentialEquations.jl?

  • Does it offer better performance through batching compared to just writing an equivalent parallelized loop with remake and solve?

  • Or is it just intended as a more user friendly abstraction?

Relatedly, are user supposed to directly mutate the u0 and p fields of an ODEProblem within the prob_func? It’s confusing because the documentation shows this as the first example here DifferentialEquations.jl:

function prob_func(prob, i, repeat)
    @. prob.u0 = u0_arr[i]
    prob
end

even though remake is preferred to direct field mutation within SciML, from my experience. Is this dependent on whether safetycopy = true or false?

This.

You can, though we should probably update that to use remake. That portion of the docs was written before remake existed.

1 Like