Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Change map for a for loop #45

Merged
merged 2 commits into from Mar 31, 2021
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
12 changes: 8 additions & 4 deletions src/ensemble/basic_ensemble_solve.jl
Expand Up @@ -182,11 +182,15 @@ 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...)]
ChrisRackauckas marked this conversation as resolved.
Show resolved Hide resolved
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