Skip to content

Commit

Permalink
rm all progress_bar lines
Browse files Browse the repository at this point in the history
  • Loading branch information
ivborissov committed Aug 23, 2024
1 parent 2c91468 commit de89719
Showing 1 changed file with 2 additions and 49 deletions.
51 changes: 2 additions & 49 deletions src/monte_carlo.jl
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
# RemoteChannel used for progress monitoring in parallel setup
const progch = RemoteChannel(()->Channel{Bool}(), 1)

# as in SciMLBase
DEFAULT_REDUCTION(u,data,I) = append!(u, data), false
Expand Down Expand Up @@ -59,12 +57,9 @@ function mc(

parameters_variation_nt = NamedTuple(parameters_variation)

#(parallel_type == EnsembleSerial()) # tmp fix
#p = Progress(num_iter, dt=0.5, barglyphs=BarGlyphs("[=> ]"), barlen=50, enabled = progress_bar)

function prob_func(prob,i,repeat)
verbose && println("Processing iteration $i")
#progress_bar && (parallel_type != EnsembleDistributed() ? next!(p) : put!(progch, true))

prob_i = remake_prob(scenario, generate_params(parameters_variation_nt, i); safetycopy=true)
return prob_i
Expand Down Expand Up @@ -94,37 +89,16 @@ function mc(
safetycopy = false
)

#=
if progress_bar && (parallel_type == EnsembleDistributed())
@sync begin
@async while take!(progch)
next!(p)
end
@async begin
solution = solve(prob, alg, parallel_type;
trajectories = num_iter,
reltol = reltol,
abstol = abstol,
save_start = false,
save_end = false,
save_everystep = false,
batch_size = progress_bar ? 1 : num_iter,
kwargs...
)
put!(progch, false)
end
end
else
=#
solution = solve(prob, alg, parallel_type;
trajectories = num_iter,
reltol = reltol,
abstol = abstol,
save_start = false,
save_end = false,
save_everystep = false,
kwargs...
)
#end

return MCResult(solution.u, has_saveat(scenario), scenario)
end
Expand Down Expand Up @@ -228,12 +202,10 @@ function mc(
lc = length(scenario_pairs)
iter = collect(Iterators.product(1:lp,1:lc))

p = Progress(num_iter, dt=0.5, barglyphs=BarGlyphs("[=> ]"), barlen=50, enabled=progress_bar)

function prob_func(prob,i,repeat)
iter_i = iter[i]
verbose && println("Processing scenario $(iter_i[2]) iteration $(iter_i[1])")
progress_bar && (parallel_type != EnsembleDistributed() ? next!(p) : put!(progch, true))

scn_i = last(scenario_pairs[iter_i[2]])
parameters_i = parameters_pregenerated[iter_i[1]]
Expand Down Expand Up @@ -266,35 +238,16 @@ function mc(
safetycopy = false
)

if progress_bar && (parallel_type == EnsembleDistributed())
@sync begin
@async while take!(progch)
next!(p)
end
@async begin
solution = solve(prob, alg, parallel_type;
trajectories = lp*lc,
reltol = reltol,
abstol = abstol,
save_start = false,
save_end = false,
save_everystep = false,
batch_size = progress_bar ? 1 : num_iter,
kwargs...
)
put!(progch, false)
end
end
else
solution = solve(prob, alg, parallel_type;
trajectories = lp*lc,
reltol = reltol,
abstol = abstol,
save_start = false,
save_end = false,
save_everystep = false,
kwargs...
)
end

ret = Vector{Pair{Symbol,MCResult}}(undef, lc)

Expand Down

0 comments on commit de89719

Please sign in to comment.