Skip to content
Snippets Groups Projects
pism.f90 802 B
program pism
use mpi
IMPLICIT NONE
integer old_comm, new_comm, ndims, ierr
parameter ( ndims = 2 )
integer irank, isize
integer dim_size(0:1), icoord(0:1)
logical periods(0:1), reorder

integer,dimension(8) :: t ! arguments for date_and_time
integer :: s1,s2,ms1,ms2  ! start and end times [ms]
real :: dt 

call MPI_INIT(ierr)

old_comm = MPI_COMM_WORLD
call MPI_COMM_RANK(old_comm, irank, ierr)
call MPI_COMM_SIZE(old_comm, isize, ierr)
write(*,*) 'PISM from rank ', irank,' of ',isize,' in total'

call date_and_time(values=t)
ms1=(t(5)*3600+t(6)*60+t(7))*1000+t(8)

! Get the command argument, e.g. sleep time in milliseconds:
dt = 10.0e3
do ! check time:
  call date_and_time(values=t)
  ms2=(t(5)*3600+t(6)*60+t(7))*1000+t(8)
  if(ms2-ms1>=dt)exit
enddo

call MPI_FINALIZE(ierr)

endprogram pism