C $Date: 1994/10/05 16:41:52 $ C $Revision: 2.2 $ C C C subroutine set_timers c implicit none double precision tcpu include 'COMMON.TIME1' C Diminish the assigned time limit a little so that there is some time to C end a batch job c timlim=batime-150.0 C Calculate the initial time, if it is not zero (e.g. for the SUN). stime=tcpu() cd print *,' in SET_TIMERS stime=',stime return end C------------------------------------------------------------------------------ logical function stopx(nf) C This function returns .true. in case of time up on the master node. implicit none include 'DIMENSIONS' include 'DIMENSIONS.ZSCOPT' integer nf logical ovrtim #ifdef MPI include 'mpif.h' include 'COMMON.MPI' #endif include 'COMMON.IOUNITS' include 'COMMON.TIME1' if (ovrtim()) then C Finish if time is up. stopx = .true. WhatsUp=1 else if (cutoffviol) then stopx = .true. WhatsUp=2 else stopx=.false. endif return end C-------------------------------------------------------------------------- logical function ovrtim() implicit none include 'COMMON.TIME1' real*8 tcpu,curtim curtim= tcpu() c print *,'curtim=',curtim,' timlim=',timlim C curtim is the current time in seconds. c ovrtim=(curtim .ge. timlim - safety ) c ovrtim does not work sometimes and crashes the program ! CHUUUJ ! c setting always to false ovrtim=.false. return end ************************************************************************** double precision function tcpu() implicit none include 'COMMON.TIME1' #ifdef ES9000 **************************** C Next definition for EAGLE (ibm-es9000) real*8 micseconds integer rcode tcpu=cputime(micseconds,rcode) tcpu=(micseconds/1.0E6) - stime **************************** #endif #ifdef SUN **************************** C Next definitions for sun REAL*8 ECPU,ETIME,ETCPU dimension tarray(2) tcpu=etime(tarray) tcpu=tarray(1) **************************** #endif #ifdef KSR **************************** C Next definitions for ksr C this function uses the ksr timer ALL_SECONDS from the PMON library to C return the elapsed time in seconds tcpu= all_seconds() - stime **************************** #endif #ifdef SGI **************************** C Next definitions for sgi real timar(2), etime, seconds seconds = etime(timar) Cd print *,'seconds=',seconds,' stime=',stime C usrsec = timar(1) C syssec = timar(2) tcpu=seconds - stime **************************** #endif #ifdef LINUX **************************** C Next definitions for sgi real timar(2), etime, seconds seconds = etime(timar) Cd print *,'seconds=',seconds,' stime=',stime C usrsec = timar(1) C syssec = timar(2) tcpu=seconds - stime **************************** #endif #ifdef CRAY **************************** C Next definitions for Cray C call date(curdat) C curdat=curdat(1:9) C call clock(curtim) C curtim=curtim(1:8) cpusec = second() tcpu=cpusec - stime **************************** #endif #ifdef AIX **************************** C Next definitions for RS6000 integer*4 i1,mclock i1 = mclock() tcpu = (i1+0.0D0)/100.0D0 #endif #ifdef WIN **************************** c next definitions for windows NT Digital fortran real time_real call cpu_time(time_real) tcpu = time_real #endif return end C--------------------------------------------------------------------------- subroutine dajczas(rntime,hrtime,mintime,sectime) implicit none include 'COMMON.IOUNITS' integer ihr,imn,isc real*8 rntime,hrtime,mintime,sectime hrtime=rntime/3600.0D0 hrtime=aint(hrtime) mintime=aint((rntime-3600.0D0*hrtime)/60.0D0) sectime=aint((rntime-3600.0D0*hrtime-60.0D0*mintime)+0.5D0) if (sectime.eq.60.0D0) then sectime=0.0D0 mintime=mintime+1.0D0 endif ihr=hrtime imn=mintime isc=sectime write (iout,328) ihr,imn,isc 328 FORMAT(//'***** Computation time: ',I4 ,' hours ',I2 , 1 ' minutes ', I2 ,' seconds *****') return end