/*************************************************************************************************/
/** @brief Create a simple platform based on Dahu cluster */
-static void load_platform(const sg4::Engine& e)
+static void load_platform()
{
/**
* Inspired on dahu cluster on Grenoble
*/
auto* root = sg4::create_star_zone("dahu");
- std::string prefix = "dahu-", suffix = ".grid5000.fr";
+ std::string prefix = "dahu-";
+ std::string suffix = ".grid5000.fr";
for (int id = 0; id < 32; id++) {
std::string hostname = prefix + std::to_string(id) + suffix;
/* create host */
- sg4::Host* host = root->create_host(hostname, 1)->set_core_count(32)->seal();
+ const sg4::Host* host = root->create_host(hostname, 1)->set_core_count(32)->seal();
/* create UP/DOWN link */
- sg4::Link* l_up = root->create_link(hostname + "_up", BW_REMOTE)->set_latency(LATENCY)->seal();
- sg4::Link* l_down = root->create_link(hostname + "_down", BW_REMOTE)->set_latency(LATENCY)->seal();
+ const sg4::Link* l = root->create_split_duplex_link(hostname, BW_REMOTE)->set_latency(LATENCY)->seal();
/* add link UP/DOWN for communications from the host */
- root->add_route(host->get_netpoint(), nullptr, nullptr, nullptr, std::vector<sg4::Link*>{l_up}, false);
- root->add_route(nullptr, host->get_netpoint(), nullptr, nullptr, std::vector<sg4::Link*>{l_down}, false);
+ root->add_route(host->get_netpoint(), nullptr, nullptr, nullptr, {{l, sg4::LinkInRoute::Direction::UP}}, true);
- sg4::Link* loopback = root->create_link(hostname + "_loopback", BW_LOCAL)->set_latency(LATENCY)->seal();
- root->add_route(host->get_netpoint(), host->get_netpoint(), nullptr, nullptr, std::vector<sg4::Link*>{loopback});
+ const sg4::Link* loopback = root->create_link(hostname + "_loopback", BW_LOCAL)->set_latency(LATENCY)->seal();
+ root->add_route(host->get_netpoint(), host->get_netpoint(), nullptr, nullptr, {sg4::LinkInRoute(loopback)});
}
root->seal();
/*************************************************************************************************/
class Sender {
std::vector<sg4::Host*> hosts_;
+ double crosstraffic_ = 1.0;
public:
- explicit Sender(const std::vector<sg4::Host*>& hosts) : hosts_{hosts} {}
+ explicit Sender(const std::vector<sg4::Host*>& hosts, bool crosstraffic) : hosts_{hosts}
+ {
+ if (crosstraffic)
+ crosstraffic_ = 1.05; // add crosstraffic load if it is enabled
+ }
void operator()() const
{
const std::vector<double> msg_sizes = {64e3, 64e6, 64e9}; // 64KB, 64MB, 64GB
if (host->get_name() == sg4::this_actor::get_host()->get_name()) {
double lat_factor = get_factor_from_map(LOCAL_LAT_FACTOR, size);
double bw_factor = get_factor_from_map(LOCAL_BW_FACTOR, size);
- double est_time = sg4::Engine::get_clock() + size / (BW_LOCAL * bw_factor) + LATENCY * lat_factor;
+ /* Account for crosstraffic on local communications
+ * local communications use only a single link and crosstraffic impact on resource sharing
+ * on remote communications, we don't see this effect since we have split-duplex links */
+ double est_time =
+ sg4::Engine::get_clock() + size / (BW_LOCAL * bw_factor / crosstraffic_) + LATENCY * lat_factor;
msg = "Local communication: size=" + std::to_string(size) + ". Use bw_factor=" + std::to_string(bw_factor) +
" lat_factor=" + std::to_string(lat_factor) + ". Estimated finished time=" + std::to_string(est_time);
/* Create a communication representing the ongoing communication */
auto mbox = sg4::Mailbox::by_name(host->get_name());
auto* payload = new std::string(msg);
- mbox->put(payload, size);
+ mbox->put(payload, static_cast<uint64_t>(size));
}
}
/*************************************************************************************************/
int main(int argc, char* argv[])
{
+ bool crosstraffic = true;
sg4::Engine e(&argc, argv);
/* setting network model to default one */
- e.set_config("network/model:CM02");
+ sg4::Engine::set_config("network/model:CM02");
+
+ /* test with crosstraffic disabled */
+ if (argc == 2 && std::string(argv[1]) == "disable_crosstraffic") {
+ sg4::Engine::set_config("network/crosstraffic:0");
+ crosstraffic = false;
+ }
/* create platform */
- load_platform(e);
+ load_platform();
/* setting network factors callbacks */
simgrid::kernel::resource::NetworkModelIntf* model = e.get_netzone_root()->get_network_model();
model->set_lat_factor_cb(latency_factor_cb);
sg4::Host* host_remote = e.host_by_name("dahu-10.grid5000.fr");
sg4::Actor::create(std::string("receiver-local"), host, Receiver());
sg4::Actor::create(std::string("receiver-remote"), host_remote, Receiver());
- sg4::Actor::create(std::string("sender") + std::string(host->get_name()), host, Sender({host, host_remote}));
+ sg4::Actor::create(std::string("sender") + std::string(host->get_name()), host,
+ Sender({host, host_remote}, crosstraffic));
/* runs the simulation */
e.run();