} // namespace kernel
} // namespace simgrid
+static simgrid::kernel::routing::ClusterZoneCreationArgs
+ zone_cluster; /* temporary store data for irregular clusters, created with <zone routing="Cluster"> */
+
/** The current NetZone in the parsing */
static simgrid::kernel::routing::NetZoneImpl* current_routing = nullptr;
static simgrid::kernel::routing::NetZoneImpl* routing_get_current()
/*************************************************************************************************/
/** @brief Set the links for internal node inside a Cluster(Star) */
static void sg_platf_cluster_set_hostlink(simgrid::kernel::routing::StarZone* zone,
- simgrid::kernel::routing::NetPoint* netpoint, simgrid::s4u::Link* link_up,
- simgrid::s4u::Link* link_down, simgrid::kernel::resource::LinkImpl* backbone)
+ simgrid::kernel::routing::NetPoint* netpoint,
+ const simgrid::s4u::Link* link_up, const simgrid::s4u::Link* link_down,
+ simgrid::kernel::resource::LinkImpl* backbone)
{
XBT_DEBUG("Push Host_link for host '%s' to position %u", netpoint->get_cname(), netpoint->id());
if (backbone) {
}
/** @brief Add a link connecting a host to the rest of its StarZone */
-static void sg_platf_new_hostlink(simgrid::kernel::routing::StarZone* zone,
- const simgrid::kernel::routing::HostLinkCreationArgs* hostlink,
- simgrid::kernel::resource::LinkImpl* backbone)
+static void sg_platf_build_hostlink(simgrid::kernel::routing::StarZone* zone,
+ const simgrid::kernel::routing::HostLinkCreationArgs* hostlink,
+ simgrid::kernel::resource::LinkImpl* backbone)
{
simgrid::kernel::routing::NetPoint* netpoint = simgrid::s4u::Host::by_name(hostlink->id)->get_netpoint();
xbt_assert(netpoint, "Host '%s' not found!", hostlink->id.c_str());
}
/** @brief Create a cabinet (set of hosts) inside a Cluster(StarZone) */
-static void sg_platf_new_cabinet(simgrid::kernel::routing::StarZone* zone,
- const simgrid::kernel::routing::CabinetCreationArgs* args,
- simgrid::kernel::resource::LinkImpl* backbone)
+static void sg_platf_build_cabinet(simgrid::kernel::routing::StarZone* zone,
+ const simgrid::kernel::routing::CabinetCreationArgs* args,
+ simgrid::kernel::resource::LinkImpl* backbone)
{
for (int const& radical : args->radicals) {
std::string id = args->prefix + std::to_string(radical) + args->suffix;
}
}
-void sg_platf_zone_cluster_populate(simgrid::kernel::routing::ClusterZoneCreationArgs* cluster)
+static void sg_platf_zone_cluster_populate(const simgrid::kernel::routing::ClusterZoneCreationArgs* cluster)
{
auto* zone = dynamic_cast<simgrid::kernel::routing::StarZone*>(current_routing);
xbt_assert(zone, "Host_links are only valid for Cluster(Star)");
/* create host_links for hosts */
for (auto const& hostlink : cluster->host_links) {
- sg_platf_new_hostlink(zone, &hostlink, backbone);
+ sg_platf_build_hostlink(zone, &hostlink, backbone);
}
/* create cabinets */
for (auto const& cabinet : cluster->cabinets) {
- sg_platf_new_cabinet(zone, &cabinet, backbone);
+ sg_platf_build_cabinet(zone, &cabinet, backbone);
}
}
+void routing_cluster_add_backbone(std::unique_ptr<simgrid::kernel::routing::LinkCreationArgs> link)
+{
+ zone_cluster.backbone = std::move(link);
+}
+
+void sg_platf_new_cabinet(const simgrid::kernel::routing::CabinetCreationArgs* args)
+{
+ xbt_assert(args, "Invalid nullptr argument");
+ zone_cluster.cabinets.emplace_back(*args);
+}
+
/*************************************************************************************************/
void sg_platf_new_route(simgrid::kernel::routing::RouteCreationArgs* route)
{
auto_restart);
XBT_DEBUG("Process %s@%s will be started at time %f", arg->name.c_str(), arg->host->get_cname(), start_time);
- simgrid::simix::Timer::set(start_time, [arg, auto_restart]() {
+ simgrid::kernel::timer::Timer::set(start_time, [arg, auto_restart]() {
simgrid::kernel::actor::ActorImplPtr new_actor =
simgrid::kernel::actor::ActorImpl::create(arg->name.c_str(), arg->code, arg->data, arg->host, nullptr);
new_actor->set_properties(arg->properties);
*/
simgrid::kernel::routing::NetZoneImpl* sg_platf_new_Zone_begin(const simgrid::kernel::routing::ZoneCreationArgs* zone)
{
- current_routing = sg_platf_create_zone(zone);
+ zone_cluster.routing = zone->routing;
+ current_routing = sg_platf_create_zone(zone);
return current_routing;
}
void sg_platf_new_Zone_seal()
{
xbt_assert(current_routing, "Cannot seal the current Zone: none under construction");
+ if (strcasecmp(zone_cluster.routing.c_str(), "Cluster") == 0) {
+ sg_platf_zone_cluster_populate(&zone_cluster);
+ zone_cluster.routing = "";
+ zone_cluster.host_links.clear();
+ zone_cluster.cabinets.clear();
+ zone_cluster.backbone.reset();
+ }
current_routing->seal();
current_routing = current_routing->get_parent();
}
+/** @brief Add a link connecting a host to the rest of its Zone (which must be cluster or vivaldi) */
+void sg_platf_new_hostlink(const simgrid::kernel::routing::HostLinkCreationArgs* hostlink)
+{
+ xbt_assert(hostlink, "Invalid nullptr parameter");
+ zone_cluster.host_links.emplace_back(*hostlink);
+}
+
void sg_platf_new_trace(simgrid::kernel::routing::ProfileCreationArgs* args)
{
simgrid::kernel::profile::Profile* profile;