Writes the MPI time to a file.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(timer), | intent(in) | :: | this | |||
character(len=*), | intent(in) | :: | file_name |
impure subroutine mtimer_write(this, file_name) 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 MPI time to the file write(nunit, '(g0)') this%mpi_time ! Close the file close(nunit) end subroutine mtimer_write