TABLE OF CONTENTS
- ABINIT/m_gwls_TimingLog
- m_hamiltonian/close_timing_log
- m_hamiltonian/setup_timing_log
- m_hamiltonian/write_block_lanczos_timing_log
- m_hamiltonian/write_text_block_in_Timing_log
- m_hamiltonian/write_timing_log
ABINIT/m_gwls_TimingLog [ Modules ]
NAME
m_gwls_TimingLog
FUNCTION
.
COPYRIGHT
Copyright (C) 2009-2024 ABINIT group (JLJ, BR, MC) This file is distributed under the terms of the GNU General Public License, see ~abinit/COPYING or http://www.gnu.org/copyleft/gpl.txt .
SOURCE
16 #if defined HAVE_CONFIG_H 17 #include "config.h" 18 #endif 19 20 #include "abi_common.h" 21 22 23 module m_gwls_TimingLog 24 !---------------------------------------------------------------------------------------------------- 25 ! This module will control the opening, writing and closing of a log file which will contain 26 ! timing information. By making this a module, which can be called from anywhere, existing 27 ! routines can easily write to this log without modifying their arguments. 28 !---------------------------------------------------------------------------------------------------- 29 ! local modules 30 use m_gwls_utility 31 32 ! Abinit modules 33 use m_abicore 34 use defs_basis 35 36 use m_io_tools, only : get_unit 37 38 implicit none 39 private
m_hamiltonian/close_timing_log [ Functions ]
[ Top ] [ m_hamiltonian ] [ Functions ]
NAME
close_timing_log
FUNCTION
.
INPUTS
OUTPUT
SOURCE
133 subroutine close_timing_log() 134 !-------------------------------------------------------------------------------- 135 ! This routine closes the timing log file. 136 !-------------------------------------------------------------------------------- 137 implicit none 138 ! ************************************************************************* 139 140 if (head_node_timing) close(io_unit_timing_log) 141 142 end subroutine close_timing_log
m_hamiltonian/setup_timing_log [ Functions ]
[ Top ] [ m_hamiltonian ] [ Functions ]
NAME
setup_timing_log
FUNCTION
.
INPUTS
OUTPUT
SOURCE
72 subroutine setup_timing_log() 73 !-------------------------------------------------------------------------------- 74 ! This routine opens the timing log file. 75 !-------------------------------------------------------------------------------- 76 use m_gwls_hamiltonian, only: mpi_enreg 77 implicit none 78 79 80 logical :: file_exists 81 integer :: i 82 83 ! ************************************************************************* 84 85 86 head_node_timing = (mpi_enreg%me == 0) 87 88 89 if (head_node_timing) then 90 inquire(file=timing_log_filename,exist=file_exists) 91 92 i = 0 93 do while (file_exists) 94 i = i+1 95 write (timing_log_filename,'(A,I0,A)') "Timing_Log_",i,".dat" 96 inquire(file=timing_log_filename,exist=file_exists) 97 end do 98 99 100 io_unit_timing_log = get_unit() 101 open(io_unit_timing_log,file=timing_log_filename,status=files_status_new) 102 write(io_unit_timing_log,10) '' 103 write(io_unit_timing_log,10) '#============================================================================================' 104 write(io_unit_timing_log,10) '# This file contains timing information for various routines from gw_sternheimer.' 105 write(io_unit_timing_log,10) '# The purpose of this information is to establish which parts of the computation' 106 write(io_unit_timing_log,10) '# are time consuming.' 107 write(io_unit_timing_log,10) '#============================================================================================' 108 write(io_unit_timing_log,10) '# computation time (seconds) ' 109 write(io_unit_timing_log,10) '#============================================================================================' 110 write(io_unit_timing_log,10) '#' 111 flush(io_unit_timing_log) 112 end if 113 114 10 format(A) 115 116 117 end subroutine setup_timing_log
m_hamiltonian/write_block_lanczos_timing_log [ Functions ]
[ Top ] [ m_hamiltonian ] [ Functions ]
NAME
write_block_lanczos_timing_log
FUNCTION
.
INPUTS
OUTPUT
SOURCE
227 subroutine write_block_lanczos_timing_log(list_time,ntime) 228 !-------------------------------------------------------------------------------- 229 ! This routine writes the timing for the block lanczos routine. 230 !-------------------------------------------------------------------------------- 231 use m_gwls_hamiltonian, only: mpi_enreg 232 implicit none 233 234 235 integer , intent(in) :: ntime 236 real(dp), intent(in) :: list_time(ntime) 237 238 logical :: file_exists 239 240 integer, save :: icounter = 0 241 242 integer :: io_unit 243 244 character(128) :: block_lanczos_log_filename = "block_lanczos_timing.log" 245 246 logical :: head_node 247 248 ! ************************************************************************* 249 250 head_node = (mpi_enreg%me == 0) 251 if (head_node) then 252 253 inquire(file=block_lanczos_log_filename,exist=file_exists) 254 255 io_unit = get_unit() 256 257 if (.not. file_exists) then 258 open(io_unit,file=block_lanczos_log_filename,status=files_status_new) 259 write(io_unit,10) '' 260 write(io_unit,10) '#===============================================================================================' 261 write(io_unit,10) '# This file contains timing information for the block Lanczos algorithm. ' 262 write(io_unit,10) '# The purpose of this information is to establish which parts of the computation' 263 write(io_unit,10) '# are time consuming.' 264 write(io_unit,10) '#===============================================================================================' 265 write(io_unit,10) '# computation time (seconds) ' 266 write(io_unit,10) '#===============================================================================================' 267 write(io_unit,10) '#' 268 else 269 open(io_unit,file=block_lanczos_log_filename,position='append',status=files_status_old) 270 end if 271 272 273 icounter = icounter + 1 274 write(io_unit,10) '' 275 write(io_unit,10) '#==========================' 276 write(io_unit,15) '# Call number ', icounter 277 write(io_unit,10) '#==========================' 278 write(io_unit,10) '' 279 280 write(io_unit,20) ' Apply Matrix Function :', list_time(1) 281 write(io_unit,20) ' Compute Alpha :', list_time(2) 282 write(io_unit,20) ' Update residual array (1-ZGEMM):', list_time(3) 283 write(io_unit,20) ' Update residual array (2-ZGEMM):', list_time(4) 284 write(io_unit,20) ' Orthogonalize :', list_time(5) 285 write(io_unit,20) ' Extract QR factorization :', list_time(6) 286 write(io_unit,10) '-------------------------------------------------------' 287 write(io_unit,20) ' Sum of the above :', sum(list_time(1:6)) 288 write(io_unit,20) ' TOTAL ROUTINE TIME :', list_time(7) 289 290 291 close(io_unit) 292 293 end if 294 295 10 format(A) 296 15 format(A,I5) 297 20 format(A,ES10.2) 298 299 end subroutine write_block_lanczos_timing_log
m_hamiltonian/write_text_block_in_Timing_log [ Functions ]
[ Top ] [ m_hamiltonian ] [ Functions ]
NAME
write_text_block_in_Timing_log
FUNCTION
.
INPUTS
OUTPUT
SOURCE
158 subroutine write_text_block_in_Timing_log(string) 159 !-------------------------------------------------------------------------------- 160 ! This routine opens the timing log file. 161 !-------------------------------------------------------------------------------- 162 implicit none 163 164 character(256):: string 165 ! ************************************************************************* 166 167 if (head_node_timing) then 168 write(io_unit_timing_log,10) trim(string) 169 flush(io_unit_timing_log) 170 end if 171 172 10 format(A) 173 174 end subroutine write_text_block_in_Timing_log
m_hamiltonian/write_timing_log [ Functions ]
[ Top ] [ m_hamiltonian ] [ Functions ]
NAME
write_timing_log
FUNCTION
.
INPUTS
OUTPUT
SOURCE
190 subroutine write_timing_log(string,time) 191 !-------------------------------------------------------------------------------- 192 ! This routine opens the timing log file. 193 !-------------------------------------------------------------------------------- 194 implicit none 195 196 197 character(256):: string 198 real(dp) :: time 199 ! ************************************************************************* 200 201 if (head_node_timing) then 202 write(io_unit_timing_log,20) trim(string),time 203 flush(io_unit_timing_log) 204 end if 205 206 207 20 format(A,ES12.4) 208 209 end subroutine write_timing_log