#include <algorithm>
#include <string>
#include <map>
#include <vector>
class RelayRunner {
size_t task_comm_size = 1000000;
public:
explicit RelayRunner() = default;
void operator()()
{
try {
} catch (std::invalid_argument& ia) {
throw std::invalid_argument(
std::string(
"Processes of this example must have a numerical name, not ") +
ia.what());
}
else
if (rank == 0) {
XBT_INFO(
"Host \"%u\" send 'Token' to Host \"%s\"", rank, neighbor_mailbox->getCname());
neighbor_mailbox->put(&msg, task_comm_size);
XBT_INFO(
"Host \"%u\" received \"%s\"", rank, res->c_str());
} else {
XBT_INFO(
"Host \"%u\" received \"%s\"", rank, res->c_str());
XBT_INFO(
"Host \"%u\" send 'Token' to Host \"%s\"", rank, neighbor_mailbox->getCname());
neighbor_mailbox->put(res, task_comm_size);
}
}
};
{
xbt_assert(argc > 1,
"Usage: %s platform.xml\n", argv[0]);
e.loadPlatform(argv[1]);
XBT_INFO(
"Number of hosts '%zu'", e.getHostCount());
int id = 0;
std::vector<simgrid::s4u::Host*>
list;
e.getHostList(&list);
for (auto const& host : list) {
id++;
}
e.run();
XBT_INFO(
"Simulation time %g", e.getClock());
return 0;
}