[mpich-commits] r10800 - mpich2/trunk/src/mpi/romio/mpi-io

goodell at mcs.anl.gov goodell at mcs.anl.gov
Thu Dec 20 20:18:52 CST 2012


Author: goodell
Date: 2012-12-20 20:18:52 -0600 (Thu, 20 Dec 2012)
New Revision: 10800

Modified:
   mpich2/trunk/src/mpi/romio/mpi-io/prealloc.c
   mpich2/trunk/src/mpi/romio/mpi-io/set_size.c
Log:
ROMIO: check for consistent prealloc sizes

By using MPI_Allreduce to get the maximum value and minimum value of all
sizes, when the two values are identical, all processes have same values
of size.  The problem of checking the sizes with MPI_Bcast is that the
root will pass the check while the others not.

Based on patch 0004 from the second round of IBM's error checking
patches.

Modified: mpich2/trunk/src/mpi/romio/mpi-io/prealloc.c
===================================================================
--- mpich2/trunk/src/mpi/romio/mpi-io/prealloc.c	2012-12-21 02:18:49 UTC (rev 10799)
+++ mpich2/trunk/src/mpi/romio/mpi-io/prealloc.c	2012-12-21 02:18:52 UTC (rev 10800)
@@ -38,7 +38,7 @@
     int error_code=0, mynod=0;
     ADIO_File adio_fh;
     static char myname[] = "MPI_FILE_PREALLOCATE";
-    MPI_Offset tmp_sz;
+    MPI_Offset tmp_sz, max_sz, min_sz;
 #ifdef MPI_hpux
     int fl_xmpi;
 
@@ -62,9 +62,10 @@
     }
 
     tmp_sz = size;
-    MPI_Bcast(&tmp_sz, 1, ADIO_OFFSET, 0, adio_fh->comm);
+    MPI_Allreduce(&tmp_sz, &max_sz, 1, ADIO_OFFSET, MPI_MAX, adio_fh->comm);
+    MPI_Allreduce(&tmp_sz, &min_sz, 1, ADIO_OFFSET, MPI_MIN, adio_fh->comm);
 
-    if (tmp_sz != size) {
+    if (max_sz != min_sz) {
 	error_code = MPIO_Err_create_code(MPI_SUCCESS, MPIR_ERR_RECOVERABLE,
 					  myname, __LINE__, MPI_ERR_ARG,
 					  "**notsame", 0);

Modified: mpich2/trunk/src/mpi/romio/mpi-io/set_size.c
===================================================================
--- mpich2/trunk/src/mpi/romio/mpi-io/set_size.c	2012-12-21 02:18:49 UTC (rev 10799)
+++ mpich2/trunk/src/mpi/romio/mpi-io/set_size.c	2012-12-21 02:18:52 UTC (rev 10800)
@@ -37,7 +37,7 @@
     int error_code;
     ADIO_File adio_fh;
     static char myname[] = "MPI_FILE_SET_SIZE";
-    MPI_Offset tmp_sz;
+    MPI_Offset tmp_sz, max_sz, min_sz;
 
 #ifdef MPI_hpux
     int fl_xmpi;
@@ -65,10 +65,11 @@
     /* --END ERROR HANDLING-- */
 
     tmp_sz = size;
-    MPI_Bcast(&tmp_sz, 1, ADIO_OFFSET, 0, adio_fh->comm);
+    MPI_Allreduce(&tmp_sz, &max_sz, 1, ADIO_OFFSET, MPI_MAX, adio_fh->comm);
+    MPI_Allreduce(&tmp_sz, &min_sz, 1, ADIO_OFFSET, MPI_MIN, adio_fh->comm);
 
     /* --BEGIN ERROR HANDLING-- */
-    if (tmp_sz != size) {
+    if (max_sz != min_sz) {
 	error_code = MPIO_Err_create_code(MPI_SUCCESS, MPIR_ERR_RECOVERABLE,
 					  myname, __LINE__, MPI_ERR_ARG,
 					  "**notsame", 0);



More information about the commits mailing list