Changeset 14072 for NEMO/trunk/src/OCE/timing.F90
- Timestamp:
- 2020-12-04T08:48:38+01:00 (3 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
NEMO/trunk/src/OCE/timing.F90
r13982 r14072 3 3 !! *** MODULE timing *** 4 4 !!======================================================================== 5 !! History : 4.0 ! 2001-05 (R. Benshila) 5 !! History : 4.0 ! 2001-05 (R. Benshila) 6 6 !!------------------------------------------------------------------------ 7 7 8 8 !!------------------------------------------------------------------------ 9 !! timming_init : initialize timing process 9 !! timming_init : initialize timing process 10 10 !! timing_start : start Timer 11 11 !! timing_stop : stop Timer 12 12 !! timing_reset : end timing variable creation 13 !! timing_finalize : compute stats and write output in calling w*_info 14 !! timing_ini_var : create timing variables 13 !! timing_finalize : compute stats and write output in calling w*_info 14 !! timing_ini_var : create timing variables 15 15 !! timing_listing : print instumented subroutines in ocean.output 16 16 !! wcurrent_info : compute and print detailed stats on the current CPU 17 17 !! wave_info : compute and print averaged statson all processors 18 !! wmpi_info : compute and write global stats 19 !! supress : suppress an element of the timing linked list 20 !! insert : insert an element of the timing linked list 18 !! wmpi_info : compute and write global stats 19 !! supress : suppress an element of the timing linked list 20 !! insert : insert an element of the timing linked list 21 21 !!------------------------------------------------------------------------ 22 USE in_out_manager ! I/O manager 22 USE in_out_manager ! I/O manager 23 23 USE dom_oce ! ocean domain 24 USE lib_mpp 25 24 USE lib_mpp 25 26 26 IMPLICIT NONE 27 27 PRIVATE 28 28 29 PUBLIC timing_init, timing_finalize ! called in nemogcm module 30 PUBLIC timing_reset ! called in step module 31 PUBLIC timing_start, timing_stop ! called in each routine to time 32 29 PUBLIC timing_init, timing_finalize ! called in nemogcm module 30 PUBLIC timing_reset ! called in step module 31 PUBLIC timing_start, timing_stop ! called in each routine to time 32 33 33 #if defined key_mpp_mpi 34 34 INCLUDE 'mpif.h' … … 41 41 INTEGER :: rank 42 42 REAL(wp) :: t_cpu, t_clock, tsum_cpu, tsum_clock, tmax_cpu, tmax_clock, tmin_cpu, tmin_clock, tsub_cpu, tsub_clock 43 INTEGER :: ncount, ncount_max, ncount_rate 43 INTEGER :: ncount, ncount_max, ncount_rate 44 44 INTEGER :: niter 45 45 LOGICAL :: l_tdone … … 48 48 TYPE(timer), POINTER :: parent_section => NULL() 49 49 END TYPE timer 50 50 51 51 TYPE alltimer 52 52 CHARACTER(LEN=20), DIMENSION(:), POINTER :: cname => NULL() … … 56 56 TYPE(alltimer), POINTER :: next => NULL() 57 57 TYPE(alltimer), POINTER :: prev => NULL() 58 END TYPE alltimer 59 58 END TYPE alltimer 59 60 60 TYPE(timer), POINTER :: s_timer_root => NULL() 61 61 TYPE(timer), POINTER :: s_timer => NULL() … … 66 66 LOGICAL :: l_initdone = .FALSE. 67 67 INTEGER :: nsize 68 68 69 69 ! Variables for coarse grain timing 70 70 REAL(wp) :: tot_etime, tot_ctime … … 76 76 CHARACTER(LEN=10), DIMENSION(2) :: ctime 77 77 CHARACTER(LEN=5) :: czone 78 78 79 79 ! From of ouput file (1/proc or one global) !RB to put in nammpp or namctl 80 LOGICAL :: ln_onefile = .TRUE. 80 LOGICAL :: ln_onefile = .TRUE. 81 81 LOGICAL :: lwriter 82 82 !!---------------------------------------------------------------------- … … 96 96 IF(ASSOCIATED(s_timer) ) s_timer_old => s_timer 97 97 ! 98 ! Create timing structure at first call of the routine 98 ! Create timing structure at first call of the routine 99 99 CALL timing_ini_var(cdinfo) 100 100 ! write(*,*) 'after inivar ', s_timer%cname … … 102 102 ! ici timing_ini_var a soit retrouve s_timer et fait return soit ajoute un maillon 103 103 ! maintenant on regarde si le call d'avant corrsspond a un parent ou si il est ferme 104 IF( .NOT. s_timer_old%l_tdone ) THEN 104 IF( .NOT. s_timer_old%l_tdone ) THEN 105 105 s_timer%parent_section => s_timer_old 106 106 ELSE 107 107 s_timer%parent_section => NULL() 108 ENDIF 108 ENDIF 109 109 110 110 s_timer%l_tdone = .FALSE. … … 112 112 s_timer%t_cpu = 0. 113 113 s_timer%t_clock = 0. 114 114 115 115 ! CPU time collection 116 116 CALL CPU_TIME( s_timer%t_cpu ) … … 136 136 CHARACTER(len=*), INTENT(in), OPTIONAL :: csection 137 137 ! 138 INTEGER :: ifinal_count, iperiods 138 INTEGER :: ifinal_count, iperiods 139 139 REAL(wp) :: zcpu_end, zmpitime,zcpu_raw,zclock_raw 140 140 ! … … 152 152 !!$ IF(associated(s_timer%parent_section))then 153 153 !!$ write(*,*) s_timer%cname,' <-- ', s_timer%parent_section%cname 154 !!$ ENDIF 154 !!$ ENDIF 155 155 156 156 ! No need to search ... : s_timer has the last value defined in start 157 157 ! s_timer => s_timer_root 158 ! DO WHILE( TRIM(s_timer%cname) /= TRIM(cdinfo) ) 158 ! DO WHILE( TRIM(s_timer%cname) /= TRIM(cdinfo) ) 159 159 ! IF( ASSOCIATED(s_timer%next) ) s_timer => s_timer%next 160 160 ! END DO 161 161 162 162 ! CPU time correction 163 163 zcpu_raw = zcpu_end - s_timer%t_cpu - t_overcpu ! total time including child … … 172 172 iperiods = ifinal_count - s_timer%ncount 173 173 IF( ifinal_count < s_timer%ncount ) & 174 iperiods = iperiods + s_timer%ncount_max 175 zclock_raw = REAL(iperiods) / s_timer%ncount_rate !- t_overclock 174 iperiods = iperiods + s_timer%ncount_max 175 zclock_raw = REAL(iperiods) / s_timer%ncount_rate !- t_overclock 176 176 s_timer%t_clock = zclock_raw - s_timer%tsub_clock 177 177 #endif 178 178 ! IF(s_timer%cname==trim('lbc_lnk_2d')) write(*,*) zclock_raw , s_timer%tsub_clock 179 179 180 180 ! Correction of parent section 181 181 IF( .NOT. PRESENT(csection) ) THEN 182 182 IF ( ASSOCIATED(s_timer%parent_section ) ) THEN 183 s_timer%parent_section%tsub_cpu = zcpu_raw + s_timer%parent_section%tsub_cpu 184 s_timer%parent_section%tsub_clock = zclock_raw + s_timer%parent_section%tsub_clock 183 s_timer%parent_section%tsub_cpu = zcpu_raw + s_timer%parent_section%tsub_cpu 184 s_timer%parent_section%tsub_clock = zclock_raw + s_timer%parent_section%tsub_clock 185 185 ENDIF 186 186 ENDIF 187 188 ! time diagnostics 189 s_timer%tsum_clock = s_timer%tsum_clock + s_timer%t_clock 187 188 ! time diagnostics 189 s_timer%tsum_clock = s_timer%tsum_clock + s_timer%t_clock 190 190 s_timer%tsum_cpu = s_timer%tsum_cpu + s_timer%t_cpu 191 191 !RB to use to get min/max during a time integration 192 192 ! IF( .NOT. l_initdone ) THEN 193 ! s_timer%tmin_clock = s_timer%t_clock 194 ! s_timer%tmin_cpu = s_timer%t_cpu 193 ! s_timer%tmin_clock = s_timer%t_clock 194 ! s_timer%tmin_cpu = s_timer%t_cpu 195 195 ! ELSE 196 ! s_timer%tmin_clock = MIN( s_timer%tmin_clock, s_timer%t_clock ) 197 ! s_timer%tmin_cpu = MIN( s_timer%tmin_cpu , s_timer%t_cpu ) 198 ! ENDIF 199 ! s_timer%tmax_clock = MAX( s_timer%tmax_clock, s_timer%t_clock ) 200 ! s_timer%tmax_cpu = MAX( s_timer%tmax_cpu , s_timer%t_cpu ) 196 ! s_timer%tmin_clock = MIN( s_timer%tmin_clock, s_timer%t_clock ) 197 ! s_timer%tmin_cpu = MIN( s_timer%tmin_cpu , s_timer%t_cpu ) 198 ! ENDIF 199 ! s_timer%tmax_clock = MAX( s_timer%tmax_clock, s_timer%t_clock ) 200 ! s_timer%tmax_cpu = MAX( s_timer%tmax_cpu , s_timer%t_cpu ) 201 201 ! 202 202 s_timer%tsub_clock = 0. … … 207 207 ! we come back 208 208 IF ( ASSOCIATED(s_timer%parent_section ) ) s_timer => s_timer%parent_section 209 209 210 210 ! write(*,*) 'end of stop ', s_timer%cname 211 211 212 212 END SUBROUTINE timing_stop 213 214 213 214 215 215 SUBROUTINE timing_init( clname ) 216 216 !!---------------------------------------------------------------------- … … 235 235 lwriter = .TRUE. 236 236 ENDIF 237 238 IF( lwriter) THEN 237 238 IF( lwriter) THEN 239 239 WRITE(numtime,*) 240 240 WRITE(numtime,*) ' CNRS - NERC - Met OFFICE - MERCATOR-ocean - CMCC - INGV' … … 246 246 WRITE(numtime,*) 247 247 WRITE(numtime,*) 248 ENDIF 249 248 ENDIF 249 250 250 ! Compute clock function overhead 251 #if defined key_mpp_mpi 251 #if defined key_mpp_mpi 252 252 t_overclock = MPI_WTIME() 253 253 t_overclock = MPI_WTIME() - t_overclock 254 #else 254 #else 255 255 CALL SYSTEM_CLOCK(COUNT_RATE=ncount_rate, COUNT_MAX=ncount_max) 256 256 CALL SYSTEM_CLOCK(COUNT = istart_count) … … 258 258 iperiods = ifinal_count - istart_count 259 259 IF( ifinal_count < istart_count ) & 260 iperiods = iperiods + ncount_max 260 iperiods = iperiods + ncount_max 261 261 t_overclock = REAL(iperiods) / ncount_rate 262 262 #endif … … 265 265 CALL CPU_TIME(zdum) 266 266 CALL CPU_TIME(t_overcpu) 267 268 ! End overhead omputation 269 t_overcpu = t_overcpu - zdum 270 t_overclock = t_overcpu + t_overclock 267 268 ! End overhead omputation 269 t_overcpu = t_overcpu - zdum 270 t_overclock = t_overcpu + t_overclock 271 271 272 272 ! Timing on date and time 273 273 CALL DATE_AND_TIME(cdate(1),ctime(1),czone,nvalues) 274 275 CALL CPU_TIME(t_cpu(1)) 276 #if defined key_mpp_mpi 274 275 CALL CPU_TIME(t_cpu(1)) 276 #if defined key_mpp_mpi 277 277 ! Start elapsed and CPU time counters 278 278 t_elaps(1) = MPI_WTIME() … … 280 280 CALL SYSTEM_CLOCK(COUNT_RATE=ncount_rate, COUNT_MAX=ncount_max) 281 281 CALL SYSTEM_CLOCK(COUNT = ncount) 282 #endif 282 #endif 283 283 ! 284 284 END SUBROUTINE timing_init … … 288 288 !!---------------------------------------------------------------------- 289 289 !! *** ROUTINE timing_finalize *** 290 !! ** Purpose : compute average time 290 !! ** Purpose : compute average time 291 291 !! write timing output file 292 292 !!---------------------------------------------------------------------- … … 295 295 INTEGER :: ji 296 296 LOGICAL :: ll_ord, ll_averep 297 CHARACTER(len=120) :: clfmt 297 CHARACTER(len=120) :: clfmt 298 298 REAL(wp), DIMENSION(:), ALLOCATABLE :: timing_glob 299 299 REAL(wp) :: zsypd ! simulated years per day (Balaji 2017) … … 301 301 302 302 ll_averep = .TRUE. 303 303 304 304 ! total CPU and elapse 305 305 CALL CPU_TIME(t_cpu(2)) … … 311 311 iperiods = nfinal_count - ncount 312 312 IF( nfinal_count < ncount ) & 313 iperiods = iperiods + ncount_max 313 iperiods = iperiods + ncount_max 314 314 t_elaps(2) = REAL(iperiods) / ncount_rate - t_overclock 315 #endif 315 #endif 316 316 317 317 ! End of timings on date & time 318 318 CALL DATE_AND_TIME(cdate(2),ctime(2),czone,nvalues) 319 319 320 320 ! Compute the numer of routines 321 nsize = 0 321 nsize = 0 322 322 s_timer => s_timer_root 323 323 DO WHILE( ASSOCIATED(s_timer) ) … … 334 334 IF( lwriter ) WRITE(numtime,*) 335 335 ll_averep = .FALSE. 336 ENDIF 337 338 #if defined key_mpp_mpi 336 ENDIF 337 338 #if defined key_mpp_mpi 339 339 ! in MPI gather some info 340 340 ALLOCATE( all_etime(jpnij), all_ctime(jpnij) ) … … 349 349 #else 350 350 tot_etime = t_elaps(2) 351 tot_ctime = t_cpu (2) 351 tot_ctime = t_cpu (2) 352 352 #endif 353 353 354 354 ! write output file 355 IF( lwriter ) WRITE(numtime,*) 356 IF( lwriter ) WRITE(numtime,*) 355 IF( lwriter ) WRITE(numtime,*) 356 IF( lwriter ) WRITE(numtime,*) 357 357 IF( lwriter ) WRITE(numtime,*) 'Total timing (sum) :' 358 358 IF( lwriter ) WRITE(numtime,*) '--------------------' 359 359 IF( lwriter ) WRITE(numtime,"('Elapsed Time (s) CPU Time (s)')") 360 360 IF( lwriter ) WRITE(numtime,'(5x,f12.3,1x,f12.3)') tot_etime, tot_ctime 361 IF( lwriter ) WRITE(numtime,*) 361 IF( lwriter ) WRITE(numtime,*) 362 362 #if defined key_mpp_mpi 363 363 IF( ll_averep ) CALL waver_info 364 364 CALL wmpi_info 365 #endif 365 #endif 366 366 IF( lwriter ) CALL wcurrent_info 367 367 368 368 clfmt='(1X,"Timing started on ",2(A2,"/"),A4," at ",2(A2,":"),A2," MET ",A3,":",A2," from GMT")' 369 IF( lwriter ) WRITE(numtime, TRIM(clfmt)) & 369 IF( lwriter ) WRITE(numtime, TRIM(clfmt)) & 370 370 & cdate(1)(7:8), cdate(1)(5:6), cdate(1)(1:4), & 371 371 & ctime(1)(1:2), ctime(1)(3:4), ctime(1)(5:6), & 372 & czone(1:3), czone(4:5) 372 & czone(1:3), czone(4:5) 373 373 clfmt='(1X, "Timing ended on ",2(A2,"/"),A4," at ",2(A2,":"),A2," MET ",A3,":",A2," from GMT")' 374 IF( lwriter ) WRITE(numtime, TRIM(clfmt)) & 374 IF( lwriter ) WRITE(numtime, TRIM(clfmt)) & 375 375 & cdate(2)(7:8), cdate(2)(5:6), cdate(2)(1:4), & 376 376 & ctime(2)(1:2), ctime(2)(3:4), ctime(2)(5:6), & … … 402 402 ENDIF 403 403 DEALLOCATE(timing_glob) 404 #endif 405 406 IF( lwriter ) CLOSE(numtime) 404 #endif 405 406 IF( lwriter ) CLOSE(numtime) 407 407 ! 408 408 END SUBROUTINE timing_finalize 409 409 410 410 411 411 SUBROUTINE wcurrent_info … … 415 415 !!---------------------------------------------------------------------- 416 416 LOGICAL :: ll_ord 417 CHARACTER(len=2048) :: clfmt 418 419 ! reorder the current list by elapse time 417 CHARACTER(len=2048) :: clfmt 418 419 ! reorder the current list by elapse time 420 420 s_wrk => NULL() 421 421 s_timer => s_timer_root … … 425 425 DO WHILE ( ASSOCIATED( s_timer%next ) ) 426 426 IF (.NOT. ASSOCIATED(s_timer%next)) EXIT 427 IF ( s_timer%tsum_clock < s_timer%next%tsum_clock ) THEN 427 IF ( s_timer%tsum_clock < s_timer%next%tsum_clock ) THEN 428 428 ALLOCATE(s_wrk) 429 429 s_wrk = s_timer%next 430 430 CALL insert (s_timer, s_timer_root, s_wrk) 431 CALL suppress(s_timer%next) 431 CALL suppress(s_timer%next) 432 432 ll_ord = .FALSE. 433 CYCLE 433 CYCLE 434 434 ENDIF 435 435 IF( ASSOCIATED(s_timer%next) ) s_timer => s_timer%next … … 437 437 IF( ll_ord ) EXIT 438 438 END DO 439 439 440 440 ! write current info 441 441 WRITE(numtime,*) 'Detailed timing for proc :', narea-1 … … 443 443 WRITE(numtime,*) 'Section ', & 444 444 & 'Elapsed Time (s) ','Elapsed Time (%) ', & 445 & 'CPU Time(s) ','CPU Time (%) ','CPU/Elapsed ','Frequency' 446 s_timer => s_timer_root 445 & 'CPU Time(s) ','CPU Time (%) ','CPU/Elapsed ','Frequency' 446 s_timer => s_timer_root 447 447 clfmt = '(1x,a,4x,f12.3,6x,f12.3,x,f12.3,2x,f12.3,6x,f7.3,2x,i9)' 448 448 DO WHILE ( ASSOCIATED(s_timer) ) … … 455 455 END DO 456 456 WRITE(numtime,*) 457 ! 457 ! 458 458 END SUBROUTINE wcurrent_info 459 459 460 #if defined key_mpp_mpi 460 #if defined key_mpp_mpi 461 461 SUBROUTINE waver_info 462 462 !!---------------------------------------------------------------------- … … 470 470 INTEGER :: icode 471 471 INTEGER :: ierr 472 LOGICAL :: ll_ord 473 CHARACTER(len=200) :: clfmt 474 475 ! Initialised the global strucutre 472 LOGICAL :: ll_ord 473 CHARACTER(len=200) :: clfmt 474 475 ! Initialised the global strucutre 476 476 ALLOCATE(sl_timer_glob_root, Stat=ierr) 477 477 IF(ierr /= 0)THEN … … 524 524 sl_timer_ave_root%prev => NULL() 525 525 ALLOCATE(sl_timer_ave) 526 sl_timer_ave => sl_timer_ave_root 527 ENDIF 526 sl_timer_ave => sl_timer_ave_root 527 ENDIF 528 528 529 529 ! Gather info from all processors … … 552 552 sl_timer_glob%next%next => NULL() 553 553 sl_timer_glob => sl_timer_glob%next 554 ENDIF 554 ENDIF 555 555 s_timer => s_timer%next 556 END DO 557 558 IF( narea == 1 ) THEN 556 END DO 557 558 IF( narea == 1 ) THEN 559 559 ! Compute some stats 560 560 sl_timer_glob => sl_timer_glob_root … … 570 570 ! 571 571 IF( ASSOCIATED(sl_timer_glob%next) ) THEN 572 ALLOCATE(sl_timer_ave%next) 572 ALLOCATE(sl_timer_ave%next) 573 573 sl_timer_ave%next%prev => sl_timer_ave 574 sl_timer_ave%next%next => NULL() 574 sl_timer_ave%next%next => NULL() 575 575 sl_timer_ave => sl_timer_ave%next 576 576 ENDIF 577 sl_timer_glob => sl_timer_glob%next 577 sl_timer_glob => sl_timer_glob%next 578 578 END DO 579 580 ! reorder the averaged list by CPU time 579 580 ! reorder the averaged list by CPU time 581 581 s_wrk => NULL() 582 582 sl_timer_ave => sl_timer_ave_root … … 588 588 IF( .NOT. ASSOCIATED(sl_timer_ave%next) ) EXIT 589 589 590 IF ( sl_timer_ave%tsum_clock < sl_timer_ave%next%tsum_clock ) THEN 590 IF ( sl_timer_ave%tsum_clock < sl_timer_ave%next%tsum_clock ) THEN 591 591 ALLOCATE(s_wrk) 592 592 ! Copy data into the new object pointed to by s_wrk … … 595 595 CALL insert (sl_timer_ave, sl_timer_ave_root, s_wrk) 596 596 ! Remove the old object from the list 597 CALL suppress(sl_timer_ave%next) 597 CALL suppress(sl_timer_ave%next) 598 598 ll_ord = .FALSE. 599 CYCLE 600 ENDIF 599 CYCLE 600 ENDIF 601 601 IF( ASSOCIATED(sl_timer_ave%next) ) sl_timer_ave => sl_timer_ave%next 602 END DO 602 END DO 603 603 IF( ll_ord ) EXIT 604 604 END DO … … 609 609 WRITE(numtime,"('Section',13x,'Elap. Time(s)',2x,'Elap. Time(%)',2x, & 610 610 & 'CPU Time(s)',2x,'CPU Time(%)',2x,'CPU/Elap',1x, & 611 & 'Max elap(%)',2x,'Min elap(%)',2x, & 611 & 'Max elap(%)',2x,'Min elap(%)',2x, & 612 612 & 'Freq')") 613 sl_timer_ave => sl_timer_ave_root 613 sl_timer_ave => sl_timer_ave_root 614 614 clfmt = '((A),E15.7,2x,f6.2,5x,f12.2,5x,f6.2,5x,f7.2,2x,f12.2,4x,f6.2,2x,f9.2)' 615 615 DO WHILE ( ASSOCIATED(sl_timer_ave) ) 616 IF( sl_timer_ave%tsum_clock > 0. ) & 616 IF( sl_timer_ave%tsum_clock > 0. ) & 617 617 WRITE(numtime,TRIM(clfmt)) sl_timer_ave%cname(1:18), & 618 618 & sl_timer_ave%tsum_clock,sl_timer_ave%tsum_clock*100.*jpnij/tot_etime, & … … 630 630 ! 631 631 DEALLOCATE(sl_timer_glob_root) 632 ! 632 ! 633 633 END SUBROUTINE waver_info 634 635 634 635 636 636 SUBROUTINE wmpi_info 637 637 !!---------------------------------------------------------------------- 638 638 !! *** ROUTINE wmpi_time *** 639 !! ** Purpose : compute and write a summary of MPI infos 640 !!---------------------------------------------------------------------- 641 ! 639 !! ** Purpose : compute and write a summary of MPI infos 640 !!---------------------------------------------------------------------- 641 ! 642 642 INTEGER :: idum, icode 643 643 INTEGER, ALLOCATABLE, DIMENSION(:) :: iall_rank … … 648 648 CHARACTER(LEN=128), dimension(8) :: cllignes 649 649 CHARACTER(LEN=128) :: clhline, clstart_date, clfinal_date 650 CHARACTER(LEN=2048) :: clfmt 651 650 CHARACTER(LEN=2048) :: clfmt 651 652 652 ! Gather all times 653 653 ALLOCATE( zall_ratio(jpnij), iall_rank(jpnij) ) 654 654 IF( narea == 1 ) THEN 655 655 iall_rank(:) = (/ (idum,idum=0,jpnij-1) /) 656 656 657 657 ! Compute elapse user time 658 658 zavg_etime = tot_etime/REAL(jpnij,wp) … … 664 664 zmax_ctime = MAXVAL(all_ctime(:)) 665 665 zmin_ctime = MINVAL(all_ctime(:)) 666 666 667 667 ! Compute cpu/elapsed ratio 668 668 zall_ratio(:) = all_ctime(:) / all_etime(:) … … 670 670 zavg_ratio = SUM(zall_ratio(:))/REAL(jpnij,wp) 671 671 zmax_ratio = MAXVAL(zall_ratio(:)) 672 zmin_ratio = MINVAL(zall_ratio(:)) 673 672 zmin_ratio = MINVAL(zall_ratio(:)) 673 674 674 ! Output Format 675 675 clhline ='1x,13("-"),"|",18("-"),"|",14("-"),"|",18("-"),/,' … … 693 693 zmax_etime, zmax_ctime, zmax_ratio, & 694 694 zavg_etime, zavg_ctime, zavg_ratio 695 WRITE(numtime,*) 695 WRITE(numtime,*) 696 696 END IF 697 697 ! … … 699 699 ! 700 700 END SUBROUTINE wmpi_info 701 #endif 701 #endif 702 702 703 703 … … 705 705 !!---------------------------------------------------------------------- 706 706 !! *** ROUTINE timing_ini_var *** 707 !! ** Purpose : create timing structure 707 !! ** Purpose : create timing structure 708 708 !!---------------------------------------------------------------------- 709 709 CHARACTER(len=*), INTENT(in) :: cdinfo 710 710 LOGICAL :: ll_section 711 711 712 712 ! 713 713 IF( .NOT. ASSOCIATED(s_timer_root) ) THEN … … 760 760 ! case of already existing area (typically inside a loop) 761 761 ! write(*,*) 'in ini_var for routine : ', cdinfo 762 DO WHILE( ASSOCIATED(s_timer) ) 762 DO WHILE( ASSOCIATED(s_timer) ) 763 763 IF( TRIM(s_timer%cname) .EQ. TRIM(cdinfo) ) THEN 764 ! write(*,*) 'in ini_var for routine : ', cdinfo,' we return' 764 ! write(*,*) 'in ini_var for routine : ', cdinfo,' we return' 765 765 RETURN ! cdinfo is already in the chain 766 766 ENDIF … … 775 775 776 776 ! write(*,*) 'after search', s_timer%cname 777 ! cdinfo is not part of the chain so we add it with initialisation 777 ! cdinfo is not part of the chain so we add it with initialisation 778 778 ALLOCATE(s_timer%next) 779 779 ! write(*,*) 'after allocation of next' 780 780 781 781 s_timer%next%cname = cdinfo 782 782 s_timer%next%t_cpu = 0._wp 783 783 s_timer%next%t_clock = 0._wp 784 784 s_timer%next%tsum_cpu = 0._wp 785 s_timer%next%tsum_clock = 0._wp 785 s_timer%next%tsum_clock = 0._wp 786 786 s_timer%next%tmax_cpu = 0._wp 787 787 s_timer%next%tmax_clock = 0._wp … … 799 799 s_timer%next%next => NULL() 800 800 s_timer => s_timer%next 801 ENDIF 801 ENDIF 802 802 ! write(*,*) 'after allocation' 803 803 ! … … 808 808 !!---------------------------------------------------------------------- 809 809 !! *** ROUTINE timing_reset *** 810 !! ** Purpose : go to root of timing tree 811 !!---------------------------------------------------------------------- 812 l_initdone = .TRUE. 810 !! ** Purpose : go to root of timing tree 811 !!---------------------------------------------------------------------- 812 l_initdone = .TRUE. 813 813 ! IF(lwp) WRITE(numout,*) 814 814 ! IF(lwp) WRITE(numout,*) 'timing_reset : instrumented routines for timing' … … 821 821 822 822 RECURSIVE SUBROUTINE timing_list(ptr) 823 823 824 824 TYPE(timer), POINTER, INTENT(inout) :: ptr 825 825 ! 826 826 IF( ASSOCIATED(ptr%next) ) CALL timing_list(ptr%next) 827 IF(lwp) WRITE(numout,*)' ', ptr%cname 827 IF(lwp) WRITE(numout,*)' ', ptr%cname 828 828 ! 829 829 END SUBROUTINE timing_list … … 837 837 TYPE(timer), POINTER, INTENT(inout) :: sd_current, sd_root, sd_ptr 838 838 ! 839 839 840 840 IF( ASSOCIATED( sd_current, sd_root ) ) THEN 841 841 ! If our current element is the root element then … … 852 852 ! to ALLOCATE memory to this pointer will fail. 853 853 sd_ptr => NULL() 854 ! 854 ! 855 855 END SUBROUTINE insert 856 857 856 857 858 858 SUBROUTINE suppress(sd_ptr) 859 859 !!---------------------------------------------------------------------- … … 864 864 ! 865 865 TYPE(timer), POINTER :: sl_temp 866 866 867 867 sl_temp => sd_ptr 868 sd_ptr => sd_ptr%next 868 sd_ptr => sd_ptr%next 869 869 IF ( ASSOCIATED(sl_temp%next) ) sl_temp%next%prev => sl_temp%prev 870 870 DEALLOCATE(sl_temp)
Note: See TracChangeset
for help on using the changeset viewer.