/* create CPUs */
for (int i = 0; i < num_cpus; i++) {
std::string cpu_name = hostname + "-cpu" + std::to_string(i);
- const sg4::Host* host = host_zone->create_host(cpu_name, speed)->seal();
+ const sg4::Host* host = host_zone->create_host(cpu_name, speed);
/* the first CPU is the gateway */
if (i == 0)
gateway = host->get_netpoint();
/* create split-duplex link */
- sg4::SplitDuplexLink* link = host_zone->create_split_duplex_link("link-" + cpu_name, link_bw);
- link->set_latency(link_lat)->seal();
+ auto* link = host_zone->create_split_duplex_link("link-" + cpu_name, link_bw)->set_latency(link_lat);
/* connecting CPU to outer world */
- host_zone->add_route(host->get_netpoint(), nullptr, nullptr, nullptr, {{link, sg4::LinkInRoute::Direction::UP}},
- true);
+ host_zone->add_route(host, nullptr, {{link, sg4::LinkInRoute::Direction::UP}}, true);
}
/* seal newly created netzone */
host_zone->seal();
for (int id = 0; id < 32; id++) {
std::string hostname = prefix + std::to_string(id) + suffix;
/* create host */
- const 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);
/* create UP/DOWN link */
- const sg4::Link* l = root->create_split_duplex_link(hostname, BW_REMOTE)->set_latency(LATENCY)->seal();
+ const sg4::Link* l = root->create_split_duplex_link(hostname, BW_REMOTE)->set_latency(LATENCY);
/* add link UP/DOWN for communications from the host */
- root->add_route(host->get_netpoint(), nullptr, nullptr, nullptr, {{l, sg4::LinkInRoute::Direction::UP}}, true);
+ root->add_route(host, nullptr, {{l, sg4::LinkInRoute::Direction::UP}}, true);
- sg4::Link* loopback = root->create_link(hostname + "_loopback", BW_LOCAL)->set_latency(LATENCY)->seal();
+ sg4::Link* loopback = root->create_link(hostname + "_loopback", BW_LOCAL)->set_latency(LATENCY);
root->add_route(host, host, {loopback});
}
auto* jbod_raid0 =
simgrid::plugin::Jbod::create_jbod(zone, "jbod_raid0", 1e9, 4, simgrid::plugin::Jbod::RAID::RAID0, 1e7, 5e6);
- zone->add_route(host->get_netpoint(), jbod_raid0->get_netpoint(), nullptr, nullptr, {sg4::LinkInRoute(link)});
+ zone->add_route(host, jbod_raid0, {link});
auto* jbod_raid1 =
simgrid::plugin::Jbod::create_jbod(zone, "jbod_raid1", 1e9, 4, simgrid::plugin::Jbod::RAID::RAID1, 1e7, 5e6);
- zone->add_route(host->get_netpoint(), jbod_raid1->get_netpoint(), nullptr, nullptr, {sg4::LinkInRoute(link)});
+ zone->add_route(host, jbod_raid1, {link});
auto* jbod_raid4 =
simgrid::plugin::Jbod::create_jbod(zone, "jbod_raid4", 1e9, 4, simgrid::plugin::Jbod::RAID::RAID4, 1e7, 5e6);
- zone->add_route(host->get_netpoint(), jbod_raid4->get_netpoint(), nullptr, nullptr, {sg4::LinkInRoute(link)});
+ zone->add_route(host, jbod_raid4, {link});
auto* jbod_raid5 =
simgrid::plugin::Jbod::create_jbod(zone, "jbod_raid5", 1e9, 4, simgrid::plugin::Jbod::RAID::RAID5, 1e7, 5e6);
- zone->add_route(host->get_netpoint(), jbod_raid5->get_netpoint(), nullptr, nullptr, {sg4::LinkInRoute(link)});
+ zone->add_route(host, jbod_raid5, {link});
auto* jbod_raid6 =
simgrid::plugin::Jbod::create_jbod(zone, "jbod_raid6", 1e9, 4, simgrid::plugin::Jbod::RAID::RAID6, 1e7, 5e6);
- zone->add_route(host->get_netpoint(), jbod_raid6->get_netpoint(), nullptr, nullptr, {sg4::LinkInRoute(link)});
+ zone->add_route(host, jbod_raid6, {link});
zone->seal();
std::string linkname = "cluster_link_" + std::to_string(i);
const auto* link = cluster->create_split_duplex_link(linkname, "1Gbps");
- cluster->add_route(host->get_netpoint(), nullptr, nullptr, nullptr, {{link, sg4::LinkInRoute::Direction::UP}},
- true);
+ cluster->add_route(host, nullptr, {{link, sg4::LinkInRoute::Direction::UP}}, true);
}
-
- auto* router = cluster->create_router("cluster_router");
- std::vector<sg4::LinkInRoute> links; // empty
- cluster->add_route(router, nullptr, nullptr, nullptr, links);
cluster->seal();
simgrid::plugin::ProducerConsumerPtr<int> pc = simgrid::plugin::ProducerConsumer<int>::create(2);
const sg4::Link* link = cluster->create_split_duplex_link(hostname, "125MBps")->set_latency("24us");
/* add link and backbone for communications from the host */
- cluster->add_route(host->get_netpoint(), nullptr, nullptr, nullptr,
- {{link, sg4::LinkInRoute::Direction::UP}, backbone}, true);
+ cluster->add_route(host, nullptr, {{link, sg4::LinkInRoute::Direction::UP}, backbone}, true);
}
/* create gateway */
sg4::LinkInRoute link_down{l_down};
/* add link UP and backbone for communications from the host */
- cluster->add_route(host->get_netpoint(), nullptr, nullptr, nullptr, {link_up, backbone}, false);
+ cluster->add_route(host, nullptr, {link_up, backbone}, false);
/* add backbone and link DOWN for communications to the host */
- cluster->add_route(nullptr, host->get_netpoint(), nullptr, nullptr, {backbone, link_down}, false);
+ cluster->add_route(nullptr, host, {backbone, link_down}, false);
}
/* create gateway*/
* @param dst Destination netzone
* @param link_list List of links
*/
- void add_route(NetZone* src, NetZone* dst, const std::vector<const Link*>& links);
+ void add_route(const NetZone* src, const NetZone* dst, const std::vector<const Link*>& links);
/**
* @brief Add a route between 2 netzones, and same in other direction
* @param link_list List of links and their direction used in this communication
* @param symmetrical Bi-directional communication
*/
- void add_route(NetZone* src, NetZone* dst, const std::vector<LinkInRoute>& link_list, bool symmetrical = true);
+ void add_route(const NetZone* src, const NetZone* dst, const std::vector<LinkInRoute>& link_list, bool symmetrical = true);
/**
* @brief Add a route between 2 netpoints
* @param link_list List of links and their direction used in this communication
* @param symmetrical Bi-directional communication
*/
+ //XBT_ATTRIB_DEPRECATED_v339("Please call add_route either from Host to Host or NetZone to NetZone")
void add_route(kernel::routing::NetPoint* src, kernel::routing::NetPoint* dst, kernel::routing::NetPoint* gw_src,
kernel::routing::NetPoint* gw_dst, const std::vector<LinkInRoute>& link_list, bool symmetrical = true);
/**
* @param gw_dst Netpoint of the gateway in the destination netzone
* @param link_list List of links
*/
- void add_route(kernel::routing::NetPoint* src, kernel::routing::NetPoint* dst, kernel::routing::NetPoint* gw_src,
+ //XBT_ATTRIB_DEPRECATED_v339("Please call add_route either from Host to Host or NetZone to NetZone")
+ void add_route(kernel::routing::NetPoint* src, kernel::routing::NetPoint* dst, kernel::routing::NetPoint* gw_src,
kernel::routing::NetPoint* gw_dst, const std::vector<const Link*>& links);
/**
for (int i = 0; i < 10; i++) {
std::string cpu_name = "CPU" + std::to_string(i);
const simgrid::s4u::Host* cpu = zone->create_host(cpu_name, 1e9)->seal();
- REQUIRE_NOTHROW(zone->add_route(cpu->get_netpoint(), nic->get_netpoint(), nullptr, nullptr,
- {simgrid::s4u::LinkInRoute(link)}, true));
+ REQUIRE_NOTHROW(zone->add_route(cpu, nic,{link}));
}
}
simgrid::s4u::Engine e("test");
auto* zone = simgrid::s4u::create_floyd_zone("test");
- const simgrid::s4u::Host* nic = zone->create_host("nic", 1e9)->seal();
- const simgrid::s4u::Link* link = zone->create_link("my_link", 1e6)->seal();
+ const simgrid::s4u::Host* nic = zone->create_host("nic", 1e9);
+ const simgrid::s4u::Link* link = zone->create_link("my_link", 1e6);
for (int i = 0; i < 10; i++) {
std::string cpu_name = "CPU" + std::to_string(i);
- const simgrid::s4u::Host* cpu = zone->create_host(cpu_name, 1e9)->seal();
- REQUIRE_NOTHROW(zone->add_route(cpu->get_netpoint(), nic->get_netpoint(), nullptr, nullptr,
- {simgrid::s4u::LinkInRoute(link)}, true));
+ const simgrid::s4u::Host* cpu = zone->create_host(cpu_name, 1e9);
+ REQUIRE_NOTHROW(zone->add_route(cpu, nic, {link}));
}
}
simgrid::s4u::Engine e("test");
auto* zone = simgrid::s4u::create_full_zone("test");
- const simgrid::s4u::Host* nic = zone->create_host("nic", 1e9)->seal();
- const simgrid::s4u::Link* link = zone->create_link("my_link", 1e6)->seal();
+ const simgrid::s4u::Host* nic = zone->create_host("nic", 1e9);
+ const simgrid::s4u::Link* link = zone->create_link("my_link", 1e6);
for (int i = 0; i < 10; i++) {
std::string cpu_name = "CPU" + std::to_string(i);
- const simgrid::s4u::Host* cpu = zone->create_host(cpu_name, 1e9)->seal();
- REQUIRE_NOTHROW(zone->add_route(cpu->get_netpoint(), nic->get_netpoint(), nullptr, nullptr,
- {simgrid::s4u::LinkInRoute(link)}, true));
+ const simgrid::s4u::Host* cpu = zone->create_host(cpu_name, 1e9);
+ REQUIRE_NOTHROW(zone->add_route(cpu, nic, {link}));
}
}
for (int i = 0; i < 10; i++) {
std::string cpu_name = "CPU" + std::to_string(i);
const simgrid::s4u::Host* cpu = zone->create_host(cpu_name, 1e9)->seal();
- REQUIRE_NOTHROW(
- zone->add_route(cpu->get_netpoint(), nullptr, nullptr, nullptr, {simgrid::s4u::LinkInRoute(link)}, true));
+ REQUIRE_NOTHROW(zone->add_route(cpu, nullptr, {link}));
}
}
->set_latency(cluster->loopback_lat)
->seal();
- zone->add_route(host->get_netpoint(), host->get_netpoint(), nullptr, nullptr,
- {simgrid::s4u::LinkInRoute(loopback)});
+ zone->add_route(host, host, {simgrid::s4u::LinkInRoute(loopback)});
}
// add a limiter link (shared link to account for maximal bandwidth of the node)
if (backbone)
links.emplace_back(backbone);
- zone->add_route(host->get_netpoint(), nullptr, nullptr, nullptr, links, true);
+ zone->add_route(host, nullptr, links, true);
}
// Add a router.
XBT_DEBUG("<router id=\"%s\"/>", cluster->router_id.c_str());
if (cluster->router_id.empty())
cluster->router_id = cluster->prefix + cluster->id + "_router" + cluster->suffix;
- auto* router = zone->create_router(cluster->router_id);
- std::vector<simgrid::s4u::LinkInRoute> links;
- zone->add_route(router, nullptr, nullptr, nullptr, links);
+ zone->create_router(cluster->router_id);
simgrid::kernel::routing::on_cluster_creation(*cluster);
}
return pimpl_->add_component(elm);
}
-void NetZone::add_route(NetZone* src, NetZone* dst, const std::vector<const Link*>& links)
+void NetZone::add_route(const NetZone* src, const NetZone* dst, const std::vector<const Link*>& links)
{
std::vector<LinkInRoute> links_direct;
std::vector<LinkInRoute> links_reverse;
links_reverse, false);
}
-void NetZone::add_route(NetZone* src, NetZone* dst, const std::vector<LinkInRoute>& link_list, bool symmetrical)
+void NetZone::add_route(const NetZone* src, const NetZone* dst, const std::vector<LinkInRoute>& link_list, bool symmetrical)
{
pimpl_->add_route(src ? src->get_netpoint() : nullptr, dst ? dst->get_netpoint(): nullptr,
src ? src->get_gateway() : nullptr, dst ? dst->get_gateway() : nullptr,
void NetZone::add_route(kernel::routing::NetPoint* src, kernel::routing::NetPoint* dst,
kernel::routing::NetPoint* gw_src, kernel::routing::NetPoint* gw_dst,
- const std::vector<LinkInRoute>& link_list, bool symmetrical)
+ const std::vector<LinkInRoute>& link_list, bool symmetrical) //XBT_ATTRIB_DEPRECATED_v339
{
pimpl_->add_route(src, dst, gw_src, gw_dst, link_list, symmetrical);
}
void NetZone::add_route(kernel::routing::NetPoint* src, kernel::routing::NetPoint* dst,
kernel::routing::NetPoint* gw_src, kernel::routing::NetPoint* gw_dst,
- const std::vector<const Link*>& links)
+ const std::vector<const Link*>& links) //XBT_ATTRIB_DEPRECATED_v339
{
std::vector<LinkInRoute> links_direct;
std::vector<LinkInRoute> links_reverse;
auto* bob = zone->create_host("bob", 1e6);
auto* alice = zone->create_host("alice", 1e6);
- sg4::LinkInRoute link(zone->create_link("link", "2MBps")->set_latency("50us")->seal());
- zone->add_route(bob->get_netpoint(), alice->get_netpoint(), nullptr, nullptr, {link}, true);
+ auto* link = zone->create_link("link", "2MBps")->set_latency("50us");
+ zone->add_route(bob, alice, {link});
bob->create_disk("bob_disk", "1MBps", "500kBps");
alice->create_disk("alice_disk", "4MBps", "4MBps");
#include "simgrid/s4u.hpp"
namespace sg4 = simgrid::s4u;
-XBT_LOG_NEW_DEFAULT_CATEGORY(s4u_torus_multicpu, "Messages specific for this s4u example");
+XBT_LOG_NEW_DEFAULT_CATEGORY(seal_platform, "Messages specific for this s4u example");
class Sender {
long msg_size = 1e6; /* message size in bytes */
/*************************************************************************************************/
static sg4::NetZone* create_zone(const sg4::NetZone* root, const std::string& id)
{
- auto* zone = sg4::create_floyd_zone(id);
- zone->set_parent(root);
+ auto* zone = sg4::create_star_zone(id)->set_parent(root);
constexpr int n_host = 2;
- auto* router = zone->create_router("router" + id);
+ zone->set_gateway(zone->create_router("router" + id));
for (int i = 0; i < n_host; i++) {
std::string hostname = id + "-cpu-" + std::to_string(i);
auto* host = zone->create_host(hostname, 1e9);
host->create_disk("disk-" + hostname, 1e9, 1e6);
const auto* link = zone->create_link("link-" + hostname, 1e9);
- zone->add_route(host->get_netpoint(), router, nullptr, nullptr, {link});
+ zone->add_route(host, nullptr, {link});
}
return zone;
}
auto* zoneA = create_zone(root, "A");
auto* zoneB = create_zone(root, "B");
const auto* link = root->create_link("root-link", 1e10);
- root->add_route(zoneA->get_netpoint(), zoneB->get_netpoint(), e.netpoint_by_name("routerA"),
- e.netpoint_by_name("routerB"), {sg4::LinkInRoute(link)});
+ root->add_route(zoneA, zoneB, {sg4::LinkInRoute(link)}, true);
std::vector<sg4::Host*> host_list = e.get_all_hosts();
/* create the sender actor running on first host */
$ ./seal-platform
-> [A-cpu-0:sender:(1) 0.000000] [s4u_torus_multicpu/INFO] Done dispatching all messages
-> [A-cpu-0:receiver-A-cpu-0:(2) 0.000103] [s4u_torus_multicpu/INFO] I got a 'Hello, I'm alive and running on A-cpu-0'.
-> [B-cpu-1:receiver-B-cpu-1:(5) 0.003247] [s4u_torus_multicpu/INFO] I got a 'Hello, I'm alive and running on A-cpu-0'.
-> [B-cpu-0:receiver-B-cpu-0:(4) 0.003247] [s4u_torus_multicpu/INFO] I got a 'Hello, I'm alive and running on A-cpu-0'.
-> [A-cpu-1:receiver-A-cpu-1:(3) 0.003247] [s4u_torus_multicpu/INFO] I got a 'Hello, I'm alive and running on A-cpu-0'.
-> [A-cpu-0:sender:(1) 0.003247] [s4u_torus_multicpu/INFO] Goodbye now!
-> [A-cpu-0:receiver-A-cpu-0:(2) 4.000103] [s4u_torus_multicpu/INFO] Wrote 4000000 bytes on 'disk-A-cpu-0'
-> [B-cpu-1:receiver-B-cpu-1:(5) 4.003247] [s4u_torus_multicpu/INFO] Wrote 4000000 bytes on 'disk-B-cpu-1'
-> [B-cpu-0:receiver-B-cpu-0:(4) 4.003247] [s4u_torus_multicpu/INFO] Wrote 4000000 bytes on 'disk-B-cpu-0'
-> [A-cpu-1:receiver-A-cpu-1:(3) 4.003247] [s4u_torus_multicpu/INFO] Wrote 4000000 bytes on 'disk-A-cpu-1'
+> [A-cpu-0:sender:(1) 0.000000] [seal_platform/INFO] Done dispatching all messages
+> [B-cpu-1:receiver-B-cpu-1:(5) 0.004330] [seal_platform/INFO] I got a 'Hello, I'm alive and running on A-cpu-0'.
+> [B-cpu-0:receiver-B-cpu-0:(4) 0.004330] [seal_platform/INFO] I got a 'Hello, I'm alive and running on A-cpu-0'.
+> [A-cpu-1:receiver-A-cpu-1:(3) 0.004330] [seal_platform/INFO] I got a 'Hello, I'm alive and running on A-cpu-0'.
+> [A-cpu-0:receiver-A-cpu-0:(2) 0.004330] [seal_platform/INFO] I got a 'Hello, I'm alive and running on A-cpu-0'.
+> [A-cpu-0:sender:(1) 0.004330] [seal_platform/INFO] Goodbye now!
+> [B-cpu-1:receiver-B-cpu-1:(5) 4.004330] [seal_platform/INFO] Wrote 4000000 bytes on 'disk-B-cpu-1'
+> [B-cpu-0:receiver-B-cpu-0:(4) 4.004330] [seal_platform/INFO] Wrote 4000000 bytes on 'disk-B-cpu-0'
+> [A-cpu-1:receiver-A-cpu-1:(3) 4.004330] [seal_platform/INFO] Wrote 4000000 bytes on 'disk-A-cpu-1'
+> [A-cpu-0:receiver-A-cpu-0:(2) 4.004330] [seal_platform/INFO] Wrote 4000000 bytes on 'disk-A-cpu-0'
\ No newline at end of file