Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
rename Host::send_to to sendto; add sendto_async
authorMartin Quinson <martin.quinson@ens-rennes.fr>
Tue, 11 Feb 2020 21:08:05 +0000 (22:08 +0100)
committerMartin Quinson <martin.quinson@ens-rennes.fr>
Tue, 11 Feb 2020 21:08:05 +0000 (22:08 +0100)
docs/source/app_s4u.rst
include/simgrid/host.h
include/simgrid/s4u/Host.hpp
src/s4u/s4u_Host.cpp

index 711e992..3966ce1 100644 (file)
@@ -1258,14 +1258,15 @@ Platform and routing
       .. autodoxymethod:: simgrid::s4u::Host::get_netpoint() const
       .. autodoxymethod:: simgrid::s4u::Host::route_to(const Host *dest, std::vector< Link *> &links, double *latency) const
       .. autodoxymethod:: simgrid::s4u::Host::route_to(const Host *dest, std::vector< kernel::resource::LinkImpl *> &links, double *latency) const
-      .. autodoxymethod:: simgrid::s4u::Host::send_to(Host *dest, double byte_amount)
+      .. autodoxymethod:: simgrid::s4u::Host::sendto(Host *dest, double byte_amount)
+      .. autodoxymethod:: simgrid::s4u::Host::sendto_async(Host *dest, double byte_amount)
 
    .. group-tab:: C
 
       .. autodoxymethod:: sg_host_route(const_sg_host_t from, const_sg_host_t to, xbt_dynar_t links)
       .. autodoxymethod:: sg_host_route_bandwidth(const_sg_host_t from, const_sg_host_t to)
       .. autodoxymethod:: sg_host_route_latency(const_sg_host_t from, const_sg_host_t to)
-      .. autodoxymethod:: sg_host_send_to(sg_host_t from, sg_host_t to, double byte_amount)
+      .. autodoxymethod:: sg_host_sendto(sg_host_t from, sg_host_t to, double byte_amount)
 
 Signals
 -------
index e5ad0eb..71d594a 100644 (file)
@@ -135,7 +135,15 @@ XBT_PUBLIC void sg_host_set_property_value(sg_host_t host, const char* name, con
 XBT_PUBLIC void sg_host_route(const_sg_host_t from, const_sg_host_t to, xbt_dynar_t links);
 XBT_PUBLIC double sg_host_route_latency(const_sg_host_t from, const_sg_host_t to);
 XBT_PUBLIC double sg_host_route_bandwidth(const_sg_host_t from, const_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_sendto(sg_host_t from, sg_host_t to, double byte_amount);
+
+#ifndef DOXYGEN
+XBT_ATTRIB_DEPRECATED_v330("Please use sg_host_sendto") inline void sg_host_send_to(sg_host_t from, sg_host_t to,
+                                                                                    double byte_amount)
+{
+  sg_host_sendto(from, to, byte_amount);
+}
+#endif
 
 XBT_PUBLIC void sg_host_dump(const_sg_host_t ws);
 
index 4e9f54d..254caf7 100644 (file)
@@ -159,13 +159,28 @@ public:
 
   void route_to(const Host* dest, std::vector<Link*>& links, double* latency) const;
   void route_to(const Host* dest, std::vector<kernel::resource::LinkImpl*>& links, double* latency) const;
-  /** Do a communication between two arbitrary hosts.
+  /** Do a blocking communication between two arbitrary hosts.
    *
    * This starts a blocking communication right away, bypassing the mailbox and actors mechanism.
    * The calling actor is blocked until the end of the communication; there is really no limit on the hosts involved.
    * In particular, the actor does not have to be on one of the involved hosts. Enjoy the comfort of the simulator :)
    */
-  void send_to(Host* dest, double byte_amount);
+  void sendto(Host* dest, double byte_amount);
+
+  /** Do an asynchronous communication between two arbitrary hosts.
+   *
+   * This initializes a communication that completely bypass the mailbox and actors mechanism.
+   * There is really no limit on the hosts involved. In particular, the actor does not have to be on one of the involved
+   * hosts.
+   */
+  ActivityPtr sendto_async(Host* dest, double byte_amount);
+
+#ifndef DOXYGEN
+  XBT_ATTRIB_DEPRECATED_v330("Please use Host::sendto()") void send_to(Host* dest, double byte_amount)
+  {
+    sendto(dest, byte_amount);
+  }
+#endif
 
   NetZone* get_englobing_zone();
   /** Block the calling actor on an execution located on the called host
index b66f81a..a4aad5c 100644 (file)
@@ -174,12 +174,17 @@ NetZone* Host::get_englobing_zone()
   return pimpl_netpoint_->get_englobing_zone()->get_iface();
 }
 
-void Host::send_to(Host* dest, double byte_amount)
+void Host::sendto(Host* dest, double byte_amount)
+{
+  sendto_async(dest, byte_amount)->wait();
+}
+
+ActivityPtr Host::sendto_async(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);
+  return this_actor::exec_init(m_host_list, flops_amount, bytes_amount)->start();
 }
 
 /** Get the properties assigned to a host */
@@ -591,9 +596,9 @@ double sg_host_route_bandwidth(const_sg_host_t from, const_sg_host_t to)
   return min_bandwidth;
 }
 
-void sg_host_send_to(sg_host_t from, sg_host_t to, double byte_amount)
+void sg_host_sendto(sg_host_t from, sg_host_t to, double byte_amount)
 {
-  from->send_to(to, byte_amount);
+  from->sendto(to, byte_amount);
 }
 
 /** @brief Displays debugging information about a host */