Commit ae2a3b10 authored by Rob Latham's avatar Rob Latham
Browse files

[svn-r7408] well this sort of got out of hand... the venerable john may...

[svn-r7408] 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.
parent 3e6e7380
......@@ -55,6 +55,8 @@ void ADIO_End(int *error_code)
if( ADIOI_syshints != MPI_INFO_NULL)
MPI_Info_free(&ADIOI_syshints);
MPI_Op_free(&ADIO_same_amode);
*error_code = MPI_SUCCESS;
}
......
......@@ -23,6 +23,8 @@ int MPIR_Infotable_ptr = 0, MPIR_Infotable_max = 0;
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 @@ int ADIO_Init_keyval=MPI_KEYVAL_INVALID;
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 @@ void ADIO_Init(int *argc, char ***argv, int *error_code)
#endif
*error_code = MPI_SUCCESS;
MPI_Op_create(my_consensus, 1, &ADIO_same_amode);
}
......@@ -262,6 +262,8 @@ typedef struct {
#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
......
......@@ -25,3 +25,5 @@ extern int ADIOI_Direct_read, ADIOI_Direct_write;
extern MPI_Errhandler ADIOI_DFLT_ERR_HANDLER;
extern MPI_Info ADIOI_syshints;
extern MPI_Op ADIO_same_amode;
......@@ -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 @@ Output Parameters:
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 @@ int MPI_File_open(MPI_Comm comm, char *filename, int amode,
"**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 */
......
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