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

Jed Brown jedbrown at mcs.anl.gov
Sat May 18 12:55:38 CDT 2013


With MS-MPI 64-bit from HPC Pack 2008 and 2012, MPI_Attr_get returns
error code 773 when called from delete_fn on a communicator obtained
from MPI_Comm_split.

The standard is not explicit that the 'comm' argument of delete_fn must
be valid, so this test is only in effect when !USE_STRICT_MPI.

Signed-off-by: Jed Brown <jedbrown at mcs.anl.gov>
Signed-off-by: Satish Balay <balay at mcs.anl.gov>
---
 test/mpi/.gitignore           |  1 +
 test/mpi/attr/Makefile.am     |  1 +
 test/mpi/attr/attrdeleteget.c | 49 +++++++++++++++++++++++++++++++++++++++++++
 test/mpi/attr/testlist        |  1 +
 4 files changed, 52 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..a43e939
--- /dev/null
+++ b/test/mpi/attr/attrdeleteget.c
@@ -0,0 +1,49 @@
+/* -*- 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;
+    int errs = 0;
+
+    MTest_Init(&argc, &argv);
+    MPI_Comm_split(MPI_COMM_WORLD, 1, 0, &scomm);
+    MPI_Keyval_create(MPI_NULL_COPY_FN, delete_fn, &key, &errs);
+    MPI_Attr_put(scomm, key, a);
+    MPI_Comm_free(&scomm);
+    MTest_Finalize(errs);
+    MPI_Finalize();
+    return 0;
+}
+
+int delete_fn(MPI_Comm comm,int keyval,void *attr_val,void *extra_state)
+{
+#ifndef USE_STRICT_MPI
+    int err,flg,*errs = extra_state;
+    void *ptr;
+
+    if (comm == MPI_COMM_NULL) {
+        printf("MPI_COMM_NULL passed to delete_fn\n");
+        (*errs)++;
+    }
+    err = MPI_Attr_get(comm,key,&ptr,&flg);
+    if (err != MPI_SUCCESS) {
+        printf("MPI_Attr_get returned error %d, presumably due to invalid communicator\n", err);
+        (*errs)++;
+    }
+#endif
+    return 0;
+}
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