Skip to content

Commit

Permalink
change timing to use system_clock
Browse files Browse the repository at this point in the history
  • Loading branch information
jcurtis2 committed Oct 2, 2024
1 parent 3a71a95 commit 7f86924
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
4 changes: 3 additions & 1 deletion src/partmc.F90
Original file line number Diff line number Diff line change
Expand Up @@ -338,6 +338,7 @@ subroutine partmc_part(file)
character(len=PMC_MAX_FILENAME_LEN) :: restart_filename
integer :: dummy_index, dummy_i_repeat
real(kind=dp) :: n_part
integer(kind=8) :: clock_count, clock_count_rate

!> \page input_format_particle Input File Format: Particle-Resolved Simulation
!!
Expand Down Expand Up @@ -486,7 +487,8 @@ subroutine partmc_part(file)
call pmc_rand_finalize()
call pmc_srand(rand_init, pmc_mpi_rank())

call cpu_time(run_part_opt%t_wall_start)
call system_clock(clock_count, clock_count_rate)
run_part_opt%t_wall_start = real(clock_count, kind=dp) / clock_count_rate

do i_repeat = 1,run_part_opt%n_repeat
run_part_opt%i_repeat = i_repeat
Expand Down
10 changes: 7 additions & 3 deletions src/run_part.F90
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ module pmc_run_part
integer :: i_repeat
!> Total number of repeats.
integer :: n_repeat
!> Cpu_time() of start.
!> Wall clock time of start.
real(kind=dp) :: t_wall_start
!> Whether to record particle removal information.
logical :: record_removals
Expand Down Expand Up @@ -160,6 +160,7 @@ subroutine run_part(scenario, env_state, aero_data, aero_state, gas_data, &
integer :: global_n_nuc
logical :: do_output, do_state, do_state_netcdf, do_progress, did_coag
real(kind=dp) :: t_start, t_wall_now, t_wall_elapsed, t_wall_remain
integer(kind=8) :: clock_count, clock_count_rate
type(env_state_t) :: old_env_state
integer :: n_time, i_time, pre_i_time
integer :: i_state, i_state_netcdf, i_output
Expand Down Expand Up @@ -222,7 +223,8 @@ subroutine run_part(scenario, env_state, aero_data, aero_state, gas_data, &
t_wall_elapsed = 0d0
t_wall_remain = 0d0
else
call cpu_time(t_wall_now)
call system_clock(clock_count, clock_count_rate)
t_wall_now = real(clock_count, kind=dp) / clock_count_rate
prop_done = real(run_part_opt%i_repeat - 1, kind=dp) &
/ real(run_part_opt%n_repeat, kind=dp)
t_wall_elapsed = t_wall_now - run_part_opt%t_wall_start
Expand Down Expand Up @@ -807,6 +809,7 @@ subroutine run_part_timestep(scenario, env_state, aero_data, aero_state, &
integer :: global_n_nuc
logical :: do_output, do_state, do_state_netcdf, do_progress
real(kind=dp) :: t_wall_now, t_wall_elapsed, t_wall_remain, time
integer(kind=8) :: clock_count, clock_count_rate
type(env_state_t) :: old_env_state
#ifdef PMC_USE_CAMP
type(camp_state_t), pointer :: camp_state
Expand Down Expand Up @@ -948,7 +951,8 @@ subroutine run_part_timestep(scenario, env_state, aero_data, aero_state, &
call pmc_mpi_reduce_sum_integer(progress_n_nuc, global_n_nuc)
if (pmc_mpi_rank() == 0) then
! progress only printed from root process
call cpu_time(t_wall_now)
call system_clock(clock_count, clock_count_rate)
t_wall_now = real(clock_count, kind=dp) / clock_count_rate
prop_done = (real(run_part_opt%i_repeat - 1, kind=dp) &
+ time / run_part_opt%t_max) &
/ real(run_part_opt%n_repeat, kind=dp)
Expand Down

0 comments on commit 7f86924

Please sign in to comment.