static void sender(std::vector<std::string> args)
{
xbt_assert(args.size() == 2, "The master function expects 2 arguments.");
- int flow_amount = std::stoi(args.at(0));
- double comm_size = std::stod(args.at(1));
- XBT_INFO("Send %.0f bytes, in %d flows", comm_size, flow_amount);
+ int flow_amount = std::stoi(args.at(0));
+ long comm_size = std::stol(args.at(1));
+ XBT_INFO("Send %ld bytes, in %d flows", comm_size, flow_amount);
simgrid::s4u::Mailbox* mailbox = simgrid::s4u::Mailbox::by_name(std::string("message"));
if (flow_amount == 1) {
/* - Send the task to the @ref worker */
- char* payload = bprintf("%f", comm_size);
+ char* payload = bprintf("%ld", comm_size);
mailbox->put(payload, comm_size);
} else {
// Start all comms in parallel, and wait for all completions in one shot
void* res = mailbox->get();
xbt_free(res);
} else {
- void** data= new void*[flow_amount];
+ auto* data = new void*[flow_amount];
// Start all comms in parallel, and wait for their completion in one shot
std::vector<simgrid::s4u::CommPtr> comms;
std::vector<std::string> argSender;
std::vector<std::string> argReceiver;
if (argc > 2) {
- argSender.push_back(argv[2]); // Take the amount of flows from the command line
- argReceiver.push_back(argv[2]);
+ argSender.emplace_back(argv[2]); // Take the amount of flows from the command line
+ argReceiver.emplace_back(argv[2]);
} else {
- argSender.push_back("1"); // Default value
- argReceiver.push_back("1");
+ argSender.emplace_back("1"); // Default value
+ argReceiver.emplace_back("1");
}
if (argc > 3) {
std::string size = std::to_string(simgrid::xbt::random::uniform_int(min_size, max_size));
argSender.push_back(size);
} else { // Not "random" ? Then it should be the size to use
- argSender.push_back(argv[3]); // Take the datasize from the command line
+ argSender.emplace_back(argv[3]); // Take the datasize from the command line
}
} else { // No parameter at all? Then use the default value
- argSender.push_back("25000");
+ argSender.emplace_back("25000");
}
simgrid::s4u::Actor::create("sender", simgrid::s4u::Host::by_name("MyHost1"), sender, argSender);
simgrid::s4u::Actor::create("receiver", simgrid::s4u::Host::by_name("MyHost2"), receiver, argReceiver);