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;
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());
atomicity_ = a;
}
-bool File::get_atomicity(){
+bool File::get_atomicity() const
+{
return atomicity_;
}