X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/de88ba6429025fa6d048915b20148bc7a301f07f..49609678d7329f0824ca7d5c6d5421fc9d358cbb:/src/smpi/mpi/smpi_file.cpp diff --git a/src/smpi/mpi/smpi_file.cpp b/src/smpi/mpi/smpi_file.cpp index b0596cb1ae..c743cf9b89 100644 --- a/src/smpi/mpi/smpi_file.cpp +++ b/src/smpi/mpi/smpi_file.cpp @@ -13,6 +13,8 @@ #include "smpi_file.hpp" #include "smpi_status.hpp" +#include "simgrid/s4u/Disk.hpp" +#include "simgrid/s4u/Host.hpp" #include "simgrid/plugins/file_system.h" #define FP_SIZE sizeof(MPI_Offset) @@ -25,7 +27,24 @@ namespace simgrid{ namespace smpi{ File::File(MPI_Comm comm, const char *filename, int amode, MPI_Info info): comm_(comm), flags_(amode), info_(info) { - file_= new simgrid::s4u::File(filename, nullptr); + 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"); + + size_t found=fullname.find('/'); + //in case no fullpath is provided ... just pick the first mountpoint. + if(found==std::string::npos){ + auto disk = simgrid::s4u::Host::current()->get_disks().front(); + std::string mount; + if (disk->get_host() != simgrid::s4u::Host::current()) + mount = disk->extension()->get_mount_point(disk->get_host()); + else + mount = disk->extension()->get_mount_point(); + XBT_DEBUG("No absolute path given for file opening, use '%s'", mount.c_str()); + fullname.insert(0, mount); + } + + file_= new simgrid::s4u::File(fullname, nullptr); list_=nullptr; if (comm_->rank() == 0) { int size= comm_->size() + FP_SIZE;