Skip to content

Commit 9faaea9

Browse files
committed
Use raw Array
1 parent 71fdeb8 commit 9faaea9

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

src/ensemble/basic_ensemble_solve.jl

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ function __solve(prob::AbstractEnsembleProblem,
8989
num_batches * batch_size != trajectories && (num_batches += 1)
9090

9191
function batch_function(I)
92-
batch_data = solve_batch(prob,alg,ensemblealg,I,pmap_batch_size;kwargs...)
92+
batch_data = map(x->x.u, solve_batch(prob,alg,ensemblealg,I,pmap_batch_size;kwargs...))
9393
end
9494

9595
if num_batches == 1 && prob.reduction === DEFAULT_REDUCTION
@@ -100,10 +100,10 @@ function __solve(prob::AbstractEnsembleProblem,
100100

101101
if prob.u_init === nothing && prob.reduction === DEFAULT_REDUCTION
102102
batchrt = Core.Compiler.return_type(batch_function,Tuple{UnitRange{Int64}})
103-
u = Vector{batchrt}(undef,0)
104103
else
105-
u = []
104+
batchrt = Any
106105
end
106+
u = batchrt[]
107107

108108
converged = false
109109

src/ensemble/ensemble_problems.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ end
1212

1313
DEFAULT_PROB_FUNC(prob,i,repeat) = prob
1414
DEFAULT_OUTPUT_FUNC(sol,i) = (sol,false)
15-
DEFAULT_REDUCTION(u,data,I) = (vcat(u,data),false)
15+
DEFAULT_REDUCTION(u,data,I) = push!(copy(u), data), false
1616
EnsembleProblem(prob;
1717
output_func = DEFAULT_OUTPUT_FUNC,
1818
prob_func= DEFAULT_PROB_FUNC,

0 commit comments

Comments
 (0)