Skip to content

Commit

Permalink
Write outputs to a .txt file
Browse files Browse the repository at this point in the history
  • Loading branch information
gha3mi committed May 8, 2024
1 parent 59f4290 commit bcabea3
Show file tree
Hide file tree
Showing 51 changed files with 33 additions and 57 deletions.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
/build
/doc
/mod
/mod
*.txt
2 changes: 1 addition & 1 deletion example/example2.f90
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,6 @@ program example2
call sleep(1) ! Perform operations ntimes
end do
call t%timer_stop(nloops = nloops, message = 'Elapsed time:', print = .true., color='green') ! nloops, message, print and color are optional.
call t%timer_write('example/example2_etimes') ! Optionally, write the elapsed time to a file
call t%timer_write('example/example2_etimes.txt') ! Optionally, write the elapsed time to a file

end program example2
2 changes: 0 additions & 2 deletions example/example2_etimes

This file was deleted.

2 changes: 1 addition & 1 deletion example/example4.f90
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,6 @@ program example4
call sleep(1) ! Perform operations ntimes
end do
call t%ctimer_stop(nloops = nloops, message = 'CPU time:', print = .true., color='yellow') ! nloops, message, print and color are optional.
call t%ctimer_write('example/example4_ctimes') ! Optionally, write the elapsed time to a file
call t%ctimer_write('example/example4_ctimes.txt') ! Optionally, write the elapsed time to a file

end program example4
2 changes: 0 additions & 2 deletions example/example4_ctimes

This file was deleted.

2 changes: 1 addition & 1 deletion example/example6.f90
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,6 @@ program example6
call sleep(1) ! Perform operations ntimes
end do
call t%dtimer_stop(nloops = nloops, message = 'Elapsed time:', print = .true., color='red') ! nloops, message, print and color are optional.
call t%dtimer_write('example/example6_etimes') ! Optionally, write the elapsed time to a file
call t%dtimer_write('example/example6_etimes.txt') ! Optionally, write the elapsed time to a file

end program example6
1 change: 0 additions & 1 deletion example/example6_etimes

This file was deleted.

2 changes: 1 addition & 1 deletion test/test10.f90
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,12 @@ program test10

implicit none

#if defined(USE_MPI)
type(timer) :: t
type(unit_test) :: ut
integer :: ierr


#if defined(USE_MPI)
! MPI time
call mpi_init(ierr)
call t%mtimer_start()
Expand Down
4 changes: 2 additions & 2 deletions test/test11.f90
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,13 @@ program test11

implicit none

#if defined(USE_MPI)
type(timer) :: t
type(unit_test) :: ut
integer :: nl, nloops=3
integer :: ierr


#if defined(USE_MPI)
! MPI time with nloops
call mpi_init(ierr)
call t%mtimer_start()
Expand All @@ -21,7 +21,7 @@ program test11
end do
call t%mtimer_stop(nloops = nloops, message = 'MPI time:')
call mpi_finalize(ierr)
call t%mtimer_write('test/test11_mtimes') ! Optionally, write the elapsed time to a file
call t%mtimer_write('test/test11_mtimes.txt') ! Optionally, write the elapsed time to a file

call ut%check(res=t%mpi_time, expected=1.0_rk, tol=1.0e-1_rk, msg='test11')

Expand Down
1 change: 0 additions & 1 deletion test/test11_mtimes

This file was deleted.

2 changes: 1 addition & 1 deletion test/test12.f90
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,13 @@ program test12

implicit none

#if defined(USE_MPI)
type(timer) :: t
type(unit_test) :: ut
integer :: nl, nloops=3
integer :: ierr


#if defined(USE_MPI)
! MPI time with nloops
call mpi_init(ierr)
call t%mtimer_start()
Expand Down
1 change: 0 additions & 1 deletion test/test12_mtimes

This file was deleted.

2 changes: 1 addition & 1 deletion test/test14.f90
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ program test14
call sleep(1) ! Perform operations ntimes
end do
call t%timer_stop(nloops = nloops, message = 'Elapsed time:', print=.false.)
call t%timer_write('test/test14_etimes') ! Optionally, write the elapsed time to a file
call t%timer_write('test/test14_etimes.txt') ! Optionally, write the elapsed time to a file

call ut%check(res=t%elapsed_time, expected=1.0_rk, tol=1.0e-1_rk, msg='test14')

Expand Down
1 change: 0 additions & 1 deletion test/test14_etimes

This file was deleted.

2 changes: 1 addition & 1 deletion test/test15.f90
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ program test15
call sleep(1) ! Perform operations ntimes
end do
call t%timer_stop(message = 'Elapsed time:', print=.false.)
call t%timer_write('test/test15_etimes') ! Optionally, write the elapsed time to a file
call t%timer_write('test/test15_etimes.txt') ! Optionally, write the elapsed time to a file

call ut%check(res=t%elapsed_time, expected=real(nloops,rk)*1.0_rk, tol=1.0e-1_rk, msg='test15')

Expand Down
1 change: 0 additions & 1 deletion test/test15_etimes

This file was deleted.

2 changes: 1 addition & 1 deletion test/test17.f90
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ program test17
call sleep(1) ! Perform operations ntimes
end do
call t%ctimer_stop(nloops = nloops, message = 'CPU time:', print=.false.)
call t%ctimer_write('test/test17_ctimes') ! Optionally, write the elapsed time to a file
call t%ctimer_write('test/test17_ctimes.txt') ! Optionally, write the elapsed time to a file

end program test17

1 change: 0 additions & 1 deletion test/test17_ctimes

This file was deleted.

2 changes: 1 addition & 1 deletion test/test18.f90
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ program test18
call sleep(1) ! Perform operations ntimes
end do
call t%ctimer_stop(message = 'CPU time:', print=.false.)
call t%ctimer_write('test/test18_ctimes') ! Optionally, write the elapsed time to a file
call t%ctimer_write('test/test18_ctimes.txt') ! Optionally, write the elapsed time to a file

end program test18

1 change: 0 additions & 1 deletion test/test18_ctimes

This file was deleted.

2 changes: 1 addition & 1 deletion test/test19.f90
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@ program test19

implicit none

#if defined(USE_OMP)
type(timer) :: t
type(unit_test) :: ut


#if defined(USE_OMP)
! OMP time
call t%otimer_start()
call sleep(1) ! Perform operations here
Expand Down
2 changes: 1 addition & 1 deletion test/test2.f90
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ program test2
call sleep(1) ! Perform operations ntimes
end do
call t%timer_stop(nloops = nloops, message = 'Elapsed time:')
call t%timer_write('test/test2_etimes') ! Optionally, write the elapsed time to a file
call t%timer_write('test/test2_etimes.txt') ! Optionally, write the elapsed time to a file

call ut%check(res=t%elapsed_time, expected=1.0_rk, tol=1.0e-1_rk, msg='test2')

Expand Down
4 changes: 2 additions & 2 deletions test/test20.f90
Original file line number Diff line number Diff line change
Expand Up @@ -6,19 +6,19 @@ program test20

implicit none

#if defined(USE_OMP)
type(timer) :: t
type(unit_test) :: ut
integer :: nl, nloops=3


#if defined(USE_OMP)
! OMP time with nloops
call t%otimer_start()
do nl = 1, nloops
call sleep(1) ! Perform operations ntimes
end do
call t%otimer_stop(nloops = nloops, message = 'OMP time:', print=.false.)
call t%otimer_write('test/test20_otimes') ! Optionally, write the elapsed time to a file
call t%otimer_write('test/test20_otimes.txt') ! Optionally, write the elapsed time to a file

call ut%check(res=t%omp_time, expected=1.0_rk, tol=1.0e-1_rk, msg='test20')

Expand Down
1 change: 0 additions & 1 deletion test/test20_otimes

This file was deleted.

2 changes: 1 addition & 1 deletion test/test21.f90
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,12 @@ program test21

implicit none

#if defined(USE_OMP)
type(timer) :: t
type(unit_test) :: ut
integer :: nl, nloops=3


#if defined(USE_OMP)
! OMP time with nloops
call t%otimer_start()
do nl = 1, nloops
Expand Down
1 change: 0 additions & 1 deletion test/test21_otimes

This file was deleted.

2 changes: 1 addition & 1 deletion test/test22.f90
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,12 @@ program test22

implicit none

#if defined(USE_MPI)
type(timer) :: t
type(unit_test) :: ut
integer :: ierr


#if defined(USE_MPI)
! MPI time
call mpi_init(ierr)
call t%mtimer_start()
Expand Down
4 changes: 2 additions & 2 deletions test/test23.f90
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,13 @@ program test23

implicit none

#if defined(USE_MPI)
type(timer) :: t
type(unit_test) :: ut
integer :: nl, nloops=3
integer :: ierr


#if defined(USE_MPI)
! MPI time with nloops
call mpi_init(ierr)
call t%mtimer_start()
Expand All @@ -21,7 +21,7 @@ program test23
end do
call t%mtimer_stop(nloops = nloops, message = 'MPI time:', print=.false.)
call mpi_finalize(ierr)
call t%mtimer_write('test/test23_mtimes') ! Optionally, write the elapsed time to a file
call t%mtimer_write('test/test23_mtimes.txt') ! Optionally, write the elapsed time to a file

call ut%check(res=t%mpi_time, expected=1.0_rk, tol=1.0e-1_rk, msg='test23')

Expand Down
1 change: 0 additions & 1 deletion test/test23_mtimes

This file was deleted.

2 changes: 1 addition & 1 deletion test/test24.f90
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,13 @@ program test24

implicit none

#if defined(USE_MPI)
type(timer) :: t
type(unit_test) :: ut
integer :: nl, nloops=3
integer :: ierr


#if defined(USE_MPI)
! MPI time with nloops
call mpi_init(ierr)
call t%mtimer_start()
Expand Down
1 change: 0 additions & 1 deletion test/test24_mtimes

This file was deleted.

2 changes: 1 addition & 1 deletion test/test26.f90
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ program test26
call sleep(1) ! Perform operations ntimes
end do
call t%dtimer_stop(nloops = nloops, message = 'Elapsed time:')
call t%dtimer_write('test/test26_etimes') ! Optionally, write the elapsed time to a file
call t%dtimer_write('test/test26_etimes.txt') ! Optionally, write the elapsed time to a file

call ut%check(res=t%elapsed_dtime, expected=1.0_rk, tol=1.0e-1_rk, msg='test26')

Expand Down
1 change: 0 additions & 1 deletion test/test26_etimes

This file was deleted.

2 changes: 1 addition & 1 deletion test/test27.f90
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ program test27
call sleep(1) ! Perform operations ntimes
end do
call t%dtimer_stop(message = 'Elapsed time:')
call t%dtimer_write('test/test27_etimes') ! Optionally, write the elapsed time to a file
call t%dtimer_write('test/test27_etimes.txt') ! Optionally, write the elapsed time to a file

call ut%check(res=t%elapsed_dtime, expected=real(nloops,rk)*1.0_rk, tol=1.0e-1_rk, msg='test27')

Expand Down
1 change: 0 additions & 1 deletion test/test27_etimes

This file was deleted.

2 changes: 1 addition & 1 deletion test/test29.f90
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ program test29
call sleep(1) ! Perform operations ntimes
end do
call t%dtimer_stop(nloops = nloops, message = 'Elapsed time:', print=.false.)
call t%dtimer_write('test/test29_etimes') ! Optionally, write the elapsed time to a file
call t%dtimer_write('test/test29_etimes.txt') ! Optionally, write the elapsed time to a file

call ut%check(res=t%elapsed_dtime, expected=1.0_rk, tol=1.0e-1_rk, msg='test29')

Expand Down
1 change: 0 additions & 1 deletion test/test29_etimes

This file was deleted.

1 change: 0 additions & 1 deletion test/test2_etimes

This file was deleted.

2 changes: 1 addition & 1 deletion test/test3.f90
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ program test3
call sleep(1) ! Perform operations ntimes
end do
call t%timer_stop(message = 'Elapsed time:')
call t%timer_write('test/test3_etimes') ! Optionally, write the elapsed time to a file
call t%timer_write('test/test3_etimes.txt') ! Optionally, write the elapsed time to a file

call ut%check(res=t%elapsed_time, expected=real(nloops,rk)*1.0_rk, tol=1.0e-1_rk, msg='test3')

Expand Down
2 changes: 1 addition & 1 deletion test/test30.f90
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ program test30
call sleep(1) ! Perform operations ntimes
end do
call t%dtimer_stop(message = 'Elapsed time:', print=.false.)
call t%dtimer_write('test/test30_etimes') ! Optionally, write the elapsed time to a file
call t%dtimer_write('test/test30_etimes.txt') ! Optionally, write the elapsed time to a file

call ut%check(res=t%elapsed_dtime, expected=real(nloops,rk)*1.0_rk, tol=1.0e-1_rk, msg='test30')

Expand Down
1 change: 0 additions & 1 deletion test/test30_etimes

This file was deleted.

1 change: 0 additions & 1 deletion test/test3_etimes

This file was deleted.

2 changes: 1 addition & 1 deletion test/test5.f90
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ program test5
call sleep(1) ! Perform operations ntimes
end do
call t%ctimer_stop(nloops = nloops, message = 'CPU time:')
call t%ctimer_write('test/test5_ctimes') ! Optionally, write the elapsed time to a file
call t%ctimer_write('test/test5_ctimes.txt') ! Optionally, write the elapsed time to a file

end program test5

1 change: 0 additions & 1 deletion test/test5_ctimes

This file was deleted.

2 changes: 1 addition & 1 deletion test/test6.f90
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ program test6
call sleep(1) ! Perform operations ntimes
end do
call t%ctimer_stop(message = 'CPU time:')
call t%ctimer_write('test/test6_ctimes') ! Optionally, write the elapsed time to a file
call t%ctimer_write('test/test6_ctimes.txt') ! Optionally, write the elapsed time to a file

end program test6

1 change: 0 additions & 1 deletion test/test6_ctimes

This file was deleted.

2 changes: 1 addition & 1 deletion test/test7.f90
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@ program test7

implicit none

#if defined(USE_OMP)
type(timer) :: t
type(unit_test) :: ut


#if defined(USE_OMP)
! OMP time
call t%otimer_start()
call sleep(1) ! Perform operations here
Expand Down
4 changes: 2 additions & 2 deletions test/test8.f90
Original file line number Diff line number Diff line change
Expand Up @@ -6,19 +6,19 @@ program test8

implicit none

#if defined(USE_OMP)
type(timer) :: t
type(unit_test) :: ut
integer :: nl, nloops=3


#if defined(USE_OMP)
! OMP time with nloops
call t%otimer_start()
do nl = 1, nloops
call sleep(1) ! Perform operations ntimes
end do
call t%otimer_stop(nloops = nloops, message = 'OMP time:')
call t%otimer_write('test/test8_otimes') ! Optionally, write the elapsed time to a file
call t%otimer_write('test/test8_otimes.txt') ! Optionally, write the elapsed time to a file

call ut%check(res=t%omp_time, expected=1.0_rk, tol=1.0e-1_rk, msg='test8')

Expand Down
1 change: 0 additions & 1 deletion test/test8_otimes

This file was deleted.

2 changes: 1 addition & 1 deletion test/test9.f90
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,12 @@ program test9

implicit none

#if defined(USE_OMP)
type(timer) :: t
type(unit_test) :: ut
integer :: nl, nloops=3


#if defined(USE_OMP)
! OMP time with nloops
call t%otimer_start()
do nl = 1, nloops
Expand Down
1 change: 0 additions & 1 deletion test/test9_otimes

This file was deleted.

0 comments on commit bcabea3

Please sign in to comment.