-
-
Notifications
You must be signed in to change notification settings - Fork 121
Closed
Description
As per this discourse thread, https://discourse.julialang.org/t/combining-pmap-with-ensembleproblem/38383/3 EnsembleSplitThreads runs N trajectories on each process instead of N trajectories in total.
Here's a small example:
# start with more than 1 process e.g. julia -p 2
using Distributed
@everywhere using DifferentialEquations
println("There are $(nprocs()) processes")
prob = ODEProblem((u,p,t)->1.01u,0.5,(0.0,1.0))
@everywhere function prob_func(prob,i,repeat)
println("Running trajectory $i")
ODEProblem(prob.f,rand()*prob.u0,prob.tspan)
end
ensemble_prob = EnsembleProblem(prob, prob_func=prob_func)
sim = solve(ensemble_prob,Tsit5(),EnsembleSplitThreads(),trajectories=2)
Output:
julia -p 2 test/trajacetories_example.jl
There are 3 processes
From worker 2: Running trajectory 1
From worker 3: Running trajectory 3
From worker 3: Running trajectory 4
From worker 2: Running trajectory 2
From worker 2: Running trajectory 5
From worker 2: Running trajectory 6
Metadata
Metadata
Assignees
Labels
No labels