18 #include "./base/base_uses.f90"
24 CHARACTER(len=*),
PARAMETER,
PRIVATE :: moduleN =
'dgemm_counter_types'
26 PUBLIC :: dgemm_counter_type, &
32 TYPE dgemm_counter_type
34 REAL(KIND=
dp) :: flop_rate = 0.0_dp, t_start = 0.0_dp
35 INTEGER :: num_dgemm_call = 0
36 INTEGER :: unit_nr = -1
37 LOGICAL :: print_info = .false.
49 TYPE(dgemm_counter_type),
INTENT(OUT) :: dgemm_counter
50 INTEGER,
INTENT(IN) :: unit_nr
51 LOGICAL,
INTENT(IN) :: print_info
53 dgemm_counter%unit_nr = unit_nr
54 dgemm_counter%print_info = print_info
63 TYPE(dgemm_counter_type),
INTENT(INOUT) :: dgemm_counter
77 TYPE(dgemm_counter_type),
INTENT(INOUT) :: dgemm_counter
78 INTEGER,
INTENT(IN) :: size1, size2, size3
80 REAL(kind=
dp) :: flop_rate, t_end
83 flop_rate = 2.0_dp*real(size1,
dp)*real(size2,
dp)*real(size3,
dp)/max(0.001_dp, t_end - dgemm_counter%t_start)
84 dgemm_counter%num_dgemm_call = dgemm_counter%num_dgemm_call + 1
85 IF (dgemm_counter%unit_nr > 0 .AND. dgemm_counter%print_info)
THEN
86 WRITE (unit=dgemm_counter%unit_nr, fmt=
"(T3,A,I10)") &
87 "PERFORMANCE| DGEMM call #", dgemm_counter%num_dgemm_call
88 WRITE (unit=dgemm_counter%unit_nr, fmt=
"(T3,A,I12,A,I12,A,I12)") &
89 "PERFORMANCE| DGEMM size (M x N x K) = ", size1,
" x ", size2,
" x ", size3
90 WRITE (unit=dgemm_counter%unit_nr, fmt=
"(T3,A,F15.5)") &
91 "PERFORMANCE| DGEMM time (s) = ", t_end - dgemm_counter%t_start
93 dgemm_counter%flop_rate = dgemm_counter%flop_rate + flop_rate
103 TYPE(dgemm_counter_type),
INTENT(INOUT) :: dgemm_counter
104 TYPE(mp_para_env_type),
INTENT(IN) :: para_env
106 dgemm_counter%flop_rate = dgemm_counter%flop_rate/real(max(dgemm_counter%num_dgemm_call, 1),
dp)/1.0e9_dp
108 CALL para_env%sum(dgemm_counter%flop_rate)
109 dgemm_counter%flop_rate = dgemm_counter%flop_rate/(real(para_env%num_pe,
dp)*real(para_env%num_pe,
dp))
110 IF (dgemm_counter%unit_nr > 0)
WRITE (unit=dgemm_counter%unit_nr, fmt=
"(T3,A,T66,F15.2)") &
111 "PERFORMANCE| Average DGEMM flop rate (Gflops / MPI rank):", dgemm_counter%flop_rate
Counters to determine the performance of parallel DGEMMs.
elemental subroutine, public dgemm_counter_init(dgemm_counter, unit_nr, print_info)
Initialize a dgemm_counter.
subroutine, public dgemm_counter_write(dgemm_counter, para_env)
calculate and print flop rates
subroutine, public dgemm_counter_start(dgemm_counter)
start timer of the counter
subroutine, public dgemm_counter_stop(dgemm_counter, size1, size2, size3)
stop timer of the counter and provide matrix sizes
Defines the basic variable types.
integer, parameter, public dp
Machine interface based on Fortran 2003 and POSIX.
real(kind=dp) function, public m_walltime()
returns time from a real-time clock, protected against rolling early/easily
Interface to the message passing library MPI.