[mpich2-commits] r7408 - in mpich2/trunk/src/mpi/romio: adio/common adio/include mpi-io
robl at mcs.anl.gov
robl at mcs.anl.gov
Tue Nov 2 16:03:04 CDT 2010
Author: robl
Date: 2010-11-02 16:03:04 -0500 (Tue, 02 Nov 2010)
New Revision: 7408
Modified:
mpich2/trunk/src/mpi/romio/adio/common/ad_end.c
mpich2/trunk/src/mpi/romio/adio/common/ad_init.c
mpich2/trunk/src/mpi/romio/adio/include/adio.h
mpich2/trunk/src/mpi/romio/adio/include/adio_extern.h
mpich2/trunk/src/mpi/romio/mpi-io/open.c
Log:
well this sort of got out of hand... the venerable john may testmpio test fails if access modes are declared differently on the processors, so now we catch this error.
Modified: mpich2/trunk/src/mpi/romio/adio/common/ad_end.c
===================================================================
--- mpich2/trunk/src/mpi/romio/adio/common/ad_end.c 2010-11-02 16:28:59 UTC (rev 7407)
+++ mpich2/trunk/src/mpi/romio/adio/common/ad_end.c 2010-11-02 21:03:04 UTC (rev 7408)
@@ -55,6 +55,8 @@
if( ADIOI_syshints != MPI_INFO_NULL)
MPI_Info_free(&ADIOI_syshints);
+ MPI_Op_free(&ADIO_same_amode);
+
*error_code = MPI_SUCCESS;
}
Modified: mpich2/trunk/src/mpi/romio/adio/common/ad_init.c
===================================================================
--- mpich2/trunk/src/mpi/romio/adio/common/ad_init.c 2010-11-02 16:28:59 UTC (rev 7407)
+++ mpich2/trunk/src/mpi/romio/adio/common/ad_init.c 2010-11-02 21:03:04 UTC (rev 7408)
@@ -23,6 +23,8 @@
MPI_Info ADIOI_syshints = MPI_INFO_NULL;
+MPI_Op ADIO_same_amode=MPI_OP_NULL;
+
#if defined(ROMIO_XFS) || defined(ROMIO_LUSTRE)
int ADIOI_Direct_read = 0, ADIOI_Direct_write = 0;
#endif
@@ -31,6 +33,20 @@
MPI_Errhandler ADIOI_DFLT_ERR_HANDLER = MPI_ERRORS_RETURN;
+
+static void my_consensus(void *invec, void *inoutvec, int *len, MPI_Datatype *datatype)
+{
+ int i, *in, *inout;
+ in = (int*)invec;
+ inout = (int*)inoutvec;
+
+ for (i=0; i< *len; i++) {
+ if (in[i] != inout[i])
+ inout[i] = ADIO_AMODE_NOMATCH;
+ }
+ return;
+}
+
void ADIO_Init(int *argc, char ***argv, int *error_code)
{
#if defined(ROMIO_XFS) || defined(ROMIO_LUSTRE)
@@ -111,4 +127,5 @@
#endif
*error_code = MPI_SUCCESS;
+ MPI_Op_create(my_consensus, 1, &ADIO_same_amode);
}
Modified: mpich2/trunk/src/mpi/romio/adio/include/adio.h
===================================================================
--- mpich2/trunk/src/mpi/romio/adio/include/adio.h 2010-11-02 16:28:59 UTC (rev 7407)
+++ mpich2/trunk/src/mpi/romio/adio/include/adio.h 2010-11-02 21:03:04 UTC (rev 7408)
@@ -262,6 +262,8 @@
#define ADIO_APPEND 128
#define ADIO_SEQUENTIAL 256
+#define ADIO_AMODE_NOMATCH ~(ADIO_CREATE|ADIO_RDONLY|ADIO_WRONLY|ADIO_RDWR|ADIO_DELETE_ON_CLOSE|ADIO_UNIQUE_OPEN|ADIO_EXCL|ADIO_APPEND|ADIO_SEQUENTIAL)
+
/* file-pointer types */
#define ADIO_EXPLICIT_OFFSET 100
#define ADIO_INDIVIDUAL 101
Modified: mpich2/trunk/src/mpi/romio/adio/include/adio_extern.h
===================================================================
--- mpich2/trunk/src/mpi/romio/adio/include/adio_extern.h 2010-11-02 16:28:59 UTC (rev 7407)
+++ mpich2/trunk/src/mpi/romio/adio/include/adio_extern.h 2010-11-02 21:03:04 UTC (rev 7408)
@@ -25,3 +25,5 @@
extern MPI_Errhandler ADIOI_DFLT_ERR_HANDLER;
extern MPI_Info ADIOI_syshints;
+
+extern MPI_Op ADIO_same_amode;
Modified: mpich2/trunk/src/mpi/romio/mpi-io/open.c
===================================================================
--- mpich2/trunk/src/mpi/romio/mpi-io/open.c 2010-11-02 16:28:59 UTC (rev 7407)
+++ mpich2/trunk/src/mpi/romio/mpi-io/open.c 2010-11-02 21:03:04 UTC (rev 7408)
@@ -23,6 +23,10 @@
#include "mpioprof.h"
#endif
+/* for user-definde reduce operator */
+#include "adio_extern.h"
+
+
extern int ADIO_Init_keyval;
/*@
@@ -42,7 +46,7 @@
int MPI_File_open(MPI_Comm comm, char *filename, int amode,
MPI_Info info, MPI_File *fh)
{
- int error_code, file_system, flag, /* tmp_amode, */rank;
+ int error_code, file_system, flag, tmp_amode=0, rank;
char *tmp;
MPI_Comm dupcomm;
ADIOI_Fns *fsops;
@@ -100,25 +104,24 @@
"**fileamodeseq", 0);
goto fn_fail;
}
- /* --END ERROR HANDLING-- */
-/* check if amode is the same on all processes */
MPI_Comm_dup(comm, &dupcomm);
-/*
- Removed this check because broadcast is too expensive.
- tmp_amode = amode;
- MPI_Bcast(&tmp_amode, 1, MPI_INT, 0, dupcomm);
- if (amode != tmp_amode) {
- FPRINTF(stderr, "MPI_File_open: amode must be the same on all processes\n");
- MPI_Abort(MPI_COMM_WORLD, 1);
- }
-*/
-
/* check if ADIO has been initialized. If not, initialize it */
MPIR_MPIOInit(&error_code);
if (error_code != MPI_SUCCESS) goto fn_fail;
+/* check if amode is the same on all processes */
+ MPI_Allreduce(&amode, &tmp_amode, 1, MPI_INT, ADIO_same_amode, dupcomm);
+
+ if (tmp_amode == ADIO_AMODE_NOMATCH) {
+ error_code = MPIO_Err_create_code(MPI_SUCCESS, MPIR_ERR_RECOVERABLE,
+ myname, __LINE__, MPI_ERR_AMODE,
+ "**fileamodediff", 0);
+ goto fn_fail;
+ }
+ /* --END ERROR HANDLING-- */
+
file_system = -1;
/* resolve file system type from file name; this is a collective call */
More information about the mpich2-commits
mailing list