29 use,
intrinsic :: iso_fortran_env
42 integer,
parameter :: C_NUM_MPI_ROUTINES = 12
44 integer,
public,
parameter :: &
58 character(len=14),
dimension(C_NUM_MPI_ROUTINES),
public :: mpi_rlabel = &
74 integer,
public :: call_counter(C_NUM_MPI_ROUTINES) = 0
75 real(real64),
public :: sec_accum(C_NUM_MPI_ROUTINES) = 0_real64
77 real(real64) :: sec_in
83 integer,
parameter :: unit_offset = 1000
89 integer,
intent(in) :: rank
90 logical,
intent(in) :: info
98 integer,
intent(out) :: iunit
100 character(len=6) :: filenum
102 iunit = mpi_rank + unit_offset
103 write(filenum,
'(i6.6)') iunit - unit_offset
105 open(iunit, file =
'debug/debug_trace.node.'//filenum, &
106 action=
'write', status=
'unknown', position=
'append')
114 real(real64) :: usec_call(C_NUM_MPI_ROUTINES)
117 if (.not. debug_info)
return
123 write(iunit,
'(A)')
'--------------------------------------------------------------------'
125 write(iunit,
'(23x,a,4x,a,8x,a)')
'total time',
'calls',
'usec/call'
126 do j = 1, c_num_mpi_routines
127 if (call_counter(j) <= 0)
then
130 usec_call(j) = (sec_accum(j)*1000000)/call_counter(j)
133 write(iunit,
'(a,f13.6,6x,i4,6x,f13.0)') &
134 mpi_rlabel(j)//
' : ', sec_accum(j), &
135 call_counter(j), usec_call(j)
138 write(iunit,
'(A)')
'--------------------------------------------------------------------'
148 type(mpi_comm),
intent(in) :: comm
149 integer,
intent(in) :: index
153 if (.not. debug_info)
return
157 call_counter(index) = call_counter(index) + 1
161 write(iunit,
'(a,f18.6,a,z8.8,a,i6.6,a,f13.6)')
'* MPI_I ', &
162 sec_in,
' '//mpi_rlabel(index)//
' : 0x', comm%MPI_VAL,
' | ', &
163 call_counter(index),
' - ', sec_accum(index)
172 type(mpi_comm),
intent(in) :: comm
173 integer,
intent(in) :: index
176 real(real64) :: sec_out, sec_diff
178 if (.not. debug_info)
return
183 sec_out = mpi_wtime()
186 write(iunit,
'(a,f18.6,a,z8.8,a,i6.6,a,f13.6,a,f13.6)') &
187 '* MPI_O ', sec_out,
' '//mpi_rlabel(index)//
' : 0x', comm%MPI_VAL,
' | ', &
188 call_counter(index),
' - ', sec_accum(index),
' - ', sec_diff
197 integer,
intent(in) :: index
198 real(real64),
intent(in) :: sec
199 real(real64),
intent(out) :: sec_diff
201 sec_diff = sec - sec_in
202 sec_accum(index) = sec_accum(index) + sec_diff
subroutine mpi_time_accum(index, sec, sec_diff)
integer, parameter, public c_mpi_allgatherv
integer, parameter, public c_mpi_allreduce
integer, parameter, public c_mpi_gatherv
integer, parameter, public c_mpi_file_read
subroutine, public mpi_debug_init(rank, info)
integer, parameter, public c_mpi_scatterv
subroutine, public mpi_debug_in(comm, index)
integer, parameter, public c_mpi_allgather
subroutine, public mpi_debug_statistics()
integer, parameter, public c_mpi_bcast
integer, parameter, public c_mpi_alltoallv
integer, parameter, public c_mpi_gather
subroutine, public mpi_debug_out(comm, index)
subroutine mpi_debug_open_trace(iunit)
integer, parameter, public c_mpi_alltoall
integer, parameter, public c_mpi_file_write