Skip to content

Commit

Permalink
Does this change allocs
Browse files Browse the repository at this point in the history
  • Loading branch information
nefrathenrici committed Aug 24, 2023
1 parent 164d90c commit 831549c
Showing 1 changed file with 22 additions and 22 deletions.
44 changes: 22 additions & 22 deletions src/callbacks/callbacks.jl
Original file line number Diff line number Diff line change
Expand Up @@ -39,33 +39,33 @@ function display_status_callback!()


function initialize(_, _, _, integrator)
is_first_step[] = true
t_end[] = integrator.p.simulation.t_end
step[] = 0
nsteps[] = ceil(Int, t_end[] / integrator.dt)
# is_first_step[] = true
# t_end[] = integrator.p.simulation.t_end
# step[] = 0
# nsteps[] = ceil(Int, t_end[] / integrator.dt)
end

function affect!(integrator)
# speed = wallclock time / simulation time
# Print ETA = speed * remaining simulation time
t[] = integrator.t
time[] = time_ns() / 1e9
speed[] = (time[] - prev_time[]) / (t[] - prev_t[])
eta[] = speed[] * (t_end[] - t[])
step[] += 1
if is_first_step[]
# @info "Time Remaining: ..."
is_first_step[] = false
start_time[] = time[]
else
@info "$(Dates.format(Dates.now(), "HH:MM:SS:ss u-d")) \n\
Timestep: $(step[]) / $(nsteps[]); Simulation Time: $(t[]) seconds \n\
Walltime: $(round(time[] - start_time[], digits=2)) seconds; \
Time/Step: $(round(speed[] * integrator.dt, digits=2)) seconds \n\
Time Remaining: $(Int64(round(eta[]))) seconds"
end
prev_t[] = t[]
prev_time[] = time[]
# t[] = integrator.t
# time[] = time_ns() / 1e9
# speed[] = (time[] - prev_time[]) / (t[] - prev_t[])
# eta[] = speed[] * (t_end[] - t[])
# step[] += 1
# if is_first_step[]
# # @info "Time Remaining: ..."
# is_first_step[] = false
# start_time[] = time[]
# else
# @info "$(Dates.format(Dates.now(), "HH:MM:SS:ss u d")) \n\
# Timestep: $(step[]) / $(nsteps[]); Simulation Time: $(t[]) seconds \n\
# Walltime: $(round(time[] - start_time[], digits=2)) seconds; \
# Time/Step: $(round(speed[] * integrator.dt, digits=2)) seconds \n\
# Time Remaining: $(Int64(round(eta[]))) seconds"
# end
# prev_t[] = t[]
# prev_time[] = time[]
end
return initialize, affect!
end
Expand Down

0 comments on commit 831549c

Please sign in to comment.