X-Git-Url: http://bilbo.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/7644d8282ec471a055d7e8208c48799d8972c607..f892a79cccc53305bc9610fa00573c56a0ac6ac3:/src/smpi/mpi/smpi_file.cpp diff --git a/src/smpi/mpi/smpi_file.cpp b/src/smpi/mpi/smpi_file.cpp index 9eac544072..4c1a6cb93f 100644 --- a/src/smpi/mpi/smpi_file.cpp +++ b/src/smpi/mpi/smpi_file.cpp @@ -204,6 +204,8 @@ int File::read_ordered(MPI_File fh, void* buf, int count, const Datatype* dataty MPI_Offset result; simgrid::smpi::colls::scan(&val, &result, 1, MPI_OFFSET, MPI_SUM, fh->comm_); + MPI_Offset prev; + fh->get_position(&prev); fh->seek(result, MPI_SEEK_SET); int ret = fh->op_all(buf, count, datatype, status); if (fh->comm_->rank() == fh->comm_->size() - 1) { @@ -213,6 +215,7 @@ int File::read_ordered(MPI_File fh, void* buf, int count, const Datatype* dataty } char c; simgrid::smpi::colls::bcast(&c, 1, MPI_BYTE, fh->comm_->size() - 1, fh->comm_); + fh->seek(prev, MPI_SEEK_SET); return ret; } @@ -239,11 +242,14 @@ int File::write_shared(MPI_File fh, const void* buf, int count, const Datatype* { fh->shared_mutex_->lock(); XBT_DEBUG("Write shared on %s - Shared ptr before : %lld", fh->file_->get_path(), *(fh->shared_file_pointer_)); + MPI_Offset prev; + fh->get_position(&prev); fh->seek(*(fh->shared_file_pointer_), MPI_SEEK_SET); write(fh, const_cast(buf), count, datatype, status); *(fh->shared_file_pointer_) = fh->file_->tell(); XBT_DEBUG("Write shared on %s - Shared ptr after : %lld", fh->file_->get_path(), *(fh->shared_file_pointer_)); fh->shared_mutex_->unlock(); + fh->seek(prev, MPI_SEEK_SET); return MPI_SUCCESS; } @@ -258,6 +264,8 @@ int File::write_ordered(MPI_File fh, const void* buf, int count, const Datatype* } MPI_Offset result; simgrid::smpi::colls::scan(&val, &result, 1, MPI_OFFSET, MPI_SUM, fh->comm_); + MPI_Offset prev; + fh->get_position(&prev); fh->seek(result, MPI_SEEK_SET); int ret = fh->op_all(const_cast(buf), count, datatype, status); if (fh->comm_->rank() == fh->comm_->size() - 1) { @@ -267,6 +275,7 @@ int File::write_ordered(MPI_File fh, const void* buf, int count, const Datatype* } char c; simgrid::smpi::colls::bcast(&c, 1, MPI_BYTE, fh->comm_->size() - 1, fh->comm_); + fh->seek(prev, MPI_SEEK_SET); return ret; }