From 7f86924279a899f0d1722f6857cf0550499b8c38 Mon Sep 17 00:00:00 2001 From: Jeff Curtis Date: Wed, 2 Oct 2024 12:37:08 -0500 Subject: [PATCH] change timing to use system_clock --- src/partmc.F90 | 4 +++- src/run_part.F90 | 10 +++++++--- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/src/partmc.F90 b/src/partmc.F90 index bf3fca3ad..542270322 100644 --- a/src/partmc.F90 +++ b/src/partmc.F90 @@ -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 !! @@ -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 diff --git a/src/run_part.F90 b/src/run_part.F90 index 5f907927e..69497194f 100644 --- a/src/run_part.F90 +++ b/src/run_part.F90 @@ -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 @@ -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 @@ -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 @@ -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 @@ -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)