engine.load_platform(argv[1]);
// setup WiFi bandwidths
- const auto* l = simgrid::s4u::Link::by_name("AP1");
- l->set_host_wifi_rate(simgrid::s4u::Host::by_name("Station 1"), 0);
- l->set_host_wifi_rate(simgrid::s4u::Host::by_name("Station 2"), 0);
+ const auto* l = engine.link_by_name("AP1");
+ l->set_host_wifi_rate(engine.host_by_name("Station 1"), 0);
+ l->set_host_wifi_rate(engine.host_by_name("Station 2"), 0);
// create the two actors for the test
- simgrid::s4u::Actor::create("act0", simgrid::s4u::Host::by_name("Station 1"), sender);
- simgrid::s4u::Actor::create("act1", simgrid::s4u::Host::by_name("Station 2"), receiver);
+ simgrid::s4u::Actor::create("act0", engine.host_by_name("Station 1"), sender);
+ simgrid::s4u::Actor::create("act1", engine.host_by_name("Station 2"), receiver);
engine.run();
simgrid::s4u::Actor::create("receiver", station2, receiver, mailbox);
/* Declare that the stations are not at the same distance from their AP */
- auto ap = simgrid::s4u::Link::by_name("AP1");
+ auto ap = e.link_by_name("AP1");
ap->set_host_wifi_rate(station1, 1); // The host "Station 1" uses the second level of bandwidths on that AP
ap->set_host_wifi_rate(station2, 0); // This is perfectly useless as level 0 is used by default
simgrid::s4u::Link* link_down;
simgrid::s4u::SplitDuplexLink* link;
REQUIRE_NOTHROW(link = zone->create_split_duplex_link("link", "100GBps"));
- REQUIRE(simgrid::s4u::SplitDuplexLink::by_name("link") == link);
- REQUIRE_NOTHROW(link_up = simgrid::s4u::Link::by_name("link_UP"));
- REQUIRE_NOTHROW(link_down = simgrid::s4u::Link::by_name("link_DOWN"));
+ REQUIRE(e.split_duplex_link_by_name("link") == link);
+ REQUIRE_NOTHROW(link_up = e.link_by_name("link_UP"));
+ REQUIRE_NOTHROW(link_down = e.link_by_name("link_DOWN"));
REQUIRE(link_up->get_bandwidth() == 100e9);
REQUIRE(link_down->get_bandwidth() == 100e9);
REQUIRE(link_up == link->get_link_up());
const simgrid::kernel::routing::HostLinkCreationArgs* hostlink,
const simgrid::s4u::Link* backbone)
{
- simgrid::kernel::routing::NetPoint* netpoint = simgrid::s4u::Host::by_name(hostlink->id)->get_netpoint();
+ const auto engine = simgrid::s4u::Engine::get_instance();
+ auto netpoint = engine->host_by_name(hostlink->id)->get_netpoint();
xbt_assert(netpoint, "Host '%s' not found!", hostlink->id.c_str());
- const simgrid::s4u::Link* linkUp = simgrid::s4u::Link::by_name_or_null(hostlink->link_up);
- const simgrid::s4u::Link* linkDown = simgrid::s4u::Link::by_name_or_null(hostlink->link_down);
+ const auto linkUp = engine->link_by_name_or_null(hostlink->link_up);
+ const auto linkDown = engine->link_by_name_or_null(hostlink->link_down);
xbt_assert(linkUp, "Link '%s' not found!", hostlink->link_up.c_str());
xbt_assert(linkDown, "Link '%s' not found!", hostlink->link_down.c_str());
/* 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. */
-#include "surf/surf.hpp"
#include "src/surf/cpu_interface.hpp"
#include "src/surf/network_interface.hpp"
#include "src/surf/surf_interface.hpp"
#include "src/surf/xml/platf_private.hpp"
+#include "surf/surf.hpp"
+#include <simgrid/s4u/Engine.hpp>
#include <vector>
/* Do the actual parsing */
surf_parse();
+ /* Get the Engine singleton once and for all*/
+ const auto engine = simgrid::s4u::Engine::get_instance();
+
/* connect all profiles relative to hosts */
for (auto const& elm : trace_connect_list_host_avail) {
surf_parse_assert(traces_set_list.find(elm.first) != traces_set_list.end(), std::string("<trace_connect kind=\"HOST_AVAIL\">: Trace ")+elm.first+" undefined.");
auto profile = traces_set_list.at(elm.first);
- auto host = simgrid::s4u::Host::by_name_or_null(elm.second);
+ auto host = engine->host_by_name_or_null(elm.second);
surf_parse_assert(host, std::string("<trace_connect kind=\"HOST_AVAIL\">: Host ") + elm.second + " undefined.");
host->set_state_profile(profile);
}
surf_parse_assert(traces_set_list.find(elm.first) != traces_set_list.end(), std::string("<trace_connect kind=\"SPEED\">: Trace ")+elm.first+" undefined.");
auto profile = traces_set_list.at(elm.first);
- auto host = simgrid::s4u::Host::by_name_or_null(elm.second);
+ auto host = engine->host_by_name_or_null(elm.second);
surf_parse_assert(host, std::string("<trace_connect kind=\"SPEED\">: Host ") + elm.second + " undefined.");
host->set_speed_profile(profile);
}
surf_parse_assert(traces_set_list.find(elm.first) != traces_set_list.end(), std::string("<trace_connect kind=\"LINK_AVAIL\">: Trace ")+elm.first+" undefined.");
auto profile = traces_set_list.at(elm.first);
- auto link = simgrid::s4u::Link::by_name_or_null(elm.second);
+ auto link = engine->link_by_name_or_null(elm.second);
surf_parse_assert(link, std::string("<trace_connect kind=\"LINK_AVAIL\">: Link ") + elm.second + " undefined.");
link->set_state_profile(profile);
}
surf_parse_assert(traces_set_list.find(elm.first) != traces_set_list.end(), std::string("<trace_connect kind=\"BANDWIDTH\">: Trace ")+elm.first+" undefined.");
auto profile = traces_set_list.at(elm.first);
- auto link = simgrid::s4u::Link::by_name_or_null(elm.second);
+ auto link = engine->link_by_name_or_null(elm.second);
surf_parse_assert(link, std::string("<trace_connect kind=\"BANDWIDTH\">: Link ") + elm.second + " undefined.");
link->set_bandwidth_profile(profile);
}
surf_parse_assert(traces_set_list.find(elm.first) != traces_set_list.end(), std::string("<trace_connect kind=\"LATENCY\">: Trace ")+elm.first+" undefined.");
auto profile = traces_set_list.at(elm.first);
- auto link = simgrid::s4u::Link::by_name_or_null(elm.second);
+ auto link = engine->link_by_name_or_null(elm.second);
surf_parse_assert(link, std::string("<trace_connect kind=\"LATENCY\">: Link ") + elm.second + " undefined.");
link->set_latency_profile(profile);
}
void STag_surfxml_link___ctn()
{
+ const auto engine = simgrid::s4u::Engine::get_instance();
const simgrid::s4u::Link* link;
simgrid::s4u::LinkInRoute::Direction direction = simgrid::s4u::LinkInRoute::Direction::NONE;
switch (A_surfxml_link___ctn_direction) {
case AU_surfxml_link___ctn_direction:
case A_surfxml_link___ctn_direction_NONE:
- link = simgrid::s4u::Link::by_name(std::string(A_surfxml_link___ctn_id));
+ link = engine->link_by_name(std::string(A_surfxml_link___ctn_id));
break;
case A_surfxml_link___ctn_direction_UP:
- link = simgrid::s4u::SplitDuplexLink::by_name(std::string(A_surfxml_link___ctn_id));
+ link = engine->split_duplex_link_by_name(std::string(A_surfxml_link___ctn_id));
direction = simgrid::s4u::LinkInRoute::Direction::UP;
break;
case A_surfxml_link___ctn_direction_DOWN:
- link = simgrid::s4u::SplitDuplexLink::by_name(std::string(A_surfxml_link___ctn_id));
+ link = engine->split_duplex_link_by_name(std::string(A_surfxml_link___ctn_id));
direction = simgrid::s4u::LinkInRoute::Direction::DOWN;
break;
default:
#endif
e.load_platform(argv[1]);
- simgrid::s4u::Actor::create("receiver", simgrid::s4u::Host::by_name("Jupiter"), receiver, "box");
- simgrid::s4u::Actor::create("sender", simgrid::s4u::Host::by_name("Boivin"), sender, "box", mutex, 1);
- simgrid::s4u::Actor::create("sender", simgrid::s4u::Host::by_name("Fafard"), sender, "box", mutex, 2);
+ simgrid::s4u::Actor::create("receiver", e.host_by_name("Jupiter"), receiver, "box");
+ simgrid::s4u::Actor::create("sender", e.host_by_name("Boivin"), sender, "box", mutex, 1);
+ simgrid::s4u::Actor::create("sender", e.host_by_name("Fafard"), sender, "box", mutex, 2);
e.run();
- XBT_INFO("Simulation time %g", simgrid::s4u::Engine::get_clock());
+ XBT_INFO("Simulation time %g", e.get_clock());
return 0;
}
e.load_platform(argv[2]);
- simgrid::s4u::Actor::create("app", simgrid::s4u::Host::by_name("Fafard"), &app);
+ simgrid::s4u::Actor::create("app", e.host_by_name("Fafard"), &app);
e.run();
}
platform = argv[1];
e.load_platform(platform);
- simgrid::s4u::Host* pm0 = simgrid::s4u::Host::by_name("node-0.1core.org");
+ simgrid::s4u::Host* pm0 = e.host_by_name("node-0.1core.org");
xbt_assert(pm0, "Host 'node-0.1core.org' not found");
simgrid::s4u::Actor::create("master", pm0, master_main);
{
sg4::Engine e(&argc, argv);
/* keep it simple, no network factors nor crosstrafic */
- simgrid::s4u::Engine::set_config("network/model:CM02");
- simgrid::s4u::Engine::set_config("network/weight-S:20537");
- simgrid::s4u::Engine::set_config("network/crosstraffic:0");
+ e.set_config("network/model:CM02");
+ e.set_config("network/weight-S:20537");
+ e.set_config("network/crosstraffic:0");
/* dog-bone platform */
std::unordered_map<std::string, sg4::Host*> hosts;
XBT_INFO("------------------------------------------------------------");
XBT_INFO("Have to compute 1 flop on a 1 flop/s host.");
XBT_INFO("Should be done in exactly one second.");
- start_time = sg4::Engine::get_clock();
+ start_time = e->get_clock();
sg4::Exec::init()->set_flops_amount(1)->set_host(hosts[0])->wait();
- end_time = sg4::Engine::get_clock();
+ end_time = e->get_clock();
XBT_INFO("Actual result: computing 1 flop at 1 flop/s takes %.2f seconds.", end_time - start_time);
XBT_INFO("\n");
XBT_INFO("------------------------------------------------------------");
XBT_INFO("Have to compute 2 x 1 flop on a 1 flop/s host.");
XBT_INFO("Should be done in exactly 2 seconds because of sharing.");
- start_time = sg4::Engine::get_clock();
+ start_time = e->get_clock();
sg4::ExecPtr e1 = sg4::Exec::init()->set_flops_amount(1)->set_host(hosts[0])->start();
sg4::ExecPtr e2 = sg4::Exec::init()->set_flops_amount(1)->set_host(hosts[0])->start();
e1->wait();
e2->wait();
- end_time = sg4::Engine::get_clock();
+ end_time = e->get_clock();
XBT_INFO("Actual result: computing 2x1 flop at 1 flop/s takes %.2f seconds.", end_time - start_time);
XBT_INFO("\n");
XBT_INFO("------------------------------------------------------------");
XBT_INFO("Have to compute 2 flops across two hosts running at 1 flop/s.");
XBT_INFO("Should be done in exactly one second.");
- start_time = sg4::Engine::get_clock();
+ start_time = e->get_clock();
sg4::Exec::init()
->set_flops_amounts(std::vector<double>({1.0, 1.0}))
->set_hosts(std::vector<sg4::Host*>({hosts[0], hosts[1]}))
->wait();
- end_time = sg4::Engine::get_clock();
+ end_time = e->get_clock();
XBT_INFO("Actual result: computing 2 flops on 2 hosts at 1 flop/s takes %.2f seconds.", end_time - start_time);
XBT_INFO("\n");
XBT_INFO("------------------------------------------------------------");
XBT_INFO("Have to compute 2 flops across two hosts, one running at 1 flop/s and one at 2 flop/s.");
XBT_INFO("Should be done in exactly one second.");
- start_time = sg4::Engine::get_clock();
+ start_time = e->get_clock();
sg4::Exec::init()
->set_flops_amounts(std::vector<double>({1.0, 1.0}))
->set_hosts(std::vector<sg4::Host*>({hosts[0], hosts[5]}))
->wait();
- end_time = sg4::Engine::get_clock();
+ end_time = e->get_clock();
XBT_INFO("Actual result: computing 2 flops on 2 heterogeneous hosts takes %.2f seconds.", end_time - start_time);
XBT_INFO("\n");
XBT_INFO("------------------------------------------------------------");
XBT_INFO("Have to send 1B from one host to another at 1Bps with a latency of 500ms.");
XBT_INFO("Should be done in 1.5 seconds (500ms latency + 1s transfert).");
- start_time = sg4::Engine::get_clock();
+ start_time = e->get_clock();
sg4::Comm::sendto_async(hosts[0], hosts[4], 1.0)->wait();
- end_time = sg4::Engine::get_clock();
+ end_time = e->get_clock();
XBT_INFO("Actual result: sending 1 byte on a shared link at 1Bps + 500ms takes %.2f seconds.", end_time - start_time);
XBT_INFO("\n");
XBT_INFO("------------------------------------------------------------");
XBT_INFO("Have to send 1B from one host to another at 1Bps with a latency of 500ms.");
XBT_INFO("Should be done in 1.5 seconds (500ms latency + 1s transfert).");
- start_time = sg4::Engine::get_clock();
+ start_time = e->get_clock();
sg4::Comm::sendto_async(hosts[0], hosts[5], 1.0)->wait();
- end_time = sg4::Engine::get_clock();
+ end_time = e->get_clock();
XBT_INFO("Actual result: sending 1 byte on a fatpipe link at 1Bps + 500ms takes %.2f seconds.",
end_time - start_time);
XBT_INFO("\n");
XBT_INFO("------------------------------------------------------------");
XBT_INFO("Have to send 1B from one host to another at 1Bps with a latency of 2 x 500ms + 1s.");
XBT_INFO("Should be done in 3 seconds (2 x 500ms + 1s latency + 1s transfert).");
- start_time = sg4::Engine::get_clock();
+ start_time = e->get_clock();
sg4::Comm::sendto_async(hosts[0], hosts[1], 1.0)->wait();
- end_time = sg4::Engine::get_clock();
+ end_time = e->get_clock();
XBT_INFO("Actual result: sending 1 byte on a 3-link route at 1Bps + 2,500ms takes %.2f seconds.",
end_time - start_time);
XBT_INFO("\n");
XBT_INFO("Have to send 1B from one host to another on a link at 2Bps with a latency of 2 x 1024^2s.");
XBT_INFO("This latency is half the default TCP window size (4MiB). This limits the bandwidth to 1B");
XBT_INFO("Should be done in 2 x 1024^2s + 1 seconds (large latency + 1s transfert).");
- start_time = sg4::Engine::get_clock();
+ start_time = e->get_clock();
sg4::Comm::sendto_async(hosts[0], hosts[6], 1.0)->wait();
- end_time = sg4::Engine::get_clock();
+ end_time = e->get_clock();
XBT_INFO("Actual result: sending 1 byte on a large latency link takes %.2f seconds.", end_time - start_time);
XBT_INFO("\n");
XBT_INFO("------------------------------------------------------------");
XBT_INFO("Have to send 2 x 1B from one host to another at 1Bps with a latency of 500ms.");
XBT_INFO("Should be done in 2.5 seconds (500ms latency + 2s transfert).");
- start_time = sg4::Engine::get_clock();
+ start_time = e->get_clock();
sg4::CommPtr c1 = sg4::Comm::sendto_async(hosts[0], hosts[4], 1.0);
sg4::CommPtr c2 = sg4::Comm::sendto_async(hosts[0], hosts[4], 1.0);
c1->wait();
c2->wait();
- end_time = sg4::Engine::get_clock();
+ end_time = e->get_clock();
XBT_INFO("Actual result: sending 2x1 bytes on a shared link at 1Bps + 500ms takes %.2f seconds.",
end_time - start_time);
XBT_INFO("\n");
XBT_INFO("------------------------------------------------------------");
XBT_INFO("Have to send 2 x 1B from one host to another at 1Bps with a latency of 500ms.");
XBT_INFO("Should be done in 1.5 seconds (500ms latency + 1s transfert).");
- start_time = sg4::Engine::get_clock();
+ start_time = e->get_clock();
c1 = sg4::Comm::sendto_async(hosts[0], hosts[5], 1.0);
c2 = sg4::Comm::sendto_async(hosts[0], hosts[5], 1.0);
c1->wait();
c2->wait();
- end_time = sg4::Engine::get_clock();
+ end_time = e->get_clock();
XBT_INFO("Actual result: sending 2x1 bytes on a fatpipe link at 1Bps + 500ms takes %.2f seconds.",
end_time - start_time);
XBT_INFO("\n");
XBT_INFO("------------------------------------------------------------");
XBT_INFO("Have to send 2 x 1B from one host to another at 1Bps with a latency of 2 x 500ms + 1s.");
XBT_INFO("Should be done in 4 seconds (2 x 500ms + 1s latency + 2s transfert).");
- start_time = sg4::Engine::get_clock();
+ start_time = e->get_clock();
c1 = sg4::Comm::sendto_async(hosts[0], hosts[1], 1.0);
c2 = sg4::Comm::sendto_async(hosts[0], hosts[1], 1.0);
c1->wait();
c2->wait();
- end_time = sg4::Engine::get_clock();
+ end_time = e->get_clock();
XBT_INFO("Actual result: sending 2x1 bytes on a 3-link route at 1Bps + 2,500ms takes %.2f seconds.",
end_time - start_time);
XBT_INFO("\n");
XBT_INFO("------------------------------------------------------------");
XBT_INFO("Have to send 1B between two hosts in each direction at 1Bps with a latency of 500ms.");
XBT_INFO("Should be done in 2.5 seconds (500ms latency + 2s transfert).");
- start_time = sg4::Engine::get_clock();
+ start_time = e->get_clock();
c1 = sg4::Comm::sendto_async(hosts[0], hosts[4], 1.0);
c2 = sg4::Comm::sendto_async(hosts[4], hosts[0], 1.0);
c1->wait();
c2->wait();
- end_time = sg4::Engine::get_clock();
+ end_time = e->get_clock();
XBT_INFO("Actual result: sending 1 byte in both directions on a shared link at 1Bps + 500ms takes %.2f seconds.",
end_time - start_time);
XBT_INFO("\n");
XBT_INFO("------------------------------------------------------------");
XBT_INFO("Have to send 1B between two hosts in each direction at 1Bps with a latency of 500ms.");
XBT_INFO("Should be done in 1.5 seconds (500ms latency + 1s transfert).");
- start_time = sg4::Engine::get_clock();
+ start_time = e->get_clock();
c1 = sg4::Comm::sendto_async(hosts[0], hosts[5], 1.0);
c2 = sg4::Comm::sendto_async(hosts[5], hosts[0], 1.0);
c1->wait();
c2->wait();
- end_time = sg4::Engine::get_clock();
+ end_time = e->get_clock();
XBT_INFO("Actual result: sending 1 byte in both directions on a fatpipe link at 1Bps + 500ms takes %.2f seconds.",
end_time - start_time);
XBT_INFO("\n");
XBT_INFO("------------------------------------------------------------");
XBT_INFO("Have to send 1B between two hosts in each direction at 1Bps with a latency of 2 x 500ms + 1s.");
XBT_INFO("Should be done in 4 seconds (2 x 500ms + 1s latency + 2s transfert).");
- start_time = sg4::Engine::get_clock();
+ start_time = e->get_clock();
c1 = sg4::Comm::sendto_async(hosts[0], hosts[1], 1.0);
c2 = sg4::Comm::sendto_async(hosts[1], hosts[0], 1.0);
c1->wait();
c2->wait();
- end_time = sg4::Engine::get_clock();
+ end_time = e->get_clock();
XBT_INFO("Actual result: sending 1 byte in both directions on a 3-link route at 1Bps + 2,500ms takes %.2f seconds.",
end_time - start_time);
XBT_INFO("\n");
XBT_INFO("------------------------------------------------------------");
XBT_INFO("'cpu0' sends 1B to 'cpu1' and 'cpu2' sends 1B to 'cpu3'. The only shared link is the fatpipe switch.");
XBT_INFO("Should be done in 3 seconds (2 x 500ms + 1s latency + 1s transfert).");
- start_time = sg4::Engine::get_clock();
+ start_time = e->get_clock();
sg4::Exec::init()
->set_bytes_amounts(std::vector<double>({0.0, 1.0, 0.0, 0.0,
0.0, 0.0, 0.0, 0.0,
0.0, 0.0, 0.0, 0.0 }))
->set_hosts(std::vector<sg4::Host*>({hosts[0], hosts[1], hosts[2], hosts[3]}))
->wait();
- end_time = sg4::Engine::get_clock();
+ end_time = e->get_clock();
XBT_INFO("Actual result: sending 2 x 1 byte in a parallel communication without interference takes %.2f seconds.",
end_time - start_time);
XBT_INFO("\n");
XBT_INFO(" - For 2 seconds, two lows share a link to transfer 1 x 1B. 'cpu2' received is payload");
XBT_INFO(" - For 1 second, one flow has the full bandwidth to transfer 1B. 'cpu3' received is payload");
- start_time = sg4::Engine::get_clock();
+ start_time = e->get_clock();
sg4::Exec::init()
->set_bytes_amounts(std::vector<double>({0.0, 1.0, 2.0, 3.0,
0.0, 0.0, 0.0, 0.0,
0.0, 0.0, 0.0, 0.0 }))
->set_hosts(std::vector<sg4::Host*>({hosts[0], hosts[1], hosts[2], hosts[3]}))
->wait();
- end_time = sg4::Engine::get_clock();
+ end_time = e->get_clock();
XBT_INFO("Actual result: scattering an increasing number of bytes to 3 hosts takes %.2f seconds.",
end_time - start_time);
XBT_INFO("\n");
XBT_INFO("Each SHARED link is traversed by 6 flows (3 in and 3 out). ");
XBT_INFO("Each 1B transfer thus takes 6 seconds on a 1Bps link");
- start_time = sg4::Engine::get_clock();
+ start_time = e->get_clock();
sg4::Exec::init()
->set_bytes_amounts(std::vector<double>({0.0, 1.0, 1.0, 1.0,
1.0, 0.0, 1.0, 1.0,
1.0, 1.0, 1.0, 0.0 }))
->set_hosts(std::vector<sg4::Host*>({hosts[0], hosts[1], hosts[2], hosts[3]}))
->wait();
- end_time = sg4::Engine::get_clock();
+ end_time = e->get_clock();
XBT_INFO("Actual result: 1-byte all-too-all in a parallel communication takes %.2f seconds.", end_time - start_time);
XBT_INFO("\n");
XBT_INFO("The small communication has a negligible impact on the large one.");
XBT_INFO("This corresponds to paying latency once and having the full bandwidth for the large communication.");
- start_time = sg4::Engine::get_clock();
+ start_time = e->get_clock();
c1 = sg4::Comm::sendto_async(hosts[0], hosts[7], 1e8);
c2 = sg4::Comm::sendto_async(hosts[0], hosts[7], 1.0);
c1->wait();
c2->wait();
- end_time = sg4::Engine::get_clock();
+ end_time = e->get_clock();
XBT_INFO("Actual result: 1 small and 1 large concurrent communications take %.4f seconds.", end_time - start_time);
XBT_INFO("\n");
XBT_INFO("The two activities should overlap smoothly as they use different resources.");
XBT_INFO("The completion time is thus the maximum of the time to complete the two activities.");
- start_time = sg4::Engine::get_clock();
+ start_time = e->get_clock();
c1 = sg4::Comm::sendto_async(hosts[0], hosts[4], 1.0);
e1 = sg4::Exec::init()->set_flops_amount(2.0)->set_host(hosts[4])->start();
e1->wait();
c1->wait();
- end_time = sg4::Engine::get_clock();
+ end_time = e->get_clock();
XBT_INFO("Actual result: Sending 1B while computing 2 flops takes %.4f seconds.", end_time - start_time);
XBT_INFO("\n");
}
{
sg4::Engine engine(&argc, argv);
engine.load_platform(argv[1]);
- sg4::Actor::create("dispatcher", sg4::Host::by_name("cpu0"), main_dispatcher);
+ sg4::Actor::create("dispatcher", engine.host_by_name("cpu0"), main_dispatcher);
engine.run();
return 0;
}
run_ping_test("Station 1", "Station 2", 1000);
}
+
int main(int argc, char** argv)
{
simgrid::s4u::Engine engine(&argc, argv);
engine.load_platform(argv[1]);
- simgrid::s4u::Actor::create("dispatcher", simgrid::s4u::Host::by_name("node1"), main_dispatcher);
+ simgrid::s4u::Actor::create("dispatcher", engine.host_by_name("node1"), main_dispatcher);
engine.run();
return 0;
{
simgrid::s4u::Engine engine(&argc, argv);
engine.load_platform(argv[1]);
- simgrid::s4u::Actor::create("dispatcher", simgrid::s4u::Host::by_name("node1"), main_dispatcher);
+ simgrid::s4u::Actor::create("dispatcher", engine.host_by_name("node1"), main_dispatcher);
engine.run();
return 0;
simgrid::s4u::Engine e(&argc, argv);
e.load_platform(argv[1]);
- simgrid::s4u::Actor::create("Autostart", simgrid::s4u::Host::by_name("Tremblay"), autostart);
+ simgrid::s4u::Actor::create("Autostart", e.host_by_name("Tremblay"), autostart);
e.run();
- XBT_INFO("Simulation time %g", simgrid::s4u::Engine::get_clock());
+ XBT_INFO("Simulation time %g", e.get_clock());
return 0;
}
simgrid::s4u::Engine engine(&argc, argv);
engine.load_platform(argv[1]);
- simgrid::s4u::Host* host = simgrid::s4u::Host::by_name("Tremblay");
+ simgrid::s4u::Host* host = engine.host_by_name("Tremblay");
simgrid::s4u::Actor::create("Suspender", host, Suspender());
receiver = simgrid::s4u::Actor::create("Receiver", host, Receiver());
simgrid::s4u::Engine e(&argc, argv);
e.load_platform(argv[1]);
- simgrid::s4u::Actor::create("master", simgrid::s4u::Host::by_name("Tremblay"), master);
- simgrid::s4u::Actor::create("worker", simgrid::s4u::Host::by_name("Tremblay"), worker);
+ simgrid::s4u::Actor::create("master", e.host_by_name("Tremblay"), master);
+ simgrid::s4u::Actor::create("worker", e.host_by_name("Tremblay"), worker);
e.run();
- XBT_INFO("Simulation time %g", simgrid::s4u::Engine::get_clock());
+ XBT_INFO("Simulation time %g", e.get_clock());
return 0;
}
/* creation of the environment */
e.load_platform(argv[1]);
- std::vector<simgrid::s4u::Link*> links = simgrid::s4u::Engine::get_instance()->get_all_links();
+ std::vector<simgrid::s4u::Link*> links = e.get_all_links();
XBT_INFO("Link count: %zu", links.size());
std::sort(links.begin(), links.end(), [](const simgrid::s4u::Link* a, const simgrid::s4u::Link* b) {
if (strcmp(argv[2], "FULL_LINK") == 0)
test_full_link(hosts);
if (strcmp(argv[2], "PROP") == 0)
- XBT_INFO("SG_TEST_mem: %s", sg4::Host::by_name("host1")->get_property("SG_TEST_mem"));
+ XBT_INFO("SG_TEST_mem: %s", e.host_by_name("host1")->get_property("SG_TEST_mem"));
}
return 0;
/* load the platform file */
e.load_platform(argv[1]);
- simgrid::s4u::Actor::create("master_", simgrid::s4u::Host::by_name("Fafard"), master_main);
+ simgrid::s4u::Actor::create("master_", e.host_by_name("Fafard"), master_main);
e.run();
- XBT_INFO("Bye (simulation time %g)", simgrid::s4u::Engine::get_clock());
+ XBT_INFO("Bye (simulation time %g)", e.get_clock());
return 0;
}
e.load_platform(argv[1]);
- simgrid::s4u::Actor::create("master_", simgrid::s4u::Host::by_name("Fafard"), master_main);
+ simgrid::s4u::Actor::create("master_", e.host_by_name("Fafard"), master_main);
e.run();
- XBT_INFO("Bye (simulation time %g)", simgrid::s4u::Engine::get_clock());
+ XBT_INFO("Bye (simulation time %g)", e.get_clock());
return 0;
}
e.load_platform(argv[1]);
- simgrid::s4u::Actor::create("send", simgrid::s4u::Host::by_name("Tremblay"), sender_fun);
- simgrid::s4u::Actor::create("receive", simgrid::s4u::Host::by_name("Tremblay"), receiver_fun);
+ simgrid::s4u::Actor::create("send", e.host_by_name("Tremblay"), sender_fun);
+ simgrid::s4u::Actor::create("receive", e.host_by_name("Tremblay"), receiver_fun);
e.run();
return 0;
simgrid::s4u::Actor::create("recver", hosts[1], receiver, argRecv);
e.run();
- XBT_INFO("Simulation time %g", simgrid::s4u::Engine::get_clock());
+ XBT_INFO("Simulation time %g", e.get_clock());
return 0;
}
e.load_platform(argv[1]);
for (int i = 0; i < 5; i++)
- sg4::Actor::create("host", sg4::Host::by_name("bob"), host);
+ sg4::Actor::create("host", e.host_by_name("bob"), host);
e.run();
- XBT_INFO("Simulation time %g", sg4::Engine::get_clock());
+ XBT_INFO("Simulation time %g", e.get_clock());
return 0;
}
->seal();
zone->seal();
- sg4::Actor::create("carol", simgrid::s4u::Host::by_name("carol"), worker);
- sg4::Actor::create("erin", simgrid::s4u::Host::by_name("erin"), failed_worker)->set_auto_restart(true);
+ sg4::Actor::create("carol", e.host_by_name("carol"), worker);
+ sg4::Actor::create("erin", e.host_by_name("erin"), failed_worker)->set_auto_restart(true);
e.run();
- XBT_INFO("Simulation time %g", simgrid::s4u::Engine::get_clock());
+ XBT_INFO("Simulation time %g", e.get_clock());
return 0;
}
e.load_platform(argv[1]);
- simgrid::s4u::Actor::create("test_launcher", simgrid::s4u::Host::by_name("Tremblay"), test_launcher,
- std::stoi(argv[2]));
+ simgrid::s4u::Actor::create("test_launcher", e.host_by_name("Tremblay"), test_launcher, std::stoi(argv[2]));
e.run();
- XBT_INFO("Simulation time %g", simgrid::s4u::Engine::get_clock());
+ XBT_INFO("Simulation time %g", e.get_clock());
return 0;
}
e.load_platform(argv[1]);
- simgrid::s4u::Actor::create("master", simgrid::s4u::Host::by_name("Tremblay"), master);
- simgrid::s4u::Actor::create("worker", simgrid::s4u::Host::by_name("Jupiter"), worker);
+ simgrid::s4u::Actor::create("master", e.host_by_name("Tremblay"), master);
+ simgrid::s4u::Actor::create("worker", e.host_by_name("Jupiter"), worker);
e.run();
- XBT_INFO("Simulation time %g", simgrid::s4u::Engine::get_clock());
+ XBT_INFO("Simulation time %g", e.get_clock());
return 0;
}
e.load_platform(argv[1]);
- simgrid::s4u::Actor::create("master", simgrid::s4u::Host::by_name("Tremblay"), master);
- simgrid::s4u::Actor::create("worker", simgrid::s4u::Host::by_name("Jupiter"), worker);
+ simgrid::s4u::Actor::create("master", e.host_by_name("Tremblay"), master);
+ simgrid::s4u::Actor::create("worker", e.host_by_name("Jupiter"), worker);
e.run();
- XBT_INFO("Simulation time %g", simgrid::s4u::Engine::get_clock());
+ XBT_INFO("Simulation time %g", e.get_clock());
return 0;
}
simgrid::s4u::Engine e(&argc, argv);
e.load_platform(argv[1]);
- simgrid::s4u::Actor::create("test", simgrid::s4u::Host::by_name("Tremblay"), server);
+ simgrid::s4u::Actor::create("test", e.host_by_name("Tremblay"), server);
e.run();
simgrid::s4u::Actor::kill_all();
- simgrid::s4u::Actor::create("sendpid", simgrid::s4u::Host::by_name("Tremblay"), sendpid);
- simgrid::s4u::Actor::create("sendpid", simgrid::s4u::Host::by_name("Tremblay"), sendpid);
- simgrid::s4u::Actor::create("sendpid", simgrid::s4u::Host::by_name("Tremblay"), sendpid);
- simgrid::s4u::Actor::create("killall", simgrid::s4u::Host::by_name("Tremblay"), killall);
+ simgrid::s4u::Actor::create("sendpid", e.host_by_name("Tremblay"), sendpid);
+ simgrid::s4u::Actor::create("sendpid", e.host_by_name("Tremblay"), sendpid);
+ simgrid::s4u::Actor::create("sendpid", e.host_by_name("Tremblay"), sendpid);
+ simgrid::s4u::Actor::create("killall", e.host_by_name("Tremblay"), killall);
e.run();
xbt_assert(argc == 2, "Usage: %s platform_file\n", argv[0]);
e.load_platform(argv[1]);
- simgrid::s4u::Actor::create("server", simgrid::s4u::Host::by_name("alice"), server);
- simgrid::s4u::Actor::create("client", simgrid::s4u::Host::by_name("bob"), client);
+ simgrid::s4u::Actor::create("server", e.host_by_name("alice"), server);
+ simgrid::s4u::Actor::create("client", e.host_by_name("bob"), client);
e.run();
- XBT_INFO("Simulated time: %g", simgrid::s4u::Engine::get_clock());
+ XBT_INFO("Simulated time: %g", e.get_clock());
return 0;
}
int main(int argc, char* argv[])
{
simgrid::s4u::Engine e(&argc, argv);
- simgrid::s4u::Engine::set_config("network/model:CM02"); // Much less realistic, but easier to compute manually
+ e.set_config("network/model:CM02"); // Much less realistic, but easier to compute manually
sg_vm_live_migration_plugin_init();
sg_host_energy_plugin_init();
xbt_assert(argc == 2, "Usage: %s platform.xml\n", argv[0]);
e.load_platform(argv[1]);
- auto* pm = simgrid::s4u::Host::by_name("host1");
+ auto* pm = e.host_by_name("host1");
auto* vm = new simgrid::s4u::VirtualMachine("VM0", pm, 1 /*nCores*/);
vm->set_ramsize(1250000000)->start();
simgrid::s4u::Actor::create("executor", vm, task_executor);
{
simgrid::s4u::Engine e(&argc, argv);
e.load_platform(argv[1]);
- simgrid::s4u::Actor::create("worker", simgrid::s4u::Host::by_name("Tremblay"), worker);
+ simgrid::s4u::Actor::create("worker", e.host_by_name("Tremblay"), worker);
e.run();
return 0;
}
{
simgrid::s4u::Engine e(&argc, argv);
e.load_platform(argv[1]);
- simgrid::s4u::Actor::create("worker", simgrid::s4u::Host::by_name("Tremblay"), worker);
+ simgrid::s4u::Actor::create("worker", e.host_by_name("Tremblay"), worker);
e.run();
return 0;
}
simgrid::s4u::Engine e(&argc, argv);
e.load_platform(argv[1]);
- simgrid::s4u::Actor::create("worker", simgrid::s4u::Host::by_name("Tremblay"), worker);
+ simgrid::s4u::Actor::create("worker", e.host_by_name("Tremblay"), worker);
e.run();