Skip to content

Commit 4d8e6aa

Browse files
Merge pull request #86 from FluidNumerics/feature/wall-time-monitoring
Add wall-time, wall-time per time step, sim-time/wall-time
2 parents aa8ce58 + ea426a0 commit 4d8e6aa

File tree

1 file changed

+44
-0
lines changed

1 file changed

+44
-0
lines changed

src/SELF_Model.f90

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -768,14 +768,58 @@ subroutine ForwardStep_Model(this,tn,dt,ioInterval)
768768
! Local
769769
real(prec) :: targetTime,tNext
770770
integer :: i,nIO
771+
character(10) :: ntimesteps
772+
real(prec) :: t1,t2
773+
character(len=:),allocatable :: str
774+
character(len=20) :: modelTime
771775

772776
this%dt = dt
773777
targetTime = tn
774778

779+
write(ntimesteps,"(I10)") int(ioInterval/this%dt)
775780
nIO = int((targetTime-this%t)/ioInterval)
776781
do i = 1,nIO
782+
777783
tNext = this%t+ioInterval
784+
call cpu_time(t1)
778785
call this%timeIntegrator(tNext)
786+
call cpu_time(t2)
787+
788+
open(output_unit,ENCODING='utf-8')
789+
write(output_unit,'(A)',ADVANCE='no') ' --------------------------------------------------------'
790+
write(output_unit,'(A)',ADVANCE='yes') '----------------------------------------------------------------------- '
791+
write(output_unit,'(A)',ADVANCE='no') ' <><><><><><><><><><><><><><><><><><><><><><><><><><><><>'
792+
write(output_unit,'(A)',ADVANCE='yes') '<><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><> '
793+
write(output_unit,'(A)',ADVANCE='no') ' --------------------------------------------------------'
794+
write(output_unit,'(A)',ADVANCE='yes') '------------------------------------------------------------------------ '
795+
write(modelTime,"(ES16.7E3)") this%t
796+
! Write the wall-time
797+
write(output_unit,'(1x, A," : ")',ADVANCE='no') __FILE__
798+
str = 'tᵢ ='//trim(modelTime)
799+
write(output_unit,'(A)',ADVANCE='no') str
800+
str = ' | Time to complete '//trim(ntimesteps)//' time steps (s) : '
801+
write(output_unit,'(A)',ADVANCE='no') str
802+
write(str,"(ES16.7E3)") t2-t1
803+
write(output_unit,'(A)',ADVANCE='yes') str
804+
805+
! Wall-time per time step
806+
write(output_unit,'(1x, A," : ")',ADVANCE='no') __FILE__
807+
str = 'tᵢ ='//trim(modelTime)
808+
write(output_unit,'(A)',ADVANCE='no') str
809+
str = ' | Wall-time per time step : '
810+
write(output_unit,'(A)',ADVANCE='no') str
811+
write(str,"(ES16.7E3)")(t2-t1)/(floor(ioInterval/this%dt))
812+
write(output_unit,'(A)',ADVANCE='yes') str
813+
814+
! Wall-time per simulation time
815+
write(output_unit,'(1x, A," : ")',ADVANCE='no') __FILE__
816+
str = 'tᵢ ='//trim(modelTime)
817+
write(output_unit,'(A)',ADVANCE='no') str
818+
str = ' | Wall-time per simulation time : '
819+
write(output_unit,'(A)',ADVANCE='no') str
820+
write(str,"(ES16.7E3)")(t2-t1)/(ioInterval)
821+
write(output_unit,'(A)',ADVANCE='yes') str
822+
779823
this%t = tNext
780824

781825
call this%CalculateEntropy()

0 commit comments

Comments
 (0)