From 1a27a8cef1da500d0374d6115e578dd44460adcf Mon Sep 17 00:00:00 2001 From: Edgar Gabriel Date: Fri, 30 Mar 2018 07:56:47 -0500 Subject: [PATCH] io/ompio: don't reset amode if MODE_SEQUENTIAL is set the ompio module resets the amode from WRONLY to RDWR in order to accoomodate data sieving in the two-phase fcoll componet. This leads however to an error if MPI_MODE_SEQUENTIAL has been requested by the user, since MODE_SEQUENTIAL is incompatible with MODE_RDWR. SInce the change to the amode was done after opening the file for individual file pointers but before opening the file for shared filepointers, this lead to an error message in the sharedfp component. Note, that data sieving is never necessary if MODE_SEQUENTIAL is set, so this should not be a problem for any scenario. Fixes #4991 Signed-off-by: Edgar Gabriel (cherry picked from commit c4879ec29ffcaf9fd4aca260e87ace330ba9178c) --- ompi/mca/common/ompio/common_ompio_file_open.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/ompi/mca/common/ompio/common_ompio_file_open.c b/ompi/mca/common/ompio/common_ompio_file_open.c index e05aa9e5e79..7db1d7f276c 100644 --- a/ompi/mca/common/ompio/common_ompio_file_open.c +++ b/ompi/mca/common/ompio/common_ompio_file_open.c @@ -111,10 +111,12 @@ int mca_common_ompio_file_open (ompi_communicator_t *comm, /* This fix is needed for data seiving to work with two-phase collective I/O */ - if ((amode & MPI_MODE_WRONLY)){ - amode -= MPI_MODE_WRONLY; - amode += MPI_MODE_RDWR; - } + if ( !(amode & MPI_MODE_SEQUENTIAL) ) { + if ((amode & MPI_MODE_WRONLY)){ + amode -= MPI_MODE_WRONLY; + amode += MPI_MODE_RDWR; + } + } /*--------------------------------------------------*/