Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
add Host::send_to and sg_send_to
authorFrederic Suter <frederic.suter@cc.in2p3.fr>
Thu, 11 Jul 2019 21:38:31 +0000 (23:38 +0200)
committerFrederic Suter <frederic.suter@cc.in2p3.fr>
Thu, 11 Jul 2019 21:40:13 +0000 (23:40 +0200)
* mimics a sort of RMA between two hosts (with a parallel task within)
* refactor file system plugin
* fix https://framagit.org/simgrid/simgrid/issues/36

include/simgrid/host.h
include/simgrid/s4u/Host.hpp
src/plugins/file_system/s4u_FileSystem.cpp
src/s4u/s4u_Host.cpp

index 0289c05..bdb3d89 100644 (file)
@@ -132,6 +132,8 @@ XBT_PUBLIC void sg_host_set_property_value(sg_host_t host, const char* name, con
 XBT_PUBLIC void sg_host_route(sg_host_t from, sg_host_t to, xbt_dynar_t links);
 XBT_PUBLIC double sg_host_route_latency(sg_host_t from, sg_host_t to);
 XBT_PUBLIC double sg_host_route_bandwidth(sg_host_t from, sg_host_t to);
+void sg_host_send_to(sg_host_t from, sg_host_t to, double byte_amount);
+
 XBT_PUBLIC void sg_host_dump(sg_host_t ws);
 
 XBT_PUBLIC void sg_host_get_actor_list(sg_host_t host, xbt_dynar_t whereto);
index 48870a8..68c5c63 100644 (file)
@@ -125,6 +125,7 @@ public:
 
   void route_to(Host* dest, std::vector<Link*>& links, double* latency);
   void route_to(Host* dest, std::vector<kernel::resource::LinkImpl*>& links, double* latency);
+  void send_to(Host* dest, double byte_amount);
 
   /** Block the calling actor on an execution located on the called host
    *
index eb6ccb3..b32fd51 100644 (file)
@@ -105,11 +105,7 @@ sg_size_t File::read(sg_size_t size)
   if (host->get_name() != Host::current()->get_name() && read_size > 0) {
     /* the file is hosted on a remote host, initiate a communication between src and dest hosts for data transfer */
     XBT_DEBUG("File is on %s remote host, initiate data transfer of %llu bytes.", host->get_cname(), read_size);
-    std::vector<Host*> m_host_list   = {Host::current(), host};
-    std::vector<double> flops_amount = {0., 0.};
-    std::vector<double> bytes_amount = {0., 0., static_cast<double>(read_size), 0.};
-
-    this_actor::parallel_execute(m_host_list, flops_amount, bytes_amount);
+    host->send_to(Host::current(), read_size);
   }
 
   return read_size;
@@ -131,11 +127,7 @@ sg_size_t File::write(sg_size_t size, int write_inside)
   if (host->get_name() != Host::current()->get_name()) {
     /* the file is hosted on a remote host, initiate a communication between src and dest hosts for data transfer */
     XBT_DEBUG("File is on %s remote host, initiate data transfer of %llu bytes.", host->get_cname(), size);
-    std::vector<Host*> m_host_list   = {Host::current(), host};
-    std::vector<double> flops_amount = {0, 0};
-    std::vector<double> bytes_amount = {0, static_cast<double>(size), 0, 0};
-
-    this_actor::parallel_execute(m_host_list, flops_amount, bytes_amount);
+    Host::current()->send_to(host, size);
   }
 
   XBT_DEBUG("WRITE %s on disk '%s'. size '%llu/%llu' '%llu:%llu'", get_path(), local_storage_->get_cname(), size, size_, sg_storage_get_size_used(local_storage_), sg_storage_get_size(local_storage_));
@@ -270,11 +262,7 @@ int File::remote_copy(sg_host_t host, const char* fullpath)
 
   XBT_DEBUG("Initiate data transfer of %llu bytes between %s and %s.", read_size, src_host->get_cname(),
             storage_dest->get_host()->get_cname());
-  std::vector<Host*> m_host_list   = {src_host, dst_host};
-  std::vector<double> flops_amount = {0, 0};
-  std::vector<double> bytes_amount = {0, static_cast<double>(read_size), 0, 0};
-
-  this_actor::parallel_execute(m_host_list, flops_amount, bytes_amount);
+  src_host->send_to(dst_host, read_size);
 
   /* Create file on remote host, write it and close it */
   File* fd = new File(fullpath, dst_host, nullptr);
index a99e6a8..b8acf61 100644 (file)
@@ -171,6 +171,14 @@ void Host::route_to(Host* dest, std::vector<kernel::resource::LinkImpl*>& links,
   }
 }
 
+void Host::send_to(Host* dest, double byte_amount)
+{
+  std::vector<Host*> m_host_list   = {this, dest};
+  std::vector<double> flops_amount = {0, 0};
+  std::vector<double> bytes_amount = {0, byte_amount, 0, 0};
+  this_actor::parallel_execute(m_host_list, flops_amount, bytes_amount);
+}
+
 /** Get the properties assigned to a host */
 const std::unordered_map<std::string, std::string>* Host::get_properties() const
 {
@@ -591,6 +599,11 @@ double sg_host_route_bandwidth(sg_host_t from, sg_host_t to)
   return min_bandwidth;
 }
 
+void sg_host_send_to(sg_host_t from, sg_host_t to, double byte_amount)
+{
+  from->send_to(to, byte_amount);
+}
+
 /** @brief Displays debugging information about a host */
 void sg_host_dump(sg_host_t host)
 {