.. tabs::
- .. example-tab:: examples/s4u/async-wait/s4u-async-wait.cpp
+ .. example-tab:: examples/s4u/comm-wait/s4u-comm-wait.cpp
See also :cpp:func:`simgrid::s4u::Mailbox::put_async()` and :cpp:func:`simgrid::s4u::Comm::wait()`.
- .. example-tab:: examples/python/async-wait/async-wait.py
+ .. example-tab:: examples/python/comm-wait/comm-wait.py
See also :py:func:`simgrid.Mailbox.put_async()` and :py:func:`simgrid.Comm.wait()`.
- .. example-tab:: examples/c/async-wait/async-wait.c
+ .. example-tab:: examples/c/comm-wait/comm-wait.c
See also :cpp:func:`sg_mailbox_put_async()` and :cpp:func:`sg_comm__wait()`.
.. tabs::
- .. example-tab:: examples/s4u/async-waitall/s4u-async-waitall.cpp
+ .. example-tab:: examples/s4u/comm-waitall/s4u-comm-waitall.cpp
See also :cpp:func:`simgrid::s4u::Comm::wait_all()`.
- .. example-tab:: examples/python/async-waitall/async-waitall.py
+ .. example-tab:: examples/python/comm-waitall/comm-waitall.py
See also :py:func:`simgrid.Comm.wait_all()`.
- .. example-tab:: examples/c/async-waitall/async-waitall.c
+ .. example-tab:: examples/c/comm-waitall/comm-waitall.c
See also :cpp:func:`sg_comm_wait_all()`.
.. tabs::
- .. example-tab:: examples/s4u/async-waitany/s4u-async-waitany.cpp
+ .. example-tab:: examples/s4u/comm-waitany/s4u-comm-waitany.cpp
See also :cpp:func:`simgrid::s4u::Comm::wait_any()`.
- .. example-tab:: examples/python/async-waitany/async-waitany.py
+ .. example-tab:: examples/python/comm-waitany/comm-waitany.py
See also :py:func:`simgrid.Comm.wait_any()`.
- .. example-tab:: examples/c/async-waitany/async-waitany.c
+ .. example-tab:: examples/c/comm-waitany/comm-waitany.c
See also :cpp:func:`sg_comm_wait_any`.
actor-create actor-daemon actor-exiting actor-join actor-kill actor-lifetime actor-migrate actor-stacksize
actor-suspend actor-yield
app-masterworker app-pingpong app-token-ring
- async-wait async-waitall async-waitany
+ comm-wait comm-waitall comm-waitany
cloud-capping cloud-masterworker cloud-migration cloud-simple
dht-pastry
exec-async exec-basic exec-dvfs exec-remote exec-waitany
${CMAKE_CURRENT_SOURCE_DIR}/app-masterworker/app-masterworker-multicore_d.xml
${CMAKE_CURRENT_SOURCE_DIR}/app-masterworker/app-masterworker-vivaldi_d.xml
${CMAKE_CURRENT_SOURCE_DIR}/app-pingpong/app-pingpong_d.xml
- ${CMAKE_CURRENT_SOURCE_DIR}/async-wait/async-wait_d.xml
- ${CMAKE_CURRENT_SOURCE_DIR}/async-wait/async-wait2_d.xml
- ${CMAKE_CURRENT_SOURCE_DIR}/async-wait/async-wait3_d.xml
- ${CMAKE_CURRENT_SOURCE_DIR}/async-wait/async-wait4_d.xml
- ${CMAKE_CURRENT_SOURCE_DIR}/async-waitall/async-waitall_d.xml
- ${CMAKE_CURRENT_SOURCE_DIR}/async-waitany/async-waitany_d.xml
+ ${CMAKE_CURRENT_SOURCE_DIR}/comm-wait/comm-wait_d.xml
+ ${CMAKE_CURRENT_SOURCE_DIR}/comm-wait/comm-wait2_d.xml
+ ${CMAKE_CURRENT_SOURCE_DIR}/comm-wait/comm-wait3_d.xml
+ ${CMAKE_CURRENT_SOURCE_DIR}/comm-wait/comm-wait4_d.xml
+ ${CMAKE_CURRENT_SOURCE_DIR}/comm-waitall/comm-waitall_d.xml
+ ${CMAKE_CURRENT_SOURCE_DIR}/comm-waitany/comm-waitany_d.xml
${CMAKE_CURRENT_SOURCE_DIR}/dht-kademlia/dht-kademlia_d.xml
${CMAKE_CURRENT_SOURCE_DIR}/dht-pastry/dht-pastry_d.xml
${CMAKE_CURRENT_SOURCE_DIR}/io-file-remote/io-file-remote_d.xml
actor-create actor-daemon actor-exiting actor-join actor-kill actor-lifetime actor-migrate actor-stacksize
actor-suspend actor-yield
app-bittorrent app-chainsend app-masterworker app-pingpong app-token-ring
- async-wait async-waitall async-waitany
+ comm-wait comm-waitall comm-waitany
cloud-capping cloud-masterworker cloud-migration cloud-simple
dht-kademlia dht-pastry
exec-async exec-basic exec-dvfs exec-remote exec-waitany
#include <stdio.h>
-XBT_LOG_NEW_DEFAULT_CATEGORY(async_wait, "Messages specific for this example");
+XBT_LOG_NEW_DEFAULT_CATEGORY(comm_wait, "Messages specific for this example");
/* Main function of the Sender actor */
static void sender(int argc, char* argv[])
p Test1 sg_comm_test() with Sleep_sender > Sleep_receiver
-$ ${bindir:=.}/c-async-wait ${platfdir:=.}/small_platform_fatpipe.xml ${srcdir:=.}/async-wait_d.xml "--log=root.fmt:[%10.6r]%e(%i:%P@%h)%e%m%n"
+$ ${bindir:=.}/c-comm-wait ${platfdir:=.}/small_platform_fatpipe.xml ${srcdir:=.}/comm-wait_d.xml "--log=root.fmt:[%10.6r]%e(%i:%P@%h)%e%m%n"
> [ 0.000000] (1:sender@Tremblay) sleep_start_time : 5.000000 , sleep_test_time : 0.100000
> [ 0.000000] (2:receiver@Ruby) sleep_start_time : 1.000000 , sleep_test_time : 0.100000
> [ 1.000000] (2:receiver@Ruby) Wait for my first message
p Test2 sg_comm_test() with Sleep_sender < Sleep_receiver
-$ ${bindir:=.}/c-async-wait ${platfdir:=.}/small_platform_fatpipe.xml ${srcdir:=.}/async-wait2_d.xml "--log=root.fmt:[%10.6r]%e(%i:%P@%h)%e%m%n"
+$ ${bindir:=.}/c-comm-wait ${platfdir:=.}/small_platform_fatpipe.xml ${srcdir:=.}/comm-wait2_d.xml "--log=root.fmt:[%10.6r]%e(%i:%P@%h)%e%m%n"
> [ 0.000000] (1:sender@Tremblay) sleep_start_time : 1.000000 , sleep_test_time : 0.100000
> [ 0.000000] (2:receiver@Ruby) sleep_start_time : 5.000000 , sleep_test_time : 0.100000
> [ 1.000000] (1:sender@Tremblay) Send 'Message 0' to 'receiver'
p Test1 sg_comm_wait() with Sleep_sender > Sleep_receiver
-$ ${bindir:=.}/c-async-wait ${platfdir:=.}/small_platform_fatpipe.xml ${srcdir:=.}/async-wait3_d.xml "--log=root.fmt:[%10.6r]%e(%i:%P@%h)%e%m%n"
+$ ${bindir:=.}/c-comm-wait ${platfdir:=.}/small_platform_fatpipe.xml ${srcdir:=.}/comm-wait3_d.xml "--log=root.fmt:[%10.6r]%e(%i:%P@%h)%e%m%n"
> [ 0.000000] (1:sender@Tremblay) sleep_start_time : 5.000000 , sleep_test_time : 0.000000
> [ 0.000000] (2:receiver@Ruby) sleep_start_time : 1.000000 , sleep_test_time : 0.000000
> [ 1.000000] (2:receiver@Ruby) Wait for my first message
p Test2 sg_comm_wait() with Sleep_sender < Sleep_receiver
-$ ${bindir:=.}/c-async-wait ${platfdir:=.}/small_platform_fatpipe.xml ${srcdir:=.}/async-wait4_d.xml "--log=root.fmt:[%10.6r]%e(%i:%P@%h)%e%m%n"
+$ ${bindir:=.}/c-comm-wait ${platfdir:=.}/small_platform_fatpipe.xml ${srcdir:=.}/comm-wait4_d.xml "--log=root.fmt:[%10.6r]%e(%i:%P@%h)%e%m%n"
> [ 0.000000] (1:sender@Tremblay) sleep_start_time : 1.000000 , sleep_test_time : 0.000000
> [ 0.000000] (2:receiver@Ruby) sleep_start_time : 5.000000 , sleep_test_time : 0.000000
> [ 1.000000] (1:sender@Tremblay) Send 'Message 0' to 'receiver'
#include <stdio.h> /* snprintf */
-XBT_LOG_NEW_DEFAULT_CATEGORY(msg_async_waitall, "Messages specific for this msg example");
+XBT_LOG_NEW_DEFAULT_CATEGORY(comm_waitall, "Messages specific for this msg example");
static void sender(int argc, char* argv[])
{
#!/usr/bin/env tesh
! output sort 19
-$ ${bindir:=.}/c-async-waitall ${platfdir:=.}/small_platform_fatpipe.xml ${srcdir:=.}/async-waitall_d.xml "--log=root.fmt:[%10.6r]%e(%i:%P@%h)%e%m%n"
+$ ${bindir:=.}/c-comm-waitall ${platfdir:=.}/small_platform_fatpipe.xml ${srcdir:=.}/comm-waitall_d.xml "--log=root.fmt:[%10.6r]%e(%i:%P@%h)%e%m%n"
> [ 0.000000] (1:sender@Tremblay) Send 'Message 0' to 'receiver-0'
> [ 0.000000] (2:receiver@Ruby) Wait for my first message
> [ 0.000000] (3:receiver@Perl) Wait for my first message
#include <stdio.h> /* snprintf */
-XBT_LOG_NEW_DEFAULT_CATEGORY(async_waitany, "Messages specific for this example");
+XBT_LOG_NEW_DEFAULT_CATEGORY(comm_waitany, "Messages specific for this example");
static void sender(int argc, char* argv[])
{
#!/usr/bin/env tesh
! output sort 19
-$ ${bindir:=.}/c-async-waitany ${platfdir:=.}/small_platform.xml ${srcdir:=.}/async-waitany_d.xml "--log=root.fmt:[%10.6r]%e(%i:%P@%h)%e%m%n"
+$ ${bindir:=.}/c-comm-waitany ${platfdir:=.}/small_platform.xml ${srcdir:=.}/comm-waitany_d.xml "--log=root.fmt:[%10.6r]%e(%i:%P@%h)%e%m%n"
> [ 0.000000] (1:sender@Tremblay) Send 'Message 0' to 'receiver-0'
> [ 0.000000] (1:sender@Tremblay) Send 'Message 1' to 'receiver-1'
> [ 0.000000] (1:sender@Tremblay) Send 'Message 2' to 'receiver-0'
foreach(example actor-create actor-daemon actor-join actor-kill actor-migrate actor-suspend actor-yield actor-lifetime
- async-wait async-waitall async-waitany
+ comm-wait comm-waitall comm-waitany
exec-async exec-basic exec-dvfs exec-remote)
set(tesh_files ${tesh_files} ${CMAKE_CURRENT_SOURCE_DIR}/${example}/${example}.tesh)
set(examples_src ${examples_src} ${CMAKE_CURRENT_SOURCE_DIR}/${example}/${example}.py)
set(examples_src ${examples_src} PARENT_SCOPE)
set(tesh_files ${tesh_files} examples/python/actor-create/actor-create_d.xml
examples/python/actor-lifetime/actor-lifetime_d.xml
- examples/python/async-wait/async-wait_d.xml
- examples/python/async-waitall/async-waitall_d.xml
- examples/python/async-waitany/async-waitany_d.xml PARENT_SCOPE)
+ examples/python/comm-wait/comm-wait_d.xml
+ examples/python/comm-waitall/comm-waitall_d.xml
+ examples/python/comm-waitany/comm-waitany_d.xml PARENT_SCOPE)
#!/usr/bin/env tesh
-$ ${pythoncmd:=python3} ${PYTHON_TOOL_OPTIONS:=} ${bindir:=.}/async-wait.py ${platfdir}/small_platform_fatpipe.xml async-wait_d.xml "--log=root.fmt:[%10.6r]%e(%i:%P@%h)%e%m%n"
+$ ${pythoncmd:=python3} ${PYTHON_TOOL_OPTIONS:=} ${bindir:=.}/comm-wait.py ${platfdir}/small_platform_fatpipe.xml comm-wait_d.xml "--log=root.fmt:[%10.6r]%e(%i:%P@%h)%e%m%n"
> [ 0.000000] (1:sender@Tremblay) Send 'Message 0' to 'Mailbox(receiver-0)'
> [ 0.000000] (2:receiver@Ruby) Wait for my first message
> [ 0.000000] (1:sender@Tremblay) Send 'Message 1' to 'Mailbox(receiver-0)'
#!/usr/bin/env tesh
-$ ${pythoncmd:=python3} ${PYTHON_TOOL_OPTIONS:=} ${bindir:=.}/async-waitall.py ${platfdir}/small_platform_fatpipe.xml async-waitall_d.xml "--log=root.fmt:[%10.6r]%e(%i:%P@%h)%e%m%n"
+$ ${pythoncmd:=python3} ${PYTHON_TOOL_OPTIONS:=} ${bindir:=.}/comm-waitall.py ${platfdir}/small_platform_fatpipe.xml comm-waitall_d.xml "--log=root.fmt:[%10.6r]%e(%i:%P@%h)%e%m%n"
> [ 0.000000] (1:sender@Tremblay) Send 'Message 0' to 'Mailbox(receiver-0)'
> [ 0.000000] (2:receiver@Ruby) Wait for my first message
> [ 0.000000] (3:receiver@Perl) Wait for my first message
p Testing Comm.wait_any()
! output sort 19
-$ ${pythoncmd:=python3} ${PYTHON_TOOL_OPTIONS:=} ${bindir:=.}/async-waitany.py ${platfdir}/small_platform.xml async-waitany_d.xml "--log=root.fmt:[%10.6r]%e(%i:%P@%h)%e%m%n"
+$ ${pythoncmd:=python3} ${PYTHON_TOOL_OPTIONS:=} ${bindir:=.}/comm-waitany.py ${platfdir}/small_platform.xml comm-waitany_d.xml "--log=root.fmt:[%10.6r]%e(%i:%P@%h)%e%m%n"
> [ 0.000000] (1:sender@Tremblay) Send 'Message 0' to 'Mailbox(receiver-0)'
> [ 0.000000] (2:receiver@Fafard) Wait for my first message
> [ 0.000000] (3:receiver@Jupiter) Wait for my first message
foreach (example actor-create actor-daemon actor-exiting actor-join actor-kill
actor-lifetime actor-migrate actor-suspend actor-yield actor-stacksize
app-bittorrent app-chainsend app-pingpong app-token-ring
- async-ready async-wait async-waitany async-waitall async-waituntil
+ comm-ready comm-wait comm-waitany comm-waitall comm-waituntil
comm-dependent
cloud-capping cloud-migration cloud-simple
dht-chord dht-kademlia
${CMAKE_CURRENT_SOURCE_DIR}/actor-yield/s4u-actor-yield_d.xml
${CMAKE_CURRENT_SOURCE_DIR}/app-bittorrent/s4u-app-bittorrent_d.xml
${CMAKE_CURRENT_SOURCE_DIR}/app-masterworkers/s4u-app-masterworkers_d.xml
- ${CMAKE_CURRENT_SOURCE_DIR}/async-wait/s4u-async-wait_d.xml
- ${CMAKE_CURRENT_SOURCE_DIR}/async-waitany/s4u-async-waitany_d.xml
- ${CMAKE_CURRENT_SOURCE_DIR}/async-waitall/s4u-async-waitall_d.xml
- ${CMAKE_CURRENT_SOURCE_DIR}/async-ready/s4u-async-ready_d.xml
- ${CMAKE_CURRENT_SOURCE_DIR}/async-waituntil/s4u-async-waituntil_d.xml
+ ${CMAKE_CURRENT_SOURCE_DIR}/comm-wait/s4u-comm-wait_d.xml
+ ${CMAKE_CURRENT_SOURCE_DIR}/comm-waitany/s4u-comm-waitany_d.xml
+ ${CMAKE_CURRENT_SOURCE_DIR}/comm-waitall/s4u-comm-waitall_d.xml
+ ${CMAKE_CURRENT_SOURCE_DIR}/comm-ready/s4u-comm-ready_d.xml
+ ${CMAKE_CURRENT_SOURCE_DIR}/comm-waituntil/s4u-comm-waituntil_d.xml
${CMAKE_CURRENT_SOURCE_DIR}/dht-chord/s4u-dht-chord_d.xml
${CMAKE_CURRENT_SOURCE_DIR}/dht-kademlia/s4u-dht-kademlia_d.xml
${CMAKE_CURRENT_SOURCE_DIR}/energy-boot/platform_boot.xml
double msg_size = std::stol(argv[3]); /* - message size in bytes */
long peers_count = std::stod(argv[4]); /* - number of peers */
- /* Set myself as the persistent receiver of my mailbox so that messages start flowing to me as soon as they are put into it */
+ /* Set myself as the persistent receiver of my mailbox so that messages start flowing to me as soon as they are put
+ * into it */
simgrid::s4u::Mailbox* my_mbox = simgrid::s4u::Mailbox::by_name(std::string("peer-") + std::to_string(my_id));
my_mbox->set_receiver(simgrid::s4u::Actor::self());
for (int i = 0; i < messages_count; i++) {
for (int peer_id = 0; peer_id < peers_count; peer_id++) {
if (peer_id != my_id) {
- std::string mboxName = std::string("peer-") + std::to_string(peer_id);
- simgrid::s4u::Mailbox* mbox = simgrid::s4u::Mailbox::by_name(mboxName);
- std::string msgName = std::string("Message ") + std::to_string(i) + std::string(" from peer ") + std::to_string(my_id);
- std::string* payload = new std::string(msgName); // copy the data we send:
+ std::string mboxName = std::string("peer-") + std::to_string(peer_id);
+ simgrid::s4u::Mailbox* mbox = simgrid::s4u::Mailbox::by_name(mboxName);
+ std::string msgName =
+ std::string("Message ") + std::to_string(i) + std::string(" from peer ") + std::to_string(my_id);
+ std::string* payload = new std::string(msgName); // copy the data we send:
// 'msgName' is not a stable storage location
XBT_INFO("Send '%s' to '%s'", msgName.c_str(), mboxName.c_str());
/* Create a communication representing the ongoing communication */
/* Start sending messages to let peers know that they should stop */
for (int peer_id = 0; peer_id < peers_count; peer_id++) {
if (peer_id != my_id) {
- std::string mboxName = std::string("peer-") + std::to_string(peer_id);
- simgrid::s4u::Mailbox* mbox = simgrid::s4u::Mailbox::by_name(mboxName);
- std::string* payload = new std::string("finalize"); // Make a copy of the data we will send
+ std::string mboxName = std::string("peer-") + std::to_string(peer_id);
+ simgrid::s4u::Mailbox* mbox = simgrid::s4u::Mailbox::by_name(mboxName);
+ std::string* payload = new std::string("finalize"); // Make a copy of the data we will send
pending_comms.push_back(mbox->put_async(payload, msg_size));
XBT_INFO("Send 'finalize' to 'peer-%d'", peer_id);
}
}
XBT_INFO("Done dispatching all messages");
- /* Retrieve all the messages other peers have been sending to me until I receive all the corresponding "Finalize" messages */
+ /* Retrieve all the messages other peers have been sending to me until I receive all the corresponding "Finalize"
+ * messages */
int pending_finalize_messages = peers_count - 1;
while (pending_finalize_messages > 0) {
if (my_mbox->ready()) {
- double start = simgrid::s4u::Engine::get_clock();
+ double start = simgrid::s4u::Engine::get_clock();
const std::string* received = static_cast<std::string*>(my_mbox->get());
- double waiting_time = simgrid::s4u::Engine::get_clock() - start;
- xbt_assert(waiting_time == 0, "Expecting the waiting time to be 0 because the communication was supposedly ready, but got %f instead", waiting_time);
+ double waiting_time = simgrid::s4u::Engine::get_clock() - start;
+ xbt_assert(
+ waiting_time == 0,
+ "Expecting the waiting time to be 0 because the communication was supposedly ready, but got %f instead",
+ waiting_time);
XBT_INFO("I got a '%s'.", received->c_str());
if (*received == "finalize") {
pending_finalize_messages--;
XBT_INFO("Goodbye now!");
}
-
-int main(int argc, char *argv[])
+int main(int argc, char* argv[])
{
xbt_assert(argc > 2, "Usage: %s platform_file deployment_file\n", argv[0]);
p Test1 Peer sending and receiving
-$ ${bindir:=.}/s4u-async-ready ${platfdir}/small_platform_fatpipe.xml s4u-async-ready_d.xml "--log=root.fmt:[%10.6r]%e(%i:%P@%h)%e%m%n"
+$ ${bindir:=.}/s4u-comm-ready ${platfdir}/small_platform_fatpipe.xml s4u-comm-ready_d.xml "--log=root.fmt:[%10.6r]%e(%i:%P@%h)%e%m%n"
> [ 0.000000] (1:peer@Tremblay) Send 'Message 0 from peer 0' to 'peer-1'
> [ 0.000000] (2:peer@Ruby) Send 'Message 0 from peer 1' to 'peer-0'
> [ 0.000000] (1:peer@Tremblay) Send 'Message 0 from peer 0' to 'peer-2'
#include <iostream>
#include <string>
-XBT_LOG_NEW_DEFAULT_CATEGORY(s4u_async_wait, "Messages specific for this s4u example");
+XBT_LOG_NEW_DEFAULT_CATEGORY(s4u_comm_wait, "Messages specific for this s4u example");
static void sender(int argc, char** argv)
{
}
}
-int main(int argc, char *argv[])
+int main(int argc, char* argv[])
{
xbt_assert(argc > 2, "Usage: %s platform_file deployment_file\n", argv[0]);
p Test1 Sleep_sender > Sleep_receiver
-$ ${bindir:=.}/s4u-async-wait ${platfdir}/small_platform_fatpipe.xml s4u-async-wait_d.xml "--log=root.fmt:[%10.6r]%e(%i:%P@%h)%e%m%n"
+$ ${bindir:=.}/s4u-comm-wait ${platfdir}/small_platform_fatpipe.xml s4u-comm-wait_d.xml "--log=root.fmt:[%10.6r]%e(%i:%P@%h)%e%m%n"
> [ 0.000000] (1:sender@Tremblay) sleep_start_time : 5.000000 , sleep_test_time : 0.000000
> [ 0.000000] (2:receiver@Ruby) sleep_start_time : 1.000000 , sleep_test_time : 0.100000
> [ 1.000000] (2:receiver@Ruby) Wait for my first message
}
};
-int main(int argc, char *argv[])
+int main(int argc, char* argv[])
{
xbt_assert(argc > 2, "Usage: %s platform_file deployment_file\n", argv[0]);
#!/usr/bin/env tesh
-$ ${bindir:=.}/s4u-async-waitall ${platfdir}/small_platform_fatpipe.xml s4u-async-waitall_d.xml "--log=root.fmt:[%10.6r]%e(%i:%P@%h)%e%m%n"
+$ ${bindir:=.}/s4u-comm-waitall ${platfdir}/small_platform_fatpipe.xml s4u-comm-waitall_d.xml "--log=root.fmt:[%10.6r]%e(%i:%P@%h)%e%m%n"
> [ 0.000000] (1:sender@Tremblay) Send 'Message 0' to 'receiver-0'
> [ 0.000000] (2:receiver@Ruby) Wait for my first message
> [ 0.000000] (3:receiver@Perl) Wait for my first message
#include <iostream>
#include <string>
-XBT_LOG_NEW_DEFAULT_CATEGORY(s4u_async_waitall, "Messages specific for this s4u example");
+XBT_LOG_NEW_DEFAULT_CATEGORY(s4u_comm_waitall, "Messages specific for this s4u example");
class Sender {
long messages_count; /* - number of messages */
}
};
-int main(int argc, char *argv[])
+int main(int argc, char* argv[])
{
xbt_assert(argc > 2, "Usage: %s platform_file deployment_file\n", argv[0]);
p Testing this_actor->wait_any()
! output sort 19
-$ ${bindir:=.}/s4u-async-waitany ${platfdir}/small_platform.xml s4u-async-waitany_d.xml "--log=root.fmt:[%10.6r]%e(%i:%P@%h)%e%m%n"
+$ ${bindir:=.}/s4u-comm-waitany ${platfdir}/small_platform.xml s4u-comm-waitany_d.xml "--log=root.fmt:[%10.6r]%e(%i:%P@%h)%e%m%n"
> [ 0.000000] (1:sender@Tremblay) Send 'Message 0' to 'receiver-0'
> [ 0.000000] (2:receiver@Fafard) Wait for my first message
> [ 0.000000] (3:receiver@Jupiter) Wait for my first message
/* This example shows how to use simgrid::s4u::Activity::wait_until() and
* simgrid::s4u::Activity::wait_for() on a given communication.
*
- * It is very similar to the async-wait example, but the sender initially
+ * It is very similar to the comm-wait example, but the sender initially
* does some waits that are too short before doing an infinite wait.
*/
#include <iostream>
#include <string>
-XBT_LOG_NEW_DEFAULT_CATEGORY(s4u_async_waituntil, "Messages specific for this s4u example");
+XBT_LOG_NEW_DEFAULT_CATEGORY(s4u_comm_waituntil, "Messages specific for this s4u example");
static void sender(int argc, char** argv)
{
/* Start dispatching all messages to receivers, in a round robin fashion */
for (int i = 0; i < messages_count; i++) {
- std::string mboxName = std::string("receiver-") + std::to_string(i % receivers_count);
- simgrid::s4u::Mailbox* mbox = simgrid::s4u::Mailbox::by_name(mboxName);
- std::string msgName = std::string("Message ") + std::to_string(i);
- std::string* payload = new std::string(msgName); // copy the data we send:
+ std::string mboxName = std::string("receiver-") + std::to_string(i % receivers_count);
+ simgrid::s4u::Mailbox* mbox = simgrid::s4u::Mailbox::by_name(mboxName);
+ std::string msgName = std::string("Message ") + std::to_string(i);
+ std::string* payload = new std::string(msgName); // copy the data we send:
// 'msgName' is not a stable storage location
XBT_INFO("Send '%s' to '%s'", msgName.c_str(), mboxName.c_str());
/* Start sending messages to let the workers know that they should stop */
for (int i = 0; i < receivers_count; i++) {
- std::string mboxName = std::string("receiver-") + std::to_string(i % receivers_count);
- simgrid::s4u::Mailbox* mbox = simgrid::s4u::Mailbox::by_name(mboxName);
- std::string* payload = new std::string("finalize"); // Make a copy of the data we will send
+ std::string mboxName = std::string("receiver-") + std::to_string(i % receivers_count);
+ simgrid::s4u::Mailbox* mbox = simgrid::s4u::Mailbox::by_name(mboxName);
+ std::string* payload = new std::string("finalize"); // Make a copy of the data we will send
simgrid::s4u::CommPtr comm = mbox->put_async(payload, 0);
pending_comms.push_back(comm);
p Test1 Sleep_sender > Sleep_receiver
-$ ${bindir:=.}/s4u-async-waituntil ${platfdir}/small_platform_fatpipe.xml s4u-async-waituntil_d.xml "--log=root.fmt:[%10.6r]%e(%i:%P@%h)%e%m%n"
+$ ${bindir:=.}/s4u-comm-waituntil ${platfdir}/small_platform_fatpipe.xml s4u-comm-waituntil_d.xml "--log=root.fmt:[%10.6r]%e(%i:%P@%h)%e%m%n"
> [ 0.000000] (1:sender@Tremblay) Send 'Message 0' to 'receiver-0'
> [ 0.000000] (2:receiver@Ruby) Wait for my first message
> [ 0.000000] (1:sender@Tremblay) Send 'Message 1' to 'receiver-0'