[mpich-discuss] [PATCH] test: add attrdeleteget, MPI_Attr_get called from delete_fn

Jed Brown jedbrown at mcs.anl.gov
Fri May 17 22:57:20 CDT 2013


MS-MPI 64-bit from HPC Pack 2008 and 2012 errors when MPI_Attr_get is
called from delete_fn on a communicator obtained from MPI_Comm_split.

Signed-off-by: Jed Brown <jedbrown at mcs.anl.gov>
Signed-off-by: Satish Balay <balay at mcs.anl.gov>
---
This represents a reduced test case from a reported PETSc error when
using split communicators on MS-MPI.  PETSc uses a reference-counted
"inner" communicator to manage tags between objects.  When the user
destroys the outer communicator, the inner communicator must be detached
to avoid holding a dangling reference.

I'm submitting this bug report as a patch to MPICH in hopes that it
makes it downstream to Microsoft and other vendors so that this problem
does not occur again.

 test/mpi/.gitignore           |  1 +
 test/mpi/attr/Makefile.am     |  1 +
 test/mpi/attr/attrdeleteget.c | 37 +++++++++++++++++++++++++++++++++++++
 test/mpi/attr/testlist        |  1 +
 4 files changed, 40 insertions(+)
 create mode 100644 test/mpi/attr/attrdeleteget.c

diff --git a/test/mpi/.gitignore b/test/mpi/.gitignore
index 3aadba2..0bdcd15 100644
--- a/test/mpi/.gitignore
+++ b/test/mpi/.gitignore
@@ -51,6 +51,7 @@
 /attr/attrerr
 /attr/attrerrcomm
 /attr/attrerrtype
+/attr/attrdeleteget
 /attr/attric
 /attr/attrorder
 /attr/attrordercomm
diff --git a/test/mpi/attr/Makefile.am b/test/mpi/attr/Makefile.am
index a672192..e1d788b 100644
--- a/test/mpi/attr/Makefile.am
+++ b/test/mpi/attr/Makefile.am
@@ -18,6 +18,7 @@ noinst_PROGRAMS =      \
     attrerr            \
     attrerrcomm        \
     attrerrtype        \
+    attrdeleteget      \
     attr2type          \
     attrorder          \
     attrordercomm      \
diff --git a/test/mpi/attr/attrdeleteget.c b/test/mpi/attr/attrdeleteget.c
new file mode 100644
index 0000000..7ed66d0
--- /dev/null
+++ b/test/mpi/attr/attrdeleteget.c
@@ -0,0 +1,37 @@
+/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil ; -*- */
+/*
+ *
+ *  (C) 2013 by Argonne National Laboratory.
+ *      See COPYRIGHT in top-level directory.
+ */
+
+#include <stdio.h>
+#include "mpi.h"
+#include "mpitest.h"
+
+int key = MPI_KEYVAL_INVALID;
+char a[100];
+
+int delete_fn (MPI_Comm, int, void *, void *);
+
+int main(int argc,char **argv)
+{
+  MPI_Comm scomm;
+
+  MTest_Init(&argc,&argv);
+  MPI_Comm_split(MPI_COMM_WORLD,1,0,&scomm);
+  MPI_Keyval_create(MPI_NULL_COPY_FN,delete_fn,&key,(void*)0);
+  MPI_Attr_put(scomm,key,a);
+  MPI_Comm_free(&scomm);
+  MPI_Finalize();
+  return 0;
+}
+
+int delete_fn(MPI_Comm comm,int keyval,void *attr_val,void *extra_state)
+{
+  int   flg;
+  void  *ptr;
+
+  MPI_Attr_get(comm,key,&ptr,&flg);
+  return MPI_SUCCESS;
+}
diff --git a/test/mpi/attr/testlist b/test/mpi/attr/testlist
index 61bd613..4db94df 100644
--- a/test/mpi/attr/testlist
+++ b/test/mpi/attr/testlist
@@ -7,6 +7,7 @@ attrend2 1
 attrend2 5
 attrerrcomm 1
 attrerrtype 1
+attrdeleteget 1
 attr2type 1
 attrorder 1
 attrordercomm 1
-- 
1.8.2.3




More information about the discuss mailing list