From ff25665301933f184ef0a864a31f27342ec2d2e7 Mon Sep 17 00:00:00 2001 From: Jeff Hammond Date: Wed, 22 Mar 2023 18:17:31 +0200 Subject: [PATCH 1/2] implement cpu time as wall time see https://github.com/nwchemgit/nwchem/pull/756 for discussion Signed-off-by: Jeff Hammond --- src/util/util_cpusec.F | 54 ++++-------------------------------------- 1 file changed, 5 insertions(+), 49 deletions(-) diff --git a/src/util/util_cpusec.F b/src/util/util_cpusec.F index 52640e2cf7..0278784fbb 100644 --- a/src/util/util_cpusec.F +++ b/src/util/util_cpusec.F @@ -1,52 +1,8 @@ double precision function util_cpusec() implicit none -c $Id$ -* -* routine to give cpu seconds since start of execution -* delta times are handled by all applications -* -#if defined(BGL) || defined(BGP) || defined(BGQ) - EXTERNAL MPI_WTIME - REAL*8 MPI_WTIME - util_cpusec = MPI_WTIME() -#elif defined(IBM) || defined(SP1) ||defined(HPUX) - double precision ibm_cputime - external ibm_cputime - util_cpusec = ibm_cputime() -#elif defined(SUN) || defined(SOLARIS) || defined(LINUXALPHA) - real*4 tarray(2) - real*4 etime -#ifndef GCC4 - external etime -#endif - util_cpusec = etime(tarray) -#elif (defined(LINUX) || defined(CYGNUS)) && !defined(LINUXIA64) && !defined(CATAMOUNT) - double precision linux_cputime - external linux_cputime - util_cpusec = linux_cputime() -#elif defined(WIN32) &&!defined(__MINGW32__) - double precision win32_cputime - external win32_cputime - util_cpusec = win32_cputime() -#elif defined(CRAY) - double precision secondr - external secondr - double precision first - logical ofirst - save first, ofirst - data ofirst /.true./ - if (ofirst) then - first = secondr() - ofirst = .false. - endif - util_cpusec = secondr() - first ! Actually wall time -#elif defined(FUJITSU_SOLARIS) || defined(CATAMOUNT) -#ifdef FUJITSU_SOLARIS - intrinsic cpu_time -#endif - call cpu_time (util_cpusec) -#else -#include "tcgmsg.fh" - util_cpusec = TCGTIME() -#endif +! we implement cpu time as wall time because cpu time +! is often unhelpful, especially when threads are used. +! there were issues with the implementation of cpu time +! as well, that motivated deleting the code. + return util_wallsec() end From bbd3f6047a9b93a43f18080ccbcae402d84770b0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Edoardo=20Apr=C3=A0?= Date: Wed, 22 Mar 2023 10:14:34 -0700 Subject: [PATCH 2/2] util_wallsec() is a double precision function --- src/util/util_cpusec.F | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/util/util_cpusec.F b/src/util/util_cpusec.F index 0278784fbb..65d953b159 100644 --- a/src/util/util_cpusec.F +++ b/src/util/util_cpusec.F @@ -4,5 +4,7 @@ ! is often unhelpful, especially when threads are used. ! there were issues with the implementation of cpu time ! as well, that motivated deleting the code. - return util_wallsec() + double precision util_wallsec + external util_wallsec + util_cpusec=util_wallsec() end