/* This program is free software; you can redistribute it and/or modify it
* under the terms of the license (GNU LGPL) which comes with this package. */
/* This program is free software; you can redistribute it and/or modify it
* under the terms of the license (GNU LGPL) which comes with this package. */
{
xbt_assert(argc == 4, "Expecting 3 parameters from the XML deployment file but got %d", argc);
long messages_count = std::stol(argv[1]); /* - number of tasks */
{
xbt_assert(argc == 4, "Expecting 3 parameters from the XML deployment file but got %d", argc);
long messages_count = std::stol(argv[1]); /* - number of tasks */
/* Start dispatching all messages to receivers, in a round robin fashion */
for (int i = 0; i < messages_count; i++) {
/* Start dispatching all messages to receivers, in a round robin fashion */
for (int i = 0; i < messages_count; i++) {
std::string msgName = std::string("Message ") + std::to_string(i);
std::string* payload = new std::string(msgName); // copy the data we send:
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());
/* Create a communication representing the ongoing communication */
// '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 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);
/* 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);
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);
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);
XBT_INFO("I got a '%s'.", received->c_str());
if (*received == "finalize")
cont = false; // If it's a finalize message, we're done.
delete received;
}
XBT_INFO("I got a '%s'.", received->c_str());
if (*received == "finalize")
cont = false; // If it's a finalize message, we're done.
delete received;
}