Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
seek and other calls must use number of elements and not bytes displacement
authorAugustin Degomme <adegomme@users.noreply.github.com>
Tue, 9 Aug 2022 14:13:53 +0000 (16:13 +0200)
committerAugustin Degomme <adegomme@users.noreply.github.com>
Tue, 9 Aug 2022 14:29:43 +0000 (16:29 +0200)
src/smpi/bindings/smpi_pmpi_file.cpp
src/smpi/mpi/smpi_file.cpp

index 2fa04be..1981ca5 100644 (file)
@@ -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;
 }
 
index 4c1a6cb..45a63ab 100644 (file)
@@ -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;
 }