Skip to content

Commit

Permalink
Merge pull request #45 from andreasnoack/an/nomap
Browse files Browse the repository at this point in the history
Change map for a for loop
  • Loading branch information
ChrisRackauckas authored Mar 31, 2021
2 parents 3150439 + b3ea422 commit 3380d65
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions src/ensemble/basic_ensemble_solve.jl
Original file line number Diff line number Diff line change
Expand Up @@ -182,11 +182,16 @@ function solve_batch(prob,alg,ensemblealg::EnsembleDistributed,II,pmap_batch_siz
tighten_container_eltype(batch_data)
end

function solve_batch(prob,alg,::EnsembleSerial,II,pmap_batch_size;kwargs...)
batch_data = map(II) do i
batch_func(i,prob,alg;kwargs...)
function solve_batch(prob, alg, ::EnsembleSerial, II, pmap_batch_size; kwargs...)
if isempty(II)
throw(ArgumentError("number of trajectories must be positive"))
end
tighten_container_eltype(batch_data)
batch_data = [batch_func(first(II), prob, alg; kwargs...)]
sizehint!(batch_data,length(II))
for i in 2:length(II)
@inbounds push!(batch_data, batch_func(II[i], prob, alg; kwargs...))
end
return tighten_container_eltype(batch_data)
end

function solve_batch(prob,alg,ensemblealg::EnsembleThreads,II,pmap_batch_size;kwargs...)
Expand Down

0 comments on commit 3380d65

Please sign in to comment.