Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Remove explicit conversion to std::string when it's not required.
[simgrid.git] / src / smpi / mpi / smpi_file.cpp
index 01c8a92..98f7ccf 100644 (file)
@@ -185,11 +185,9 @@ int File::read(MPI_File fh, void* /*buf*/, int count, const Datatype* datatype,
 int File::read_shared(MPI_File fh, void* buf, int count, const Datatype* datatype, MPI_Status* status)
 {
   fh->shared_mutex_->lock();
-  XBT_VERB("before read shared, shared pointer is %llu, pointer is %llu",*(fh->shared_file_pointer_) , fh->file_->tell());
   fh->seek(*(fh->shared_file_pointer_), MPI_SEEK_SET);
   read(fh, buf, count, datatype, status);
   *(fh->shared_file_pointer_) = fh->file_->tell();
-  XBT_VERB("after read shared, shared pointer is %llu, pointer is %llu",*(fh->shared_file_pointer_) , fh->file_->tell());
   fh->shared_mutex_->unlock();
   fh->seek(*(fh->shared_file_pointer_), MPI_SEEK_SET);
   return MPI_SUCCESS;
@@ -280,17 +278,25 @@ int File::write_ordered(MPI_File fh, const void* buf, int count, const Datatype*
   return ret;
 }
 
-int File::set_view(MPI_Offset /*disp*/, MPI_Datatype etype, MPI_Datatype filetype, const char* datarep, const Info*)
+int File::set_view(MPI_Offset disp, MPI_Datatype etype, MPI_Datatype filetype, const char* datarep, const Info*)
 {
   etype_    = etype;
   filetype_ = filetype;
-  datarep_  = std::string(datarep);
-  seek_shared(0, MPI_SEEK_SET);
+  datarep_  = datarep;
+  disp_     = disp;
+  if (comm_->rank() == 0){
+    if(disp != MPI_DISPLACEMENT_CURRENT)
+      seek_shared(disp, MPI_SEEK_SET);
+    else
+      seek_shared(0, MPI_SEEK_CUR);
+  }
+  sync();
   return MPI_SUCCESS;
 }
 
-int File::get_view(MPI_Offset* /*disp*/, MPI_Datatype* etype, MPI_Datatype* filetype, char* datarep) const
+int File::get_view(MPI_Offset* disp, MPI_Datatype* etype, MPI_Datatype* filetype, char* datarep) const
 {
+  *disp     = disp_;
   *etype    = etype_;
   *filetype = filetype_;
   snprintf(datarep, MPI_MAX_NAME_STRING + 1, "%s", datarep_.c_str());
@@ -367,7 +373,8 @@ void File::set_atomicity(bool a){
   atomicity_ = a;
 }
 
-bool File::get_atomicity(){
+bool File::get_atomicity() const
+{
   return atomicity_;
 }