Changeset 4139 for trunk/LMDZ.COMMON/libf/misc
- Timestamp:
- Mar 18, 2026, 11:47:32 AM (2 weeks ago)
- Location:
- trunk/LMDZ.COMMON/libf/misc
- Files:
-
- 1 edited
- 1 moved
-
job_mod.F90 (moved) (moved from trunk/LMDZ.COMMON/libf/evolution/job.F90) (14 diffs)
-
parse_args_mod.F90 (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/LMDZ.COMMON/libf/misc/job_mod.F90
r4138 r4139 1 MODULE job 1 MODULE job_mod 2 2 3 3 !----------------------------------------------------------------------- 4 4 ! NAME 5 ! job 5 ! job_mod 6 6 ! 7 7 ! DESCRIPTION 8 ! Management of memory throughout the modules of the code.8 ! Tools to retieve job information of the program. 9 9 ! 10 10 ! AUTHORS & DATE … … 15 15 !----------------------------------------------------------------------- 16 16 17 ! DEPENDENCIES18 ! ------------19 use numerics, only: dp, di, k420 21 17 ! DECLARATION 22 18 ! ----------- … … 25 21 ! PARAMETERS 26 22 ! ---------- 27 real (dp) :: timelimit = 86400._dp! Time limit for the job: 86400 s = 24 h by default28 real (dp), parameter :: antetime = 3600._dp! Anticipation time to prevent reaching the job time limit: 3600 s = 1 h by default29 logical (k4) :: timewall = .false.! Flag to enable the program self-termination before timeout23 real :: timelimit = 86400. ! Time limit for the job: 86400 s = 24 h by default 24 real, parameter :: antetime = 3600. ! Anticipation time to prevent reaching the job time limit: 3600 s = 1 h by default 25 logical :: timewall = .false. ! Flag to enable the program self-termination before timeout 30 26 31 27 contains … … 48 44 !----------------------------------------------------------------------- 49 45 50 ! DEPENDENCIES51 ! ------------52 use stoppage, only: stop_clean53 54 46 ! DECLARATION 55 47 ! ----------- … … 62 54 ! LOCAL VARIABLES 63 55 ! --------------- 64 integer (di):: sts56 integer :: sts 65 57 character(256) :: tmp 66 58 … … 82 74 endif 83 75 84 call stop_clean(__FILE__,__LINE__,"neither SLURM_JOB_ID nor PBS_JOBID found in environment!",1) 76 error stop 'Error: neither SLURM_JOB_ID nor PBS_JOBID found in environment!' 85 77 86 78 END SUBROUTINE get_job_id … … 104 96 !----------------------------------------------------------------------- 105 97 106 ! DEPENDENCIES107 ! ------------108 use stoppage, only: stop_clean109 110 98 ! DECLARATION 111 99 ! ----------- … … 118 106 ! LOCAL VARIABLES 119 107 ! --------------- 120 logical (k4):: num_str108 logical :: num_str 121 109 character(256) :: chtimelimit ! Time limit for the job outputted by the SLURM or PBS/TORQUE command 122 integer (di):: i, ierr, funit, cstat, days, hours, minutes, seconds110 integer :: i, ierr, funit, cstat, days, hours, minutes, seconds 123 111 character(1) :: sep 124 112 … … 133 121 endif 134 122 enddo 135 if (.not. num_str) call stop_clean(__FILE__,__LINE__,"job ID must be numeric!",1)123 if (.not. num_str) error stop "Error: job ID must be numeric!" 136 124 137 125 ! Try SLURM (squeue) … … 141 129 call execute_command_line('qstat -f '//trim(adjustl(jobid))//' | grep "Walltime" | awk ''{print $3}'' > tmp_timelimit.txt',cmdstat = cstat) 142 130 if (cstat > 0) then 143 call stop_clean(__FILE__,__LINE__,'command execution failed!',1)131 error stop 'Error: command execution failed!' 144 132 else if (cstat < 0) then 145 call stop_clean(__FILE__,__LINE__,'command execution not supported (neither SLURM nor PBS/TORQUE is installed)!',1)133 error stop 'Error: command execution not supported (neither SLURM nor PBS/TORQUE is installed)!' 146 134 endif 147 135 endif … … 149 137 ! Read the output 150 138 open(newunit = funit,file = 'tmp_timelimit.txt',status = 'old',form = 'formatted',action = 'read',iostat = ierr) 151 if (ierr /= 0) call stop_clean(__FILE__,__LINE__,'error opening file "tmp_timelimit.txt"!',ierr)139 if (ierr /= 0) error stop 'Error: error opening file "tmp_timelimit.txt"!' 152 140 read(funit,'(a)') chtimelimit 153 141 close(funit) … … 157 145 call execute_command_line('rm tmp_timelimit.txt',cmdstat = cstat) 158 146 if (cstat > 0) then 159 call stop_clean(__FILE__,__LINE__,'command execution failed!',1)147 error stop 'Error: command execution failed!' 160 148 else if (cstat < 0) then 161 call stop_clean(__FILE__,__LINE__,'command execution not supported!',1)149 error stop 'Error: command execution not supported!' 162 150 endif 163 151 … … 165 153 if (index(chtimelimit,'-') > 0) then ! Format "D-HH:MM:SS" 166 154 read(chtimelimit,'(i1,a1,i2,a1,i2,a1,i2)') days, sep, hours, sep, minutes, sep, seconds 167 timelimit = real(days ,dp)*86400._dp + real(hours,dp)*3600._dp + real(minutes,dp)*60._dp + real(seconds,dp)155 timelimit = real(days)*86400. + real(hours)*3600. + real(minutes)*60. + real(seconds) 168 156 else if (index(chtimelimit,':') > 0 .and. len_trim(chtimelimit) > 5) then ! Format "HH:MM:SS" 169 157 read(chtimelimit,'(i2,a1,i2,a1,i2)') hours, sep, minutes, sep, seconds 170 timelimit = real(hours ,dp)*3600._dp + real(minutes,dp)*60._dp + real(seconds,dp)158 timelimit = real(hours)*3600. + real(minutes)*60. + real(seconds) 171 159 else ! Format "MM:SS" 172 160 read(chtimelimit,'(i2,a1,i2)') minutes, sep, seconds 173 timelimit = real(minutes ,dp)*60._dp + real(seconds,dp)161 timelimit = real(minutes)*60. + real(seconds) 174 162 endif 175 163 … … 179 167 !======================================================================= 180 168 181 END MODULE job 169 END MODULE job_mod -
trunk/LMDZ.COMMON/libf/misc/parse_args_mod.F90
r4138 r4139 14 14 use pgrm_version_mod, only: print_pgrm_version 15 15 #endif 16 use job ,only: get_job_id, get_job_timelimit16 use job_mod, only: get_job_id, get_job_timelimit 17 17 18 18 implicit none
Note: See TracChangeset
for help on using the changeset viewer.
