[mpich-commits] [mpich] MPICH primary repository branch, master, updated. v3.1.1-77-g40b864f
Service Account
noreply at mpich.org
Wed Jul 9 15:27:26 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 40b864f53f1e87fc6740182e3573e0007065b67b (commit)
from c34a0106a77b4908acdb8b3776e3adf29ad90fc9 (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/40b864f53f1e87fc6740182e3573e0007065b67b
commit 40b864f53f1e87fc6740182e3573e0007065b67b
Author: Sangmin Seo <sseo at anl.gov>
Date: Wed Jul 9 10:05:02 2014 -0500
Add warning about memory tracing overhead.
When the debugging option about memory usage tracing is turned on,
additional memory overhead for tracing may be significant especially
when a large number of small memory allocations are requested, as
reported in #2068. However, since the tracing data is necessary to
keep track of memory usage, it cannot be removed. Here, we provide
a warning message when the memory overhead for tracing is over the
threshold value.
See #2068
Signed-off-by: Xin Zhao <xinzhao3 at illinois.edu>
diff --git a/src/mpl/include/mpltrmem.h b/src/mpl/include/mpltrmem.h
index 4253bac..5f64f3e 100644
--- a/src/mpl/include/mpltrmem.h
+++ b/src/mpl/include/mpltrmem.h
@@ -24,6 +24,7 @@ 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 5efdbbe..5616542 100644
--- a/src/mpl/src/mpltrmem.c
+++ b/src/mpl/src/mpltrmem.c
@@ -127,6 +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;
/* Used to limit allocation */
static volatile size_t TRMaxMemAllow = 0;
@@ -286,6 +288,16 @@ 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) {
+ 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));
+ }
+
/* Without these macros valgrind actually catches far fewer errors when
* using --enable-g=mem. Note that it would be nice to use
* MPL_VG_MALLOCLIKE_BLOCK and friends, but they don't work when the
@@ -427,6 +439,8 @@ void MPL_trfree(void *a_ptr, int line, const char file[])
file, line);
}
+ TRNumAlloc--;
+
/*
* Now, scrub the data (except possibly the first few ints) to
* help catch access to already freed data
@@ -1026,6 +1040,11 @@ 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 | 19 +++++++++++++++++++
2 files changed, 20 insertions(+), 0 deletions(-)
hooks/post-receive
--
MPICH primary repository
More information about the commits
mailing list