diff options
author | allen <allen@b61c5cb5-eaca-4651-9a7a-d64986f99364> | 2001-09-25 19:54:48 +0000 |
---|---|---|
committer | allen <allen@b61c5cb5-eaca-4651-9a7a-d64986f99364> | 2001-09-25 19:54:48 +0000 |
commit | 65041c443a56cb6ea5d2d3768e478d20deb11876 (patch) | |
tree | f8b76303cad70be391f2809e04d5727c236fdbe0 | |
parent | 46a7d6ef731e9e26279fab0514c91ad41fbac170 (diff) |
Fixing up the storage report so it actually does report.
git-svn-id: http://svn.cactuscode.org/arrangements/CactusPUGH/PUGH/trunk@347 b61c5cb5-eaca-4651-9a7a-d64986f99364
-rw-r--r-- | schedule.ccl | 2 | ||||
-rw-r--r-- | src/PughUtils.c | 29 | ||||
-rw-r--r-- | src/Storage.c | 44 |
3 files changed, 62 insertions, 13 deletions
diff --git a/schedule.ccl b/schedule.ccl index c758e63..b989b46 100644 --- a/schedule.ccl +++ b/schedule.ccl @@ -21,7 +21,7 @@ if (timer_output) if (CCTK_Equals(storage_verbose,"yes") || CCTK_Equals(storage_verbose,"report") ) { - schedule PUGH_PrintStorageReport at TERMINATE + schedule PUGH_PrintFinalStorageReport at TERMINATE { LANG:C } "Print storage information" diff --git a/src/PughUtils.c b/src/PughUtils.c index c981f41..ab16220 100644 --- a/src/PughUtils.c +++ b/src/PughUtils.c @@ -19,10 +19,24 @@ static const char *rcsid = "$Header$"; CCTK_FILEVERSION(CactusPUGH_PUGH_PughUtils_c) + +/******************************************************************** + ******************** Static Variables ************************* + ********************************************************************/ + +/******************************************************************** + ******************** Internal Routines ************************ + ********************************************************************/ + + +/******************************************************************** + ******************** External Routines ************************ + ********************************************************************/ void PUGH_Report(CCTK_ARGUMENTS); void PUGH_PrintStorageReport (CCTK_ARGUMENTS); void PUGHi_PrintStorageReport (void); + /*@@ @routine PUGH_Report @date Sunday 12 September 1999 @@ -219,6 +233,7 @@ MPI_Datatype PUGH_MPIDataType (pGH *pughGH, int cctk_type) } #endif /* CCTK_MPI */ + /*@@ @routine PUGH_PrintStorageReport @author Gabrielle Allen @@ -240,3 +255,17 @@ void PUGH_PrintStorageReport (CCTK_ARGUMENTS) } } } + + + /*@@ + @routine PUGH_PrintFinalStorageReport + @author Gabrielle Allen + @date 16th Sept 2001 + @desc + Print a report about the use of storage + @enddesc +@@*/ +void PUGH_PrintFinalStorageReport (CCTK_ARGUMENTS) +{ + PUGHi_PrintStorageReport(); +} diff --git a/src/Storage.c b/src/Storage.c index 1357a72..a116e77 100644 --- a/src/Storage.c +++ b/src/Storage.c @@ -29,8 +29,10 @@ CCTK_FILEVERSION(CactusPUGH_PUGH_Storage_c) ********************************************************************/ static float totalstorage = 0; /* Storage for GAs in Bytes */ static float maxstorage = 0; /* Maximum storage for GAs in MBytes */ -static int totalnumber = 0; /* Number of stored GAs */ -static int maxnumber = 0; /* Maximum number of stored GFs */ +static int totalnumberGA = 0; /* Number of stored GAs */ +static int totalnumberGF = 0; /* Number of stored GFs */ +static int numberGA = 0; /* Number of GAs at max */ +static int numberGF = 0; /* Number of GFs at max */ /******************************************************************** ******************** Internal Routines ************************ @@ -339,19 +341,30 @@ int PUGH_EnableGroupStorage (cGH *GH, const char *groupname) { /* get GA pointer of first var in group */ GA = (pGA *) pughGH->variables[first_var][0]; - totalnumber += pgroup.numvars * pgroup.numtimelevels; - maxnumber = totalnumber > maxnumber ? totalnumber : maxnumber; + if (pgroup.grouptype == CCTK_GF) + { + totalnumberGF += pgroup.numvars * pgroup.numtimelevels; + } + else + { + totalnumberGA += pgroup.numvars * pgroup.numtimelevels; + } totalstorage += (GA->extras->npoints * GA->varsize * pgroup.numtimelevels * pgroup.numvars) / (float) (1024*1024); - maxstorage = totalstorage > maxstorage ? totalstorage : maxstorage; + if (totalstorage > maxstorage) + { + numberGF = totalnumberGF; + numberGA = totalnumberGA; + maxstorage = totalstorage; + } /* Report on memory usage */ if (CCTK_Equals(storage_verbose,"yes")) { CCTK_VInfo (CCTK_THORNSTRING, "Switched memory on for group '%s'" - " [Num Arrays: %d Total Size: %6.2fMB]", - groupname, totalnumber, totalstorage); + " [GFs: %d GAs: %d Total Size: %6.2fMB]", + groupname, totalnumberGF, totalnumberGA, totalstorage); } } @@ -485,15 +498,22 @@ int PUGH_DisableGroupStorage (cGH *GH, const char *groupname) { /* Memory toggled */ - totalnumber -= pgroup.numvars; + if (pgroup.grouptype == CCTK_GF) + { + totalnumberGF -= pgroup.numvars; + } + else if (pgroup.grouptype == CCTK_ARRAY) + { + totalnumberGA -= pgroup.numvars; + } totalstorage -= (variables[first_var][0]->extras->npoints * variables[first_var][0]->varsize * pgroup.numtimelevels * pgroup.numvars) / (float) (1024 * 1024); if (CCTK_Equals(storage_verbose,"yes")) { CCTK_VInfo (CCTK_THORNSTRING, "Switched memory off for group '%s'" - " [Num Arrays: %d Total Size: %6.2fMB]", - groupname, totalnumber, totalstorage); + " [GFs: %d GAs: %d Total Size: %6.2fMB]", + groupname, totalnumberGF, totalnumberGA, totalstorage); } } else if (unchanged == pgroup.numvars) @@ -936,6 +956,6 @@ static void PUGH_InitializeMemory (const char *initialize_memory, void PUGHi_PrintStorageReport () { CCTK_INFO("Storage statistics"); - CCTK_VInfo(CCTK_THORNSTRING, " Maximum number of GAs: %d",maxnumber); - CCTK_VInfo(CCTK_THORNSTRING, " Maximum storage assigned: %6.2fMB",maxstorage); + CCTK_VInfo(CCTK_THORNSTRING, " Maximum storage: %6.2fMB",maxstorage); + CCTK_VInfo(CCTK_THORNSTRING, " [%d Grid Functions, %d Grid Arrays]",numberGF,numberGA); } |