diff options
-rw-r--r-- | param.ccl | 2 | ||||
-rw-r--r-- | src/Storage.c | 22 |
2 files changed, 14 insertions, 10 deletions
@@ -206,7 +206,7 @@ STRING partition_3d_z "Tells how to partition on direction z" .* :: } "" -LOGICAL storage_verbose "Report on memory assignment" +LOGICAL storage_verbose "Report on memory assignment" STEERABLE = ALWAYS { } "no" diff --git a/src/Storage.c b/src/Storage.c index 56fe96d..1506a98 100644 --- a/src/Storage.c +++ b/src/Storage.c @@ -29,7 +29,7 @@ static char *rcsid="$Header$"; CCTK_FILEVERSION(CactusPUGH_PUGH_Storage_c) -static int totalstorage = 0; /* Storage for GAs in Bytes */ +static float totalstorage = 0; /* Storage for GAs in Bytes */ static int totalnumber = 0; /* Number of stored GAs */ @@ -251,25 +251,29 @@ int PUGH_EnableGroupStorage(cGH *GH, const char *groupname) rc = -1; } + if (rc == 0) + { + /* get GA pointer of first var in group */ + GA = (pGA *) pughGH->variables[first_var][0]; + totalnumber += pgroup.numvars*pgroup.numtimelevels; + totalstorage += ((float)(GA->extras->npoints * GA->varsize * + pgroup.numtimelevels * pgroup.numvars))/(1024*1024); + } + /* Report on memory usage */ if (storage_verbose) { if (rc == 0) { - /* get GA pointer of first var in group */ - GA = (pGA *) pughGH->variables[first_var][0]; - /* Memory toggled */ - totalnumber += pgroup.numvars; - totalstorage += GA->extras->npoints * GA->varsize * - pgroup.numtimelevels * pgroup.numvars; - printf("Switched memory on for %s \n [Num Arrays: %d Total Size: %d]\n", + printf("Switched memory on for %s \n [Num Arrays: %d Total Size: %6.2fMB]\n", groupname,totalnumber,totalstorage); } else if (rc == 1) { /* Memory already on */ - printf("Memory already on for %s\n",groupname); + printf("Memory already on for %s\n [Num Arrays: %d Total Size: %6.2fMB]\n", + groupname,totalnumber,totalstorage); } } |