Commit 208d90e6 authored by David Goodell's avatar David Goodell
Browse files

[svn-r10800] 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.
parent 011f107a
......@@ -38,7 +38,7 @@ int MPI_File_preallocate(MPI_File fh, MPI_Offset size)
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 @@ int MPI_File_preallocate(MPI_File fh, MPI_Offset size)
}
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);
......
......@@ -37,7 +37,7 @@ int MPI_File_set_size(MPI_File fh, MPI_Offset size)
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 @@ int MPI_File_set_size(MPI_File fh, MPI_Offset size)
/* --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);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment