[mpich-commits] [mpich] MPICH primary repository branch, master, updated. v3.1.1-112-gcb1fa5f

Service Account noreply at mpich.org
Thu Jul 17 21:55:19 CDT 2014


This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "MPICH primary repository".

The branch, master has been updated
       via  cb1fa5f8e843dddceed61d886d382c126f198ac3 (commit)
      from  274a5a70275081880d29f149ff0a24cc5ad9c8c3 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
http://git.mpich.org/mpich.git/commitdiff/cb1fa5f8e843dddceed61d886d382c126f198ac3

commit cb1fa5f8e843dddceed61d886d382c126f198ac3
Author: Sangmin Seo <sseo at anl.gov>
Date:   Fri Jul 11 11:15:10 2014 -0500

    Add environment variables to control memory tracing overhead.
    
    When the memory overhead for memory usage tracing is bigger than
    the threshold value, a warning message is generated to indicate the
    amount of the memory used in the tracing. Environment variables
    to control the threshold value were added.
    
    See #2068.
    
    Signed-off-by: Pavan Balaji <balaji at anl.gov>

diff --git a/src/mpl/include/mpltrmem.h b/src/mpl/include/mpltrmem.h
index 5f64f3e..4253bac 100644
--- a/src/mpl/include/mpltrmem.h
+++ b/src/mpl/include/mpltrmem.h
@@ -24,7 +24,6 @@ void *MPL_trcalloc(size_t, size_t, int, const char[]);
 void *MPL_trrealloc(void *, size_t, int, const char[]);
 void *MPL_trstrdup(const char *, int, const char[]);
 void MPL_TrSetMaxMem(size_t);
-void MPL_TrSetMaxAlloc(size_t);
 
 /* Make sure that FILE is defined */
 #include <stdio.h>
diff --git a/src/mpl/src/mpltrmem.c b/src/mpl/src/mpltrmem.c
index 5616542..3c9686f 100644
--- a/src/mpl/src/mpltrmem.c
+++ b/src/mpl/src/mpltrmem.c
@@ -127,8 +127,8 @@ static int TRSetBytes   = 0;
 /* Used to keep track of allocations */
 static volatile size_t TRMaxMem = 0;
 static volatile int    TRMaxMemId = 0;
-static volatile size_t TRNumAlloc = 0;
-static volatile size_t TRMaxAlloc = (size_t)2E6;
+static volatile size_t TRCurOverhead = 0;
+static volatile size_t TRMaxOverhead = 314572800;
 /* Used to limit allocation */
 static volatile size_t TRMaxMemAllow = 0;
 
@@ -180,6 +180,11 @@ void MPL_trinit(int rank)
         TRDefaultByte = 0;
         TRFreedByte = 0;
     }
+    s = getenv("MPICH_TRMEM_MAX_OVERHEAD");
+    if (s && *s) {
+        long l = atol(s);
+        TRMaxOverhead = (size_t)l;
+    }
     s = getenv("MPL_TRMEM_INIT");
     if (s && *s && (strcmp(s, "YES") == 0 || strcmp(s, "yes") == 0)) {
         TRSetBytes = 1;
@@ -198,6 +203,11 @@ void MPL_trinit(int rank)
         int l = atoi(s);
         TRlevel = l;
     }
+    s = getenv("MPL_TRMEM_MAX_OVERHEAD");
+    if (s && *s) {
+        long l = atol(s);
+        TRMaxOverhead = (size_t)l;
+    }
 
 }
 
@@ -288,14 +298,13 @@ void *MPL_trmalloc(size_t a, int lineno, const char fname[])
                          world_rank, (long)a, (long)nsize, new, fname, lineno);
     }
 
-    /* Warn the user about tracing overhead if the total number of memory
-     * allocation is larger than the threshold, TRMaxAlloc. */
-    TRNumAlloc++;
-    if (TRNumAlloc >= TRMaxAlloc) {
+    /* Warn the user about tracing overhead if the total memory overhead for
+     * tracing is larger than the threshold, TRMaxOverhead. */
+    TRCurOverhead += sizeof(TrSPACE);
+    if ((TRCurOverhead > TRMaxOverhead) && TRMaxOverhead) {
         MPL_error_printf("[%d] %.1lf MB was used for memory usage tracing!\n",
-                         world_rank,
-                         (double)(sizeof(TrSPACE) * TRNumAlloc) / 1024 / 1024);
-        MPL_TrSetMaxAlloc((size_t)(TRMaxAlloc + 1E6));
+                         world_rank, (double)TRCurOverhead / 1024 / 1024);
+        TRMaxOverhead = TRMaxOverhead * 2;
     }
 
     /* Without these macros valgrind actually catches far fewer errors when
@@ -439,7 +448,7 @@ void MPL_trfree(void *a_ptr, int line, const char file[])
                          file, line);
     }
 
-    TRNumAlloc--;
+    TRCurOverhead -= sizeof(TrSPACE);
 
     /*
      * Now, scrub the data (except possibly the first few ints) to
@@ -1040,11 +1049,6 @@ void MPL_TrSetMaxMem(size_t size)
     TRMaxMemAllow = size;
 }
 
-void MPL_TrSetMaxAlloc(size_t size)
-{
-    TRMaxAlloc = size;
-}
-
 static void addrToHex(void *addr, char string[MAX_ADDRESS_CHARS])
 {
     int i;

-----------------------------------------------------------------------

Summary of changes:
 src/mpl/include/mpltrmem.h |    1 -
 src/mpl/src/mpltrmem.c     |   34 +++++++++++++++++++---------------
 2 files changed, 19 insertions(+), 16 deletions(-)


hooks/post-receive
-- 
MPICH primary repository


More information about the commits mailing list