diff --git a/ompi/mca/common/ompio/common_ompio_file_read.c b/ompi/mca/common/ompio/common_ompio_file_read.c index 475925ae74..6d6d112eb3 100644 --- a/ompi/mca/common/ompio/common_ompio_file_read.c +++ b/ompi/mca/common/ompio/common_ompio_file_read.c @@ -99,7 +99,7 @@ int mca_common_ompio_file_read (ompio_file_t *fh, OMPIO_CUDA_PREPARE_BUF(fh,buf,count,datatype,tbuf,&convertor,max_data,decoded_iov,iov_count); - } + } else { mca_common_ompio_decode_datatype (fh, datatype, @@ -118,6 +118,12 @@ int mca_common_ompio_file_read (ompio_file_t *fh, &decoded_iov, &iov_count); #endif + if ( 0 < max_data && 0 == fh->f_iov_count ) { + if ( MPI_STATUS_IGNORE != status ) { + status->_ucount = 0; + } + return OMPI_SUCCESS; + } if ( -1 == OMPIO_MCA_GET(fh, cycle_buffer_size )) { bytes_per_cycle = max_data; @@ -271,6 +277,14 @@ int mca_common_ompio_file_iread (ompio_file_t *fh, &decoded_iov, &iov_count); #endif + if ( 0 < max_data && 0 == fh->f_iov_count ) { + ompio_req->req_ompi.req_status.MPI_ERROR = OMPI_SUCCESS; + ompio_req->req_ompi.req_status._ucount = 0; + ompi_request_complete (&ompio_req->req_ompi, false); + *request = (ompi_request_t *) ompio_req; + return OMPI_SUCCESS; + } + // Non-blocking operations have to occur in a single cycle j = fh->f_index_in_file_view; diff --git a/ompi/mca/common/ompio/common_ompio_file_write.c b/ompi/mca/common/ompio/common_ompio_file_write.c index e16d8785b4..fb62edf2d9 100644 --- a/ompi/mca/common/ompio/common_ompio_file_write.c +++ b/ompi/mca/common/ompio/common_ompio_file_write.c @@ -96,6 +96,13 @@ int mca_common_ompio_file_write (ompio_file_t *fh, &decoded_iov, &iov_count); #endif + if ( 0 < max_data && 0 == fh->f_iov_count ) { + if ( MPI_STATUS_IGNORE != status ) { + status->_ucount = 0; + } + return OMPI_SUCCESS; + } + if ( -1 == OMPIO_MCA_GET(fh, cycle_buffer_size )) { bytes_per_cycle = max_data; } @@ -242,6 +249,14 @@ int mca_common_ompio_file_iwrite (ompio_file_t *fh, &decoded_iov, &iov_count); #endif + if ( 0 < max_data && 0 == fh->f_iov_count ) { + ompio_req->req_ompi.req_status.MPI_ERROR = OMPI_SUCCESS; + ompio_req->req_ompi.req_status._ucount = 0; + ompi_request_complete (&ompio_req->req_ompi, false); + *request = (ompi_request_t *) ompio_req; + return OMPI_SUCCESS; + } + j = fh->f_index_in_file_view; /* Non blocking operations have to occur in a single cycle */ diff --git a/ompi/mca/sharedfp/lockedfile/sharedfp_lockedfile_seek.c b/ompi/mca/sharedfp/lockedfile/sharedfp_lockedfile_seek.c index e028b9d469..8ff623c764 100644 --- a/ompi/mca/sharedfp/lockedfile/sharedfp_lockedfile_seek.c +++ b/ompi/mca/sharedfp/lockedfile/sharedfp_lockedfile_seek.c @@ -33,7 +33,7 @@ int mca_sharedfp_lockedfile_seek (ompio_file_t *fh, - OMPI_MPI_OFFSET_TYPE offset, int whence) + OMPI_MPI_OFFSET_TYPE off, int whence) { int ret = OMPI_SUCCESS; struct mca_sharedfp_base_data_t *sh = NULL; @@ -41,6 +41,7 @@ mca_sharedfp_lockedfile_seek (ompio_file_t *fh, int fd_lockedfilehandle; /* flock structure that is used to setup the desired fcntl operation */ struct flock fl; + OMPI_MPI_OFFSET_TYPE offset, end_position=0; if(fh->f_sharedfp_data==NULL){ opal_output(ompi_sharedfp_base_framework.framework_output, @@ -49,6 +50,7 @@ mca_sharedfp_lockedfile_seek (ompio_file_t *fh, } sh = fh->f_sharedfp_data; + offset = off * fh->f_etype_size; if( 0 == fh->f_rank ){ if ( MPI_SEEK_SET == whence ){ @@ -74,7 +76,6 @@ mca_sharedfp_lockedfile_seek (ompio_file_t *fh, } } else if( MPI_SEEK_END == whence ){ - OMPI_MPI_OFFSET_TYPE end_position=0; mca_common_ompio_file_get_size( fh,&end_position); offset = end_position + offset; diff --git a/ompi/mca/sharedfp/sm/sharedfp_sm_seek.c b/ompi/mca/sharedfp/sm/sharedfp_sm_seek.c index 5eecd4fb98..17aa72c326 100644 --- a/ompi/mca/sharedfp/sm/sharedfp_sm_seek.c +++ b/ompi/mca/sharedfp/sm/sharedfp_sm_seek.c @@ -34,10 +34,10 @@ int mca_sharedfp_sm_seek (ompio_file_t *fh, - OMPI_MPI_OFFSET_TYPE offset, int whence) + OMPI_MPI_OFFSET_TYPE off, int whence) { int status=0; - OMPI_MPI_OFFSET_TYPE end_position=0; + OMPI_MPI_OFFSET_TYPE offset, end_position=0; int ret = OMPI_SUCCESS; struct mca_sharedfp_base_data_t *sh = NULL; struct mca_sharedfp_sm_data * sm_data = NULL; @@ -50,6 +50,7 @@ mca_sharedfp_sm_seek (ompio_file_t *fh, } sh = fh->f_sharedfp_data; + offset = off * fh->f_etype_size; if( 0 == fh->f_rank ){ if ( MPI_SEEK_SET == whence){