X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/9bf0062a4b17bca6198012d9b303548baa8365c0..2f3c9cf811c7c608eb49a3ee14411a887b6a99c8:/src/smpi/mpi/smpi_file.cpp diff --git a/src/smpi/mpi/smpi_file.cpp b/src/smpi/mpi/smpi_file.cpp index 966a5fc30d..4c22c662a6 100644 --- a/src/smpi/mpi/smpi_file.cpp +++ b/src/smpi/mpi/smpi_file.cpp @@ -27,6 +27,8 @@ namespace simgrid{ namespace smpi{ File::File(MPI_Comm comm, const char *filename, int amode, MPI_Info info): comm_(comm), flags_(amode), info_(info) { + if (info_ != MPI_INFO_NULL) + info_->ref(); std::string fullname=filename; if (simgrid::s4u::Host::current()->get_disks().empty()) xbt_die("SMPI/IO : Trying to open file on a diskless host ! Add one to your platform file"); @@ -41,6 +43,7 @@ namespace smpi{ else mount = disk->extension()->get_mount_point(); XBT_DEBUG("No absolute path given for file opening, use '%s'", mount.c_str()); + mount.append("/"); fullname.insert(0, mount); } @@ -71,6 +74,8 @@ namespace smpi{ } delete win_; delete file_; + if (info_ != MPI_INFO_NULL) + simgrid::smpi::Info::unref(info_); } int File::close(MPI_File *fh){ @@ -239,6 +244,23 @@ namespace smpi{ return ret; } + int File::set_view(MPI_Offset /*disp*/, MPI_Datatype etype, MPI_Datatype filetype, const char* datarep, MPI_Info) + { + etype_=etype; + filetype_=filetype; + datarep_=std::string(datarep); + seek_shared(0,MPI_SEEK_SET); + return MPI_SUCCESS; + } + + int File::get_view(MPI_Offset* /*disp*/, MPI_Datatype* etype, MPI_Datatype* filetype, char* datarep) + { + *etype=etype_; + *filetype=filetype_; + snprintf(datarep, MPI_MAX_NAME_STRING+1, "%s", datarep_.c_str()); + return MPI_SUCCESS; + } + int File::size(){ return file_->size(); } @@ -252,17 +274,21 @@ namespace smpi{ return simgrid::smpi::colls::barrier(comm_); } - MPI_Info File::info(){ - if(info_== MPI_INFO_NULL) + MPI_Info File::info() + { + if (info_ == MPI_INFO_NULL) info_ = new Info(); info_->ref(); return info_; } - void File::set_info(MPI_Info info){ - if(info_!= MPI_INFO_NULL) - info->ref(); - info_=info; + void File::set_info(MPI_Info info) + { + if (info_ != MPI_INFO_NULL) + simgrid::smpi::Info::unref(info_); + info_ = info; + if (info_ != MPI_INFO_NULL) + info_->ref(); } MPI_Comm File::comm(){