diff options
author | allen <allen@b61c5cb5-eaca-4651-9a7a-d64986f99364> | 2001-09-16 10:13:01 +0000 |
---|---|---|
committer | allen <allen@b61c5cb5-eaca-4651-9a7a-d64986f99364> | 2001-09-16 10:13:01 +0000 |
commit | 46a7d6ef731e9e26279fab0514c91ad41fbac170 (patch) | |
tree | 9c4e4e639714a18cde9375456fa1a92652bb8c4a | |
parent | 5c1f3ae9d5de43fe1d47463222791b6cdb49dc47 (diff) |
Extended storage_verbose parameter to give a report on the maximum amount of storage assigned during a run.
The options are now
storage_verbose = "yes" -> show everything (enabling, disabling and report)
storage_verbose = "report" -> just show report
storage_verbose = "no" (the default) -> show nothing
The report will be given at termination, and also at every storage_report_every iterations (default is
only at termination).
I could extend the report to give a list of the GAs with storage at the max if anyone wants that.
git-svn-id: http://svn.cactuscode.org/arrangements/CactusPUGH/PUGH/trunk@346 b61c5cb5-eaca-4651-9a7a-d64986f99364
-rw-r--r-- | param.ccl | 11 | ||||
-rw-r--r-- | schedule.ccl | 16 | ||||
-rw-r--r-- | src/PughUtils.c | 24 | ||||
-rw-r--r-- | src/Storage.c | 79 |
4 files changed, 106 insertions, 24 deletions
@@ -205,10 +205,19 @@ STRING partition_3d_z "Tells how to partition on direction z" .* :: "A regex which matches anything" } "" -BOOLEAN storage_verbose "Report on memory assignment" STEERABLE = ALWAYS +KEYWORD storage_verbose "Report on memory assignment" STEERABLE = ALWAYS { + "yes" :: "Standard storage information" + "report" :: "Provide a report of storage every storage_report_every iterations and at termination" + "no" :: "Provide no information" } "no" +INT storage_report_every "How often to provide a report on storage information" STEERABLE = ALWAYS +{ + 0:0 :: "Never report" + 1:* :: "Report at intervals" +} 0 + BOOLEAN timer_output "Print time spent in communication" { } "no" diff --git a/schedule.ccl b/schedule.ccl index 7e32810..c758e63 100644 --- a/schedule.ccl +++ b/schedule.ccl @@ -19,6 +19,22 @@ if (timer_output) } "Print time spent in communication" } +if (CCTK_Equals(storage_verbose,"yes") || CCTK_Equals(storage_verbose,"report") ) +{ + schedule PUGH_PrintStorageReport at TERMINATE + { + LANG:C + } "Print storage information" +} + +if (CCTK_Equals(storage_verbose,"yes") || CCTK_Equals(storage_verbose,"report")) +{ + schedule PUGH_PrintStorageReport at POSTSTEP + { + LANG:C + } "Print storage information" +} + schedule PUGH_Terminate at TERMINATE as Driver_Terminate { LANG:C diff --git a/src/PughUtils.c b/src/PughUtils.c index 449454f..c981f41 100644 --- a/src/PughUtils.c +++ b/src/PughUtils.c @@ -20,6 +20,8 @@ static const char *rcsid = "$Header$"; CCTK_FILEVERSION(CactusPUGH_PUGH_PughUtils_c) void PUGH_Report(CCTK_ARGUMENTS); +void PUGH_PrintStorageReport (CCTK_ARGUMENTS); +void PUGHi_PrintStorageReport (void); /*@@ @routine PUGH_Report @@ -216,3 +218,25 @@ MPI_Datatype PUGH_MPIDataType (pGH *pughGH, int cctk_type) return (retval); } #endif /* CCTK_MPI */ + + /*@@ + @routine PUGH_PrintStorageReport + @author Gabrielle Allen + @date 16th Sept 2001 + @desc + Print a report about the use of storage + @enddesc +@@*/ +void PUGH_PrintStorageReport (CCTK_ARGUMENTS) +{ + DECLARE_CCTK_PARAMETERS + DECLARE_CCTK_ARGUMENTS + + if (storage_report_every > 0) + { + if (cctk_iteration % storage_report_every == 0) + { + PUGHi_PrintStorageReport(); + } + } +} diff --git a/src/Storage.c b/src/Storage.c index b6d312d..1357a72 100644 --- a/src/Storage.c +++ b/src/Storage.c @@ -28,8 +28,9 @@ CCTK_FILEVERSION(CactusPUGH_PUGH_Storage_c) ******************** Static Variables ************************* ********************************************************************/ 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 */ /******************************************************************** ******************** Internal Routines ************************ @@ -47,6 +48,11 @@ static void PUGH_InitializeMemory (const char *initialize_memory, int bytes, void *data); +/******************************************************************** + ******************** External Routines ************************ + ********************************************************************/ +void PUGHi_PrintStorageReport (void); + /*@@ @routine PUGH_ArrayGroupSize @@ -131,13 +137,13 @@ const int *PUGH_ArrayGroupSize (cGH *GH, if (groupname) { CCTK_VWarn (1, __LINE__, __FILE__, CCTK_THORNSTRING, - "Invalid group name '%s' in PUGH_ArrayGroupSize", + "PUGH_ArrayGroupSize: Invalid group name '%s'", groupname); } else { CCTK_VWarn (1, __LINE__, __FILE__, CCTK_THORNSTRING, - "Invalid group ID %d in PUGH_ArrayGroupSize", + "PUGH_ArrayGroupSize: Invalid group ID %d", group); } @@ -240,13 +246,13 @@ int PUGH_QueryGroupStorage (cGH *GH, int group, const char *groupname) if (groupname) { CCTK_VWarn (1, __LINE__, __FILE__, CCTK_THORNSTRING, - "Invalid group name '%s' in PUGH_ArrayGroupSize", + "PUGH_ArrayGroupSize: Invalid group name '%s'", groupname); } else { CCTK_VWarn (1, __LINE__, __FILE__, CCTK_THORNSTRING, - "Invalid group ID %d in PUGH_ArrayGroupSize", + "PUGH_ArrayGroupSize: Invalid group ID %d", group); } } @@ -329,29 +335,33 @@ int PUGH_EnableGroupStorage (cGH *GH, const char *groupname) first_var, pgroup.numvars, pgroup.numtimelevels); - if (retval == 0) + if (!CCTK_Equals(storage_verbose,"no") && retval == 0) { /* 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; totalstorage += (GA->extras->npoints * GA->varsize * pgroup.numtimelevels * pgroup.numvars) / (float) (1024*1024); + maxstorage = totalstorage > maxstorage ? totalstorage : maxstorage; + + /* 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); + } } + } else { - CCTK_WARN (1, "Unknown group type in PUGH_EnableGroupStorage"); + CCTK_WARN (1, "PUGH_EnableGroupStorage: Unknown group type"); retval = -1; } - /* Report on memory usage */ - if (storage_verbose && retval == 0) - { - printf ("Switched memory on for group '%s'\n" - " [Num Arrays: %d Total Size: %6.2fMB]\n", - groupname, totalnumber, totalstorage); - } } else { @@ -469,28 +479,34 @@ int PUGH_DisableGroupStorage (cGH *GH, const char *groupname) } /* Report on memory usage */ - if (storage_verbose && retval >= 0) + if (!CCTK_Equals(storage_verbose,"no") && retval >= 0) { if (unchanged == 0) { + /* Memory toggled */ totalnumber -= pgroup.numvars; totalstorage -= (variables[first_var][0]->extras->npoints * variables[first_var][0]->varsize * - pgroup.numtimelevels * pgroup.numvars) / - (float) (1024 * 1024); - printf ("Switched memory off for group '%s'\n" - " [Num Arrays: %d Total Size: %6.2fMB]\n", - groupname, totalnumber, totalstorage); + 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); + } } else if (unchanged == pgroup.numvars) { /* Memory already off */ - printf ("Memory already off for group '%s'\n", groupname); + if (CCTK_Equals(storage_verbose,"yes")) + { + CCTK_VInfo (CCTK_THORNSTRING, "Memory already off for group '%s'", groupname); + } } else { - CCTK_WARN (1, "Inconsistency in group memory assignment"); + CCTK_WARN (1, "PUGH_DisableGroupStorage: Inconsistency in group memory assignment"); } } @@ -785,7 +801,7 @@ static int PUGH_EnableGArrayGroupStorage (pGH *pughGH, if (retval) { CCTK_VWarn (0, __LINE__, __FILE__, CCTK_THORNSTRING, - "FATAL ERROR: Cannot allocate data for '%s' [%d]\n", + "PUGH_EnableGArrayDataStorage: Cannot allocate data for '%s' [%d]", GA->name, GA->id); } @@ -906,3 +922,20 @@ static void PUGH_InitializeMemory (const char *initialize_memory, "parameter 'initialize_memory'", initialize_memory); } } + + + + /*@@ + @routine PUGHi_PrintStorageInfo + @author Gabrielle Allen + @date 16th Sept 2001 + @desc + Print a report about the use of storage + @enddesc +@@*/ +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); +} |