[mpich-commits] [mpich] MPICH primary repository branch, master, updated. v3.1.2-82-ga415703

Service Account noreply at mpich.org
Thu Aug 7 14:25:49 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  a415703dcef90dc2282856da481955f11ebb17a0 (commit)
       via  0e675b029b3aea43bdb16e732fe87eaac9ad06c8 (commit)
       via  cef2f1ecfe5be54825776982567c2398bed71af3 (commit)
      from  206af6d56ce9e1f965a26c5f82b8c484f8bb7596 (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/a415703dcef90dc2282856da481955f11ebb17a0

commit a415703dcef90dc2282856da481955f11ebb17a0
Author: Rob Latham <robl at mcs.anl.gov>
Date:   Mon Aug 4 14:57:30 2014 -0500

    test case for hindexed_block type
    
    Mohamad Chaarawi <chaarawi at hdfgroup.org> discovered that ROMIO did not
    correctly implement hindexed_block datatypes.
    
    Signed-off-by: Ken Raffenetti <raffenet at mcs.anl.gov>

diff --git a/test/mpi/io/Makefile.am b/test/mpi/io/Makefile.am
index 12dd69d..4d5ba77 100644
--- a/test/mpi/io/Makefile.am
+++ b/test/mpi/io/Makefile.am
@@ -24,7 +24,8 @@ noinst_PROGRAMS = \
     userioerr     \
     resized       \
     resized2      \
-    bigtype
+    bigtype       \
+    hindexed_io
 
 clean-local:
 	-rm -f testfile testfile.*
diff --git a/test/mpi/io/hindexed_io.c b/test/mpi/io/hindexed_io.c
new file mode 100644
index 0000000..3261278
--- /dev/null
+++ b/test/mpi/io/hindexed_io.c
@@ -0,0 +1,106 @@
+#include <mpi.h>
+#include <stdio.h>
+#include <string.h>
+#include <stdlib.h>
+#include <unistd.h>
+
+#define DATA_SIZE 324*4
+#define PAD 256
+#define HEADER 144
+#define BLK_COUNT 3
+
+static void handle_error(int errcode, char *str)
+{
+    char msg[MPI_MAX_ERROR_STRING];
+    int resultlen;
+    MPI_Error_string(errcode, msg, &resultlen);
+    fprintf(stderr, "%s: %s\n", str, msg);
+    MPI_Abort(MPI_COMM_WORLD, 1);
+}
+#define CHECK(fn) { int errcode; errcode = (fn); if (errcode != MPI_SUCCESS) handle_error(errcode, #fn ); }
+
+int main(int argc, char** argv)
+{
+
+    MPI_File fh;
+    MPI_Datatype file_type, mem_type;
+    int *data = NULL;
+    int *verify = NULL;
+    int data_size = DATA_SIZE;
+    int i, j,k, nr_errors=0;
+    MPI_Aint disp[BLK_COUNT];
+    int block_lens[BLK_COUNT];
+    char* filename = "unnamed.dat";
+
+    MPI_Init (&argc, &argv);
+    disp[0] = (MPI_Aint)(PAD);
+    disp[1] = (MPI_Aint)(data_size*1 + PAD);
+    disp[2] = (MPI_Aint)(data_size*2 + PAD);
+
+    block_lens[0] = data_size;
+    block_lens[1] = data_size;
+    block_lens[2] = data_size;
+
+    data = malloc(data_size);
+    verify = malloc(data_size*BLK_COUNT + HEADER + PAD);
+    for(i=0 ; i<data_size/sizeof(int) ; i++)
+        data[i] = i;
+
+    MPI_Type_create_hindexed_block(BLK_COUNT, data_size, disp, MPI_BYTE, &file_type);
+    MPI_Type_commit(&file_type);
+
+    MPI_Type_create_hvector(BLK_COUNT, data_size, 0, MPI_BYTE, &mem_type);
+    MPI_Type_commit(&mem_type);
+
+    if( 1 < argc ) filename = argv[1];
+
+    CHECK(MPI_File_open (MPI_COMM_WORLD, filename,
+		MPI_MODE_RDWR | MPI_MODE_CREATE | MPI_MODE_DELETE_ON_CLOSE,
+                      MPI_INFO_NULL, &fh) != 0);
+
+    CHECK(MPI_File_set_view(fh, HEADER, MPI_BYTE,
+                                         file_type, "native", MPI_INFO_NULL));
+
+    /* write everything */
+    CHECK(MPI_File_write_at_all (fh, 0,
+                                 data, 1, mem_type,
+                                 MPI_STATUS_IGNORE));
+    /* verify */
+    CHECK(MPI_File_set_view(fh, 0, MPI_BYTE, MPI_BYTE,
+		"native", MPI_INFO_NULL));
+    CHECK(MPI_File_read_at_all(fh, 0,
+		verify, (HEADER+PAD+BLK_COUNT*DATA_SIZE)/sizeof(int), MPI_INT,
+		MPI_STATUS_IGNORE));
+
+    /* header and block padding should have no data */
+    for (i=0; i<(HEADER+PAD)/sizeof(int); i++) {
+	if (verify[i] != 0) {
+	    nr_errors++;
+	    fprintf(stderr, "expected 0, read %d\n", verify[i]);
+	}
+    }
+    /* blocks are replicated */
+    for (j=0; j<BLK_COUNT; j++ ) {
+	for (k=0; k<(DATA_SIZE/sizeof(int)); k++) {
+	    if (verify[(HEADER+PAD)/sizeof(int) + k + j*(DATA_SIZE/sizeof(int))] !=
+		    data[k]) {
+		nr_errors++;
+		fprintf(stderr, "expcted %d, read %d\n", data[k],
+			verify[(HEADER+PAD)/sizeof(int) + k + j*(DATA_SIZE/sizeof(int))]);
+	    }
+	    i++;
+	}
+    }
+
+    MPI_File_close(&fh);
+
+    MPI_Type_free (&mem_type);
+    MPI_Type_free(&file_type);
+
+    if (nr_errors == 0) printf(" No Errors\n");
+
+    MPI_Finalize ();
+
+    free(data);
+    return 0;
+}
diff --git a/test/mpi/io/testlist b/test/mpi/io/testlist
index 6dfaafb..2549091 100644
--- a/test/mpi/io/testlist
+++ b/test/mpi/io/testlist
@@ -10,3 +10,4 @@ userioerr 1
 resized 1
 resized2 1 xfail=ticket2088
 bigtype 1
+hindexed_io 1

http://git.mpich.org/mpich.git/commitdiff/0e675b029b3aea43bdb16e732fe87eaac9ad06c8

commit 0e675b029b3aea43bdb16e732fe87eaac9ad06c8
Author: Rob Latham <robl at mcs.anl.gov>
Date:   Fri Aug 1 13:11:36 2014 -0500

    HINDEXED_BLOCK is not quite an INDEXED_BLOCK
    
    Someone (Mohamad Chaarawi <chaarawi at hdfgroup.org>) finally used
    HINDEXED_BLOCK and  discovered that ROMIO's HINDEXED_BLOCK
    implementation was.... incomplete.  or at least untested.
    
    - ADIOI_Count_contiguous_blocks simply aborted when fed a type it did
      not know about.  hindexed_block blocks are counted same as
      indexed_block blocks.
    
    - But, the stride between hindexed_block blocks is given by the explicit
      addresses.  indexed_block, on the other hand, computes a stride based
      on type.
    
    Signed-off-by: Ken Raffenetti <raffenet at mcs.anl.gov>

diff --git a/src/mpi/romio/adio/common/flatten.c b/src/mpi/romio/adio/common/flatten.c
index bc5f1e2..86c2875 100644
--- a/src/mpi/romio/adio/common/flatten.c
+++ b/src/mpi/romio/adio/common/flatten.c
@@ -107,7 +107,7 @@ void ADIOI_Flatten_datatype(MPI_Datatype datatype)
 void ADIOI_Flatten(MPI_Datatype datatype, ADIOI_Flatlist_node *flat, 
 		  ADIO_Offset st_offset, MPI_Count *curr_index)
 {
-    int i, k, m, n, basic_num, nonzeroth;
+    int i, k, m, n, basic_num, nonzeroth, is_hindexed_block=0;
     int combiner, old_combiner, old_is_contig;
     int nints, nadds, ntypes, old_nints, old_nadds, old_ntypes;
     /* By using ADIO_Offset we preserve +/- sign and 
@@ -484,11 +484,10 @@ void ADIOI_Flatten(MPI_Datatype datatype, ADIOI_Flatlist_node *flat,
 	}
 	break;
 
-        /* FIXME: using the same code as indexed_block for
-         * hindexed_block doesn't look correct.  Needs to be carefully
-         * looked into. */
 #if defined HAVE_DECL_MPI_COMBINER_HINDEXED_BLOCK && HAVE_DECL_MPI_COMBINER_HINDEXED_BLOCK
     case MPI_COMBINER_HINDEXED_BLOCK:
+	is_hindexed_block=1;
+	/* deliberate fall-through */
 #endif
     case MPI_COMBINER_INDEXED_BLOCK:
     #ifdef FLATTEN_DEBUG 
@@ -506,8 +505,13 @@ void ADIOI_Flatten(MPI_Datatype datatype, ADIOI_Flatlist_node *flat,
       /* By using ADIO_Offset we preserve +/- sign and 
          avoid >2G integer arithmetic problems */
       ADIO_Offset stride = ints[1+1];
-        ADIOI_Flatten(types[0], flat,
-         st_offset+stride* ADIOI_AINT_CAST_TO_OFFSET old_extent, curr_index);
+	if (is_hindexed_block) {
+	    ADIOI_Flatten(types[0], flat,
+		    st_offset+adds[0], curr_index);
+	} else {
+	    ADIOI_Flatten(types[0], flat,
+		    st_offset+stride* ADIOI_AINT_CAST_TO_OFFSET old_extent, curr_index);
+	}
   }
 
 	if (prev_index == *curr_index) {
@@ -516,8 +520,14 @@ void ADIOI_Flatten(MPI_Datatype datatype, ADIOI_Flatlist_node *flat,
 	    for (i=j; i<j+top_count; i++) {
       /* By using ADIO_Offset we preserve +/- sign and 
          avoid >2G integer arithmetic problems */
-      ADIO_Offset blocklength = ints[1], stride = ints[1+1+i-j];
-		flat->indices[i]   = st_offset + stride* ADIOI_AINT_CAST_TO_OFFSET old_extent;
+		ADIO_Offset blocklength = ints[1];
+		if (is_hindexed_block) {
+		    flat->indices[i] = st_offset + adds[i-j];
+		} else {
+		    ADIO_Offset stride = ints[1+1+i-j];
+		    flat->indices[i] = st_offset +
+			stride* ADIOI_AINT_CAST_TO_OFFSET old_extent;
+		}
 		flat->blocklens[i] = blocklength* ADIOI_AINT_CAST_TO_OFFSET old_extent;
 	    }
 	    *curr_index = i;
@@ -532,7 +542,13 @@ void ADIOI_Flatten(MPI_Datatype datatype, ADIOI_Flatlist_node *flat,
    and then strided. Replicate the first one. */
 	    for (m=1; m<ints[1]; m++) {
 		for (i=0; i<num; i++) {
-		    flat->indices[j]   = flat->indices[j-num] + ADIOI_AINT_CAST_TO_OFFSET old_extent;
+		    if (is_hindexed_block) {
+			/* this is the one place the hindexed case uses the
+			 * extent of a type */
+			MPI_Type_extent(types[0], &old_extent);
+		    }
+		    flat->indices[j] = flat->indices[j-num] +
+			ADIOI_AINT_CAST_TO_OFFSET old_extent;
 		    flat->blocklens[j] = flat->blocklens[j-num];
 		    j++;
 		}
@@ -543,10 +559,16 @@ void ADIOI_Flatten(MPI_Datatype datatype, ADIOI_Flatlist_node *flat,
 	    num = *curr_index - prev_index;
 	    for (i=1; i<top_count; i++) {
 		for (m=0; m<num; m++) {
-      /* By using ADIO_Offset we preserve +/- sign and 
-         avoid >2G integer arithmetic problems */
-      ADIO_Offset stride = ints[2+i]-ints[1+i];
-		    flat->indices[j]   = flat->indices[j-num] + stride* ADIOI_AINT_CAST_TO_OFFSET old_extent;
+		    if (is_hindexed_block) {
+			flat->indices[j] = flat->indices[j-num] +
+			    adds[i] - adds[i-1];
+		    } else {
+			/* By using ADIO_Offset we preserve +/- sign and
+			   avoid >2G integer arithmetic problems */
+			ADIO_Offset stride = ints[2+i]-ints[1+i];
+			flat->indices[j] = flat->indices[j-num] +
+			    stride* ADIOI_AINT_CAST_TO_OFFSET old_extent;
+		    }
 		    flat->blocklens[j] = flat->blocklens[j-num];
 		    j++;
 		}
@@ -963,6 +985,9 @@ MPI_Count ADIOI_Count_contiguous_blocks(MPI_Datatype datatype, MPI_Count *curr_i
 	}
 	break;
 
+#if defined HAVE_DECL_MPI_COMBINER_HINDEXED_BLOCK && HAVE_DECL_MPI_COMBINER_HINDEXED_BLOCK
+    case MPI_COMBINER_HINDEXED_BLOCK:
+#endif
     case MPI_COMBINER_INDEXED_BLOCK:
         top_count = ints[0];
         MPI_Type_get_envelope(types[0], &old_nints, &old_nadds,
diff --git a/src/mpi/romio/configure.ac b/src/mpi/romio/configure.ac
index 1fe952d..68801ad 100644
--- a/src/mpi/romio/configure.ac
+++ b/src/mpi/romio/configure.ac
@@ -1558,6 +1558,7 @@ if test $FROM_OMPI = yes ; then
    # Open MPI: see comments in mpi-io/mpioprof.h
    AC_DEFINE(MPIO_BUILD_PROFILING, 1, [hack to make ROMIO build without profiling])
    DEFINE_HAVE_MPI_GREQUEST="#define HAVE_MPI_GREQUEST"
+   AC_DEFINE(HAVE_DECL_MPI_COMBINER_HINDEXED_BLOCK, 1, [Define if MPI library provides HINDEXED_BLOCK datatype])
 elif test $FROM_LAM = yes ; then
    # LAM does have the status set bytes functionality
    AC_DEFINE(HAVE_STATUS_SET_BYTES,1,[Define if have MPIR_Status_set_bytes])
@@ -1609,6 +1610,7 @@ elif test $FROM_MPICH = yes ; then
    AC_DEFINE(HAVE_MPIIO_CONST, const, Set if MPI-IO prototypes use const qualifier)
    AC_DEFINE(HAVE_MPI_TYPE_SIZE_X, 1, [Define if MPI library provides MPI_TYPE_SIZE_X])
    AC_DEFINE(HAVE_MPI_STATUS_SET_ELEMENTS_X, 1, [Define if MPI library provides MPI_STATUS_SET_ELEMENTS_X])
+   AC_DEFINE(HAVE_DECL_MPI_COMBINER_HINDEXED_BLOCK, 1, [Define if MPI library provides HINDEXED_BLOCK datatype])
 fi
 #
 #

http://git.mpich.org/mpich.git/commitdiff/cef2f1ecfe5be54825776982567c2398bed71af3

commit cef2f1ecfe5be54825776982567c2398bed71af3
Author: Rob Latham <robl at mcs.anl.gov>
Date:   Wed Jul 30 09:59:06 2014 -0500

    rma-using tests belong in rma
    
    even though get-struct does exercise datatype processing code, it's use
    of RMA operations means it belongs in rma directory.
    
    Closes #2141
    
    Signed-off-by: Ken Raffenetti <raffenet at mcs.anl.gov>

diff --git a/test/mpi/datatype/Makefile.am b/test/mpi/datatype/Makefile.am
index b19321a..03c13b5 100644
--- a/test/mpi/datatype/Makefile.am
+++ b/test/mpi/datatype/Makefile.am
@@ -79,8 +79,7 @@ noinst_PROGRAMS =           \
     unusual-noncontigs      \
     vecblklen               \
     zeroblks                \
-    zeroparms               \
-    get-struct
+    zeroparms
 
 # Some of the tests use a more comprehensive set of datatype tests.
 # These must specify a different LDADD that includes the object file
diff --git a/test/mpi/datatype/testlist.in b/test/mpi/datatype/testlist.in
index b2875b2..549c3eb 100644
--- a/test/mpi/datatype/testlist.in
+++ b/test/mpi/datatype/testlist.in
@@ -59,4 +59,3 @@ cxx-types 1 mpiversion=3.0
 @largetest at large_type 1 mpiversion=3.0
 @largetest at large_type_sendrec 2 arg=31 mpiversion=3.0
 @largetest at large_type_sendrec 2 arg=32 mpiversion=3.0 timeLimit=360
-get-struct 2
diff --git a/test/mpi/rma/Makefile.am b/test/mpi/rma/Makefile.am
index 40f3717..b2bf942 100644
--- a/test/mpi/rma/Makefile.am
+++ b/test/mpi/rma/Makefile.am
@@ -124,7 +124,8 @@ noinst_PROGRAMS =          \
     badrma                 \
     nb_test                \
     acc-loc                \
-    fence_shm
+    fence_shm              \
+    get-struct
 
 strided_acc_indexed_LDADD       = $(LDADD) -lm
 strided_acc_onelock_LDADD       = $(LDADD) -lm
diff --git a/test/mpi/datatype/get-struct.c b/test/mpi/rma/get-struct.c
similarity index 99%
rename from test/mpi/datatype/get-struct.c
rename to test/mpi/rma/get-struct.c
index 8970008..8a91e5f 100644
--- a/test/mpi/datatype/get-struct.c
+++ b/test/mpi/rma/get-struct.c
@@ -14,7 +14,7 @@
  *
  * The observed failure was a SEGV in the MPI_Get
  *
- * 
+ *
  */
 #define MAX_KEY_SIZE 64
 #define MAX_VALUE_SIZE 256
diff --git a/test/mpi/rma/testlist.in b/test/mpi/rma/testlist.in
index 72606d2..c1acd24 100644
--- a/test/mpi/rma/testlist.in
+++ b/test/mpi/rma/testlist.in
@@ -109,6 +109,7 @@ badrma 2 mpiversion=3.0
 acc-loc 4
 fence_shm 2 mpiversion=3.0
 win_shared_zerobyte 4 mpiversion=3.0
+get-struct 2
 
 ## This test is not strictly correct.  This was meant to test out the
 ## case when MPI_Test is not nonblocking.  However, we ended up

-----------------------------------------------------------------------

Summary of changes:
 src/mpi/romio/adio/common/flatten.c     |   51 +++++++++++----
 src/mpi/romio/configure.ac              |    2 +
 test/mpi/datatype/Makefile.am           |    3 +-
 test/mpi/datatype/testlist.in           |    1 -
 test/mpi/io/Makefile.am                 |    3 +-
 test/mpi/io/hindexed_io.c               |  106 +++++++++++++++++++++++++++++++
 test/mpi/io/testlist                    |    1 +
 test/mpi/rma/Makefile.am                |    3 +-
 test/mpi/{datatype => rma}/get-struct.c |    2 +-
 test/mpi/rma/testlist.in                |    1 +
 10 files changed, 154 insertions(+), 19 deletions(-)
 create mode 100644 test/mpi/io/hindexed_io.c
 rename test/mpi/{datatype => rma}/get-struct.c (99%)


hooks/post-receive
-- 
MPICH primary repository


More information about the commits mailing list