otimer_write Subroutine

private impure subroutine otimer_write(this, file_name)

Uses

  • proc~~otimer_write~~UsesGraph proc~otimer_write timer%otimer_write omp_lib omp_lib proc~otimer_write->omp_lib

Writes the OMP time to a file.

Type Bound

timer

Arguments

Type IntentOptional Attributes Name
class(timer), intent(in) :: this
character(len=*), intent(in) :: file_name

Called by

proc~~otimer_write~~CalledByGraph proc~otimer_write timer%otimer_write program~test20 test20 program~test20->proc~otimer_write program~test21 test21 program~test21->proc~otimer_write program~test8 test8 program~test8->proc~otimer_write program~test9 test9 program~test9->proc~otimer_write

Source Code

   impure subroutine otimer_write(this, file_name)
      use omp_lib
      class(timer), intent(in) :: this
      character(*), intent(in) :: file_name
      logical                  :: file_exists
      integer                  :: nunit

      ! Check if the file exists
      inquire(file=file_name, exist=file_exists)

      ! Open the file in appropriate mode
      if (file_exists) then
         open(newunit=nunit, file=file_name, status='old', action='write', position='append')
      else
         open(newunit=nunit, file=file_name, status='new', action='write')
      end if

      ! Write the OMP time to the file
      write(nunit, '(g0)') this%omp_time

      ! Close the file
      close(nunit)

   end subroutine otimer_write