[mpich2-commits] r3926 - mpich2/trunk/test/mpi/datatype

goodell at mcs.anl.gov goodell at mcs.anl.gov
Tue Mar 3 15:28:59 CST 2009


Author: goodell
Date: 2009-03-03 15:28:58 -0600 (Tue, 03 Mar 2009)
New Revision: 3926

Added:
   mpich2/trunk/test/mpi/datatype/hvector-zeros.c
Modified:
   mpich2/trunk/test/mpi/datatype/Makefile.sm
   mpich2/trunk/test/mpi/datatype/testlist
Log:
Add hvector-zeros datatype test.

This test catches the bug described in ticket #430.  The test code was
originally contributed by Jeff Parker at IBM.

No reviewer.

Modified: mpich2/trunk/test/mpi/datatype/Makefile.sm
===================================================================
--- mpich2/trunk/test/mpi/datatype/Makefile.sm	2009-03-03 19:37:06 UTC (rev 3925)
+++ mpich2/trunk/test/mpi/datatype/Makefile.sm	2009-03-03 21:28:58 UTC (rev 3926)
@@ -64,6 +64,8 @@
 
 pairtype-size-extent_SOURCES = pairtype-size-extent.c
 
+hvector-zeros_SOURCES = hvector-zeros.c
+
 localpack_SOURCES = localpack.c
 
 lbub_SOURCES = lbub.c

Added: mpich2/trunk/test/mpi/datatype/hvector-zeros.c
===================================================================
--- mpich2/trunk/test/mpi/datatype/hvector-zeros.c	                        (rev 0)
+++ mpich2/trunk/test/mpi/datatype/hvector-zeros.c	2009-03-03 21:28:58 UTC (rev 3926)
@@ -0,0 +1,43 @@
+/* -*- Mode: C; c-basic-offset:4 ; -*- */
+/*
+ *  (C) 2001 by Argonne National Laboratory.
+ *      See COPYRIGHT in top-level directory.
+ */
+/* Based on code from Jeff Parker at IBM. */
+
+#include <stdio.h>
+
+#include <mpi.h>
+
+int main(int argc, char *argv[])
+{
+    MPI_Datatype mystruct, vecs[3];
+    MPI_Aint stride = 5, displs[3];
+    int i=0, blockcount[3];
+
+    MPI_Init(&argc, &argv);
+
+    for(i = 0; i < 3; i++)
+    {
+        MPI_Type_hvector(i, 1, stride, MPI_INT, &vecs[i]);
+        MPI_Type_commit(&vecs[i]);
+        blockcount[i]=1;
+    }
+    displs[0]=0; displs[1]=-100; displs[2]=-200; /* irrelevant */
+
+    MPI_Type_struct(3, blockcount, displs, vecs, &mystruct);
+    MPI_Type_commit(&mystruct);
+
+    MPI_Type_free(&mystruct);
+    for(i = 0; i < 3; i++)
+    {
+        MPI_Type_free(&vecs[i]);
+    }
+
+    printf(" No Errors\n");
+
+    MPI_Finalize();
+
+    return 0;
+}
+

Modified: mpich2/trunk/test/mpi/datatype/testlist
===================================================================
--- mpich2/trunk/test/mpi/datatype/testlist	2009-03-03 19:37:06 UTC (rev 3925)
+++ mpich2/trunk/test/mpi/datatype/testlist	2009-03-03 21:28:58 UTC (rev 3926)
@@ -36,4 +36,5 @@
 get-elements-pairtype 1
 unpack 1
 struct-ezhov 1
-zeroblks 1
\ No newline at end of file
+zeroblks 1
+hvector-zeros 1



More information about the mpich2-commits mailing list