From 0b17abb2d52f297734bca845294edcb733d224c0 Mon Sep 17 00:00:00 2001 From: Augustin Degomme Date: Fri, 6 Mar 2020 14:55:26 +0100 Subject: [PATCH] Fix shared seek when using something else than MPI_SEEK_SET --- src/smpi/mpi/smpi_file.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/smpi/mpi/smpi_file.cpp b/src/smpi/mpi/smpi_file.cpp index b92dbc4115..36184d62b3 100644 --- a/src/smpi/mpi/smpi_file.cpp +++ b/src/smpi/mpi/smpi_file.cpp @@ -134,7 +134,7 @@ namespace smpi{ int File::seek_shared(MPI_Offset offset, int whence){ shared_mutex_->lock(); seek(offset,whence); - *shared_file_pointer_=offset; + *shared_file_pointer_=file_->tell(); shared_mutex_->unlock(); return MPI_SUCCESS; } @@ -219,9 +219,11 @@ namespace smpi{ int File::write_shared(MPI_File fh, const void *buf, int count, MPI_Datatype datatype, MPI_Status *status){ fh->shared_mutex_->lock(); + XBT_DEBUG("Write shared on %s - Shared ptr before : %lld",fh->file_->get_path(), *(fh->shared_file_pointer_)); 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(); return MPI_SUCCESS; } -- 2.20.1