Subroutine for timing the execution of any parallel section of KORC.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(KORC_PARAMS), | intent(in) | :: | params | Core KORC simulation parameters. |
subroutine timing_KORC(params)
!! @note Subroutine for timing the execution of any parallel
!! section of KORC. @endnote
TYPE(KORC_PARAMS), INTENT(IN) :: params
!! Core KORC simulation parameters.
REAL(rp) :: individual_runtime
!! Execution time of each MPI process.
REAL(rp), DIMENSION(:), ALLOCATABLE :: runtime
!! Execution time of KORC defined as the average of the
!! execution times of all MPI processes.
INTEGER :: mpierr
!! MPI error status.
if (timed_already) then
t2 = MPI_WTIME()
ALLOCATE(runtime(params%mpi_params%nmpi))
individual_runtime = t2 - t1
call MPI_BARRIER(MPI_COMM_WORLD,mpierr)
call MPI_GATHER(individual_runtime,1,MPI_DOUBLE_PRECISION,runtime, &
1,MPI_DOUBLE_PRECISION,0_idef, MPI_COMM_WORLD, mpierr)
if (params%mpi_params%rank .EQ. 0_idef) then
write(output_unit_write,'("Timing: ",F30.16," s")') &
SUM(runtime)/REAL(params%mpi_params%nmpi,rp)
end if
call MPI_BARRIER(MPI_COMM_WORLD,mpierr)
DEALLOCATE(runtime)
timed_already = .FALSE.
end if
t1 = MPI_WTIME()
timed_already = .TRUE.
end subroutine timing_KORC