[1] | 1 | SUBROUTINE local_tremain( remaining_time ) |
---|
| 2 | |
---|
[1036] | 3 | !--------------------------------------------------------------------------------! |
---|
| 4 | ! This file is part of PALM. |
---|
| 5 | ! |
---|
| 6 | ! PALM is free software: you can redistribute it and/or modify it under the terms |
---|
| 7 | ! of the GNU General Public License as published by the Free Software Foundation, |
---|
| 8 | ! either version 3 of the License, or (at your option) any later version. |
---|
| 9 | ! |
---|
| 10 | ! PALM is distributed in the hope that it will be useful, but WITHOUT ANY |
---|
| 11 | ! WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR |
---|
| 12 | ! A PARTICULAR PURPOSE. See the GNU General Public License for more details. |
---|
| 13 | ! |
---|
| 14 | ! You should have received a copy of the GNU General Public License along with |
---|
| 15 | ! PALM. If not, see <http://www.gnu.org/licenses/>. |
---|
| 16 | ! |
---|
[1310] | 17 | ! Copyright 1997-2014 Leibniz Universitaet Hannover |
---|
[1036] | 18 | !--------------------------------------------------------------------------------! |
---|
| 19 | ! |
---|
[484] | 20 | ! Current revisions: |
---|
[1] | 21 | ! ----------------- |
---|
[1354] | 22 | ! |
---|
| 23 | ! |
---|
[1321] | 24 | ! Former revisions: |
---|
| 25 | ! ----------------- |
---|
| 26 | ! $Id: local_tremain.f90 1354 2014-04-08 15:22:57Z suehring $ |
---|
| 27 | ! |
---|
[1354] | 28 | ! 1353 2014-04-08 15:21:23Z heinze |
---|
| 29 | ! REAL constants provided with KIND-attribute |
---|
| 30 | ! |
---|
[1323] | 31 | ! 1322 2014-03-20 16:38:49Z raasch |
---|
| 32 | ! REAL constants defined as wp_kind |
---|
| 33 | ! |
---|
[1321] | 34 | ! 1320 2014-03-20 08:40:49Z raasch |
---|
[1320] | 35 | ! ONLY-attribute added to USE-statements, |
---|
| 36 | ! kind-parameters added to all INTEGER and REAL declaration statements, |
---|
| 37 | ! kinds are defined in new module kinds, |
---|
| 38 | ! revision history before 2012 removed, |
---|
| 39 | ! comment fields (!:) to be used for variable explanations added to |
---|
| 40 | ! all variable declaration statements |
---|
[1] | 41 | ! |
---|
[1037] | 42 | ! 1036 2012-10-22 13:43:42Z raasch |
---|
| 43 | ! code put under GPL (PALM 3.9) |
---|
| 44 | ! |
---|
[1] | 45 | ! Revision 1.1 1998/03/18 20:14:47 raasch |
---|
| 46 | ! Initial revision |
---|
| 47 | ! |
---|
| 48 | ! |
---|
| 49 | ! Description: |
---|
| 50 | ! ------------ |
---|
| 51 | ! For different operating systems get the remaining cpu-time of the job |
---|
| 52 | !------------------------------------------------------------------------------! |
---|
| 53 | |
---|
[1320] | 54 | USE control_parameters, & |
---|
| 55 | ONLY: maximum_cpu_time_allowed |
---|
| 56 | |
---|
| 57 | USE cpulog, & |
---|
| 58 | ONLY: initial_wallclock_time |
---|
| 59 | |
---|
| 60 | USE kinds |
---|
| 61 | |
---|
[1] | 62 | USE pegrid |
---|
| 63 | |
---|
| 64 | IMPLICIT NONE |
---|
| 65 | |
---|
[1320] | 66 | REAL(wp) :: remaining_time !: |
---|
[1] | 67 | #if defined( __ibm ) |
---|
[1320] | 68 | INTEGER(idp) :: IRTC !: |
---|
| 69 | REAL(wp) :: actual_wallclock_time !: |
---|
[82] | 70 | #elif defined( __lc ) |
---|
[1320] | 71 | INTEGER(idp) :: count !: |
---|
| 72 | INTEGER(idp) :: count_rate !: |
---|
| 73 | REAL(wp) :: actual_wallclock_time !: |
---|
[1] | 74 | #endif |
---|
| 75 | |
---|
[82] | 76 | #if defined( __ibm ) |
---|
[1] | 77 | |
---|
[1322] | 78 | actual_wallclock_time = IRTC( ) * 1E-9_wp |
---|
[1] | 79 | remaining_time = maximum_cpu_time_allowed - & |
---|
| 80 | ( actual_wallclock_time - initial_wallclock_time ) |
---|
| 81 | |
---|
[82] | 82 | #elif defined( __lc ) |
---|
[1] | 83 | |
---|
| 84 | CALL SYSTEM_CLOCK( count, count_rate ) |
---|
[1322] | 85 | actual_wallclock_time = REAL( count, KIND=wp ) / REAL( count_rate, KIND=wp ) |
---|
[1] | 86 | remaining_time = maximum_cpu_time_allowed - & |
---|
| 87 | ( actual_wallclock_time - initial_wallclock_time ) |
---|
| 88 | |
---|
| 89 | #elif defined( __nec ) |
---|
| 90 | |
---|
| 91 | CALL TREMAIN( remaining_time ) |
---|
| 92 | remaining_time = remaining_time / tasks_per_node |
---|
| 93 | |
---|
| 94 | #else |
---|
| 95 | |
---|
| 96 | ! |
---|
| 97 | !-- No stop due to running out of cpu-time on other machines |
---|
[1353] | 98 | remaining_time = 9999999.9_wp |
---|
[1] | 99 | |
---|
| 100 | #endif |
---|
| 101 | |
---|
| 102 | END SUBROUTINE local_tremain |
---|