[mpich-commits] [mpich] MPICH primary repository branch, master, updated. v3.2b1-88-g8f6b3cb

Service Account noreply at mpich.org
Mon Apr 20 23:10:11 CDT 2015

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  8f6b3cbb1f3a8a6f2202dbcff32fd76d7de7aa05 (commit)
      from  a56826750cc7b99150b9b59e602dcaf13cb5f661 (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 -----------------------------------------------------------------

commit 8f6b3cbb1f3a8a6f2202dbcff32fd76d7de7aa05
Author: Min Si <msi at il.is.s.u-tokyo.ac.jp>
Date:   Mon Apr 20 20:29:39 2015 -0500

    A workaround for FreeBSD pthread mallc/free bug.
    On FreeBSD, test threads/pt2pt/multisend4 sometimes reports the segfault
    error when calling free function. This error only happens when the
    buffer size is equal to 4M bytes and every thread performs malloc/free
    for multiple times. This bug can be reproduced by using simple memcpy
    without MPI communication, thus it is considered not as a MPI bug but a
    bug of the thread-safe memory allocation on FreeBSD. A workaround of
    this bug is to move malloc-free outside the loop to avoid frequent
    malloc-free calls. This patch added it.
    Signed-off-by: Huiwei Lu <huiweilu at mcs.anl.gov>

diff --git a/test/mpi/threads/pt2pt/multisend4.c b/test/mpi/threads/pt2pt/multisend4.c
index 041e6af..9b2f07b 100644
--- a/test/mpi/threads/pt2pt/multisend4.c
+++ b/test/mpi/threads/pt2pt/multisend4.c
@@ -44,9 +44,9 @@ MTEST_THREAD_RETURN_TYPE run_test_sendrecv(void *arg)
 	fprintf( stderr, "Panic wsize = %d nthreads = %d\n",
 		 wsize, nthreads );
-    for (cnt=1; cnt < MAX_CNT; cnt = 2*cnt) {
-	buf = (int *)malloc( 2*cnt * sizeof(int) );
+    buf = (int *) malloc(2 * MAX_CNT * sizeof(int));
+    for (cnt=1; cnt < MAX_CNT; cnt = 2*cnt) {
 	/* Wait for all senders to be ready */
@@ -72,10 +72,11 @@ MTEST_THREAD_RETURN_TYPE run_test_sendrecv(void *arg)
 	t = MPI_Wtime() - t;
 	/* can't free the buffers until the requests are completed */
-	free( buf );
 	if (thread_num == 1)
 	    MTestPrintfMsg( 1, "buf size %d: time %f\n", cnt, t / MAX_LOOP );
+    free(buf);


Summary of changes:
 test/mpi/threads/pt2pt/multisend4.c |    7 ++++---
 1 files changed, 4 insertions(+), 3 deletions(-)

MPICH primary repository

More information about the commits mailing list