- Thread contexts are used by default with Python bindings. Other kinds of
contexts revealed unstable, specially starting with pybind11 v2.8.0.
+Fixed bugs (FG#.. -> FramaGit bugs; FG!.. -> FG merge requests)
+ (FG: issues on Framagit; GF: issues on GForge; GH: issues on GitHub)
+ - FG#99: Weird segfault when not sealing an host
+
----------------------------------------------------------------------------
SimGrid (3.29) October 7. 2021
static bool has_instance() { return instance_ != nullptr; }
void load_platform(const std::string& platf) const;
+ void seal_platform() const;
void register_function(const std::string& name, const std::function<void(int, char**)>& code);
void register_function(const std::string& name, const std::function<void(std::vector<std::string>)>& code);
instance_ = nullptr;
}
+void EngineImpl::seal_platform() const
+{
+ /* sealing resources before run: links */
+ for (auto const& kv : links_)
+ kv.second->get_iface()->seal();
+ /* seal netzone root, recursively seal children netzones, hosts and disks */
+ netzone_root_->seal();
+}
+
void EngineImpl::load_platform(const std::string& platf)
{
double start = xbt_os_time();
void EngineImpl::run(double max_date)
{
+ seal_platform();
+
if (MC_record_replay_is_active()) {
mc::replay(MC_record_path());
empty_trash();
void initialize(int* argc, char** argv);
void load_platform(const std::string& platf);
void load_deployment(const std::string& file) const;
+ void seal_platform() const;
void register_function(const std::string& name, const actor::ActorCodeFactory& code);
void register_default(const actor::ActorCodeFactory& code);
xbt_assert(cpu_model_pm_,
"Impossible to create host: %s. Invalid CPU model: nullptr. Have you set the parent of this NetZone: %s?",
name.c_str(), get_cname());
+ xbt_assert(not sealed_, "Impossible to create host: %s. NetZone %s already sealed", name.c_str(), get_cname());
auto* res = (new resource::HostImpl(name))->get_iface();
res->set_netpoint((new NetPoint(name, NetPoint::Type::Host))->set_englobing_zone(this));
network_model_,
"Impossible to create link: %s. Invalid network model: nullptr. Have you set the parent of this NetZone: %s?",
name.c_str(), get_cname());
+ xbt_assert(not sealed_, "Impossible to create link: %s. NetZone %s already sealed", name.c_str(), get_cname());
return network_model_->create_link(name, bandwidths)->get_iface();
}
s4u::SplitDuplexLink* NetZoneImpl::create_split_duplex_link(const std::string& name,
const std::vector<double>& bandwidths)
{
+ xbt_assert(
+ network_model_,
+ "Impossible to create link: %s. Invalid network model: nullptr. Have you set the parent of this NetZone: %s?",
+ name.c_str(), get_cname());
+ xbt_assert(not sealed_, "Impossible to create link: %s. NetZone %s already sealed", name.c_str(), get_cname());
+
auto* link_up = network_model_->create_link(name + "_UP", bandwidths);
auto* link_down = network_model_->create_link(name + "_DOWN", bandwidths);
auto link = std::make_unique<resource::SplitDuplexLinkImpl>(name, link_up, link_down);
xbt_assert(disk_model_,
"Impossible to create disk: %s. Invalid disk model: nullptr. Have you set the parent of this NetZone: %s?",
name.c_str(), get_cname());
+ xbt_assert(not sealed_, "Impossible to create disk: %s. NetZone %s already sealed", name.c_str(), get_cname());
auto* l = disk_model_->create_disk(name, read_bandwidth, write_bandwidth);
return l->get_iface();
{
xbt_assert(nullptr == s4u::Engine::get_instance()->netpoint_by_name_or_null(name),
"Refusing to create a router named '%s': this name already describes a node.", name.c_str());
+ xbt_assert(not sealed_, "Impossible to create router: %s. NetZone %s already sealed", name.c_str(), get_cname());
return (new NetPoint(name, NetPoint::Type::Router))->set_englobing_zone(this);
}
pimpl->load_platform(platf);
}
+/**
+ * @brief Seals the platform, finishing the creation of its resources.
+ *
+ * This method is optional. The seal() is done automatically when you call Engine::run.
+ */
+void Engine::seal_platform() const
+{
+ pimpl->seal_platform();
+}
+
/** Registers the main function of an actor that will be launched from the deployment file */
void Engine::register_function(const std::string& name, const std::function<void(int, char**)>& code)
{
}
void Engine::run_until(double max_date) const
{
- /* sealing resources before run: links */
- for (auto* link : get_all_links())
- link->seal();
- /* seal netzone root, recursively seal children netzones, hosts and disks */
- get_netzone_root()->seal();
-
/* Clean IO before the run */
fflush(stdout);
fflush(stderr);
}
simgrid::s4u::NetZone const* parent = current_routing ? current_routing->get_iface() : nullptr;
- simgrid::s4u::NetZone* zone;
switch (cluster->topology) {
case simgrid::kernel::routing::ClusterTopology::TORUS:
- zone = simgrid::s4u::create_torus_zone(
- cluster->id, parent, TorusZone::parse_topo_parameters(cluster->topo_parameters),
- {set_host, set_loopback, set_limiter}, cluster->bw, cluster->lat, cluster->sharing_policy);
+ simgrid::s4u::create_torus_zone(cluster->id, parent, TorusZone::parse_topo_parameters(cluster->topo_parameters),
+ {set_host, set_loopback, set_limiter}, cluster->bw, cluster->lat,
+ cluster->sharing_policy);
break;
case simgrid::kernel::routing::ClusterTopology::DRAGONFLY:
- zone = simgrid::s4u::create_dragonfly_zone(
+ simgrid::s4u::create_dragonfly_zone(
cluster->id, parent, DragonflyZone::parse_topo_parameters(cluster->topo_parameters),
{set_host, set_loopback, set_limiter}, cluster->bw, cluster->lat, cluster->sharing_policy);
break;
case simgrid::kernel::routing::ClusterTopology::FAT_TREE:
- zone = simgrid::s4u::create_fatTree_zone(
+ simgrid::s4u::create_fatTree_zone(
cluster->id, parent, FatTreeZone::parse_topo_parameters(cluster->topo_parameters),
{set_host, set_loopback, set_limiter}, cluster->bw, cluster->lat, cluster->sharing_policy);
break;
default:
THROW_IMPOSSIBLE;
}
- zone->seal();
}
/*************************************************************************************************/
auto* router = zone->create_router(cluster->router_id);
zone->add_route(router, nullptr, nullptr, nullptr, {});
- zone->seal();
simgrid::kernel::routing::on_cluster_creation(*cluster);
}
zone_cluster.cabinets.clear();
zone_cluster.backbone.reset();
}
- current_routing->seal();
current_routing = current_routing->get_parent();
}
{
xbt_os_cputimer_start(parse_time);
sg4::Engine::get_instance()->load_platform(platformFile);
+ sg4::Engine::get_instance()->seal_platform();
xbt_os_cputimer_stop(parse_time);
}
/* creation of the environment */
e.load_platform(argv[1]);
+ e.seal_platform();
XBT_INFO("Workstation number: %zu, link number: %zu", e.get_host_count(), e.get_link_count());
std::vector<sg4::Host*> hosts = e.get_all_hosts();