From: Augustin Degomme Date: Tue, 9 Aug 2022 14:13:53 +0000 (+0200) Subject: seek and other calls must use number of elements and not bytes displacement X-Git-Tag: v3.32~68 X-Git-Url: http://bilbo.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/commitdiff_plain/95042ad33fe63e1a066916ea1da062752fc67253 seek and other calls must use number of elements and not bytes displacement --- diff --git a/src/smpi/bindings/smpi_pmpi_file.cpp b/src/smpi/bindings/smpi_pmpi_file.cpp index 2fa04be9eb..1981ca571e 100644 --- a/src/smpi/bindings/smpi_pmpi_file.cpp +++ b/src/smpi/bindings/smpi_pmpi_file.cpp @@ -65,7 +65,7 @@ int PMPI_File_close(MPI_File *fh){ int PMPI_File_seek(MPI_File fh, MPI_Offset offset, int whence){ CHECK_FILE(1, fh) const SmpiBenchGuard suspend_bench; - int ret = fh->seek(offset,whence); + int ret = fh->seek(offset*fh->etype()->get_extent(),whence); return ret; } @@ -73,7 +73,7 @@ int PMPI_File_seek_shared(MPI_File fh, MPI_Offset offset, int whence){ CHECK_FILE(1, fh) CHECK_COLLECTIVE(fh->comm(), __func__) const SmpiBenchGuard suspend_bench; - int ret = fh->seek_shared(offset,whence); + int ret = fh->seek_shared(offset*fh->etype()->get_extent(),whence); return ret; } diff --git a/src/smpi/mpi/smpi_file.cpp b/src/smpi/mpi/smpi_file.cpp index 4c1a6cb93f..45a63abc28 100644 --- a/src/smpi/mpi/smpi_file.cpp +++ b/src/smpi/mpi/smpi_file.cpp @@ -111,14 +111,14 @@ int File::del(const char* filename, const Info*) int File::get_position(MPI_Offset* offset) const { - *offset = file_->tell(); + *offset = file_->tell()/etype_->get_extent(); return MPI_SUCCESS; } int File::get_position_shared(MPI_Offset* offset) const { shared_mutex_->lock(); - *offset = *shared_file_pointer_; + *offset = *shared_file_pointer_/etype_->get_extent(); shared_mutex_->unlock(); return MPI_SUCCESS; }