From: Martin Quinson Date: Tue, 11 Feb 2020 21:08:05 +0000 (+0100) Subject: rename Host::send_to to sendto; add sendto_async X-Git-Tag: v3.26~977 X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/commitdiff_plain/4bc8b4b0f3d739752d1d7950cc5383b2d5b63bb0 rename Host::send_to to sendto; add sendto_async --- diff --git a/docs/source/app_s4u.rst b/docs/source/app_s4u.rst index 711e992eb4..3966ce1134 100644 --- a/docs/source/app_s4u.rst +++ b/docs/source/app_s4u.rst @@ -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 ------- diff --git a/include/simgrid/host.h b/include/simgrid/host.h index e5ad0eb50a..71d594acdd 100644 --- a/include/simgrid/host.h +++ b/include/simgrid/host.h @@ -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); diff --git a/include/simgrid/s4u/Host.hpp b/include/simgrid/s4u/Host.hpp index 4e9f54dd05..254caf7ac8 100644 --- a/include/simgrid/s4u/Host.hpp +++ b/include/simgrid/s4u/Host.hpp @@ -159,13 +159,28 @@ public: void route_to(const Host* dest, std::vector& links, double* latency) const; void route_to(const Host* dest, std::vector& 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 diff --git a/src/s4u/s4u_Host.cpp b/src/s4u/s4u_Host.cpp index b66f81abbf..a4aad5cccf 100644 --- a/src/s4u/s4u_Host.cpp +++ b/src/s4u/s4u_Host.cpp @@ -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 m_host_list = {this, dest}; std::vector flops_amount = {0, 0}; std::vector 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 */