X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/b0b20786751d59b46c18bc23416b45e3fa0167ba..48028d9fbcca84960514fb0622b9b22a48162cc0:/src/surf/sg_platf.cpp diff --git a/src/surf/sg_platf.cpp b/src/surf/sg_platf.cpp index 46081c435f..e7374e59c4 100644 --- a/src/surf/sg_platf.cpp +++ b/src/surf/sg_platf.cpp @@ -48,13 +48,14 @@ static simgrid::kernel::routing::NetZoneImpl* routing_get_current() /** Module management function: creates all internal data structures */ void sg_platf_init() -{ /* Do nothing: just for symmetry of user code */ +{ + simgrid::s4u::on_platform_created.connect(check_disk_attachment); } /** Module management function: frees all internal data structures */ void sg_platf_exit() { simgrid::surf::on_cluster.disconnectSlots(); - simgrid::s4u::onPlatformCreated.disconnectSlots(); + simgrid::s4u::on_platform_created.disconnectSlots(); /* make sure that we will reinit the models while loading the platf once reinited */ surf_parse_models_setup_already_called = 0; @@ -95,7 +96,7 @@ simgrid::kernel::routing::NetPoint* sg_platf_new_router(std::string name, const if (current_routing->hierarchy_ == simgrid::kernel::routing::NetZoneImpl::RoutingMode::unset) current_routing->hierarchy_ = simgrid::kernel::routing::NetZoneImpl::RoutingMode::base; - xbt_assert(nullptr == simgrid::s4u::Engine::getInstance()->getNetpointByNameOrNull(name), + xbt_assert(nullptr == simgrid::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()); simgrid::kernel::routing::NetPoint* netpoint = @@ -391,7 +392,7 @@ void sg_platf_new_mount(simgrid::kernel::routing::MountCreationArgs* mount) if (mount_list.empty()) XBT_DEBUG("Create a Mount list for %s", A_surfxml_host_id); - mount_list.insert({mount->name, simgrid::s4u::Engine::getInstance()->storageByName(mount->storageId)->getImpl()}); + mount_list.insert({mount->name, simgrid::s4u::Engine::get_instance()->storage_by_name(mount->storageId)->getImpl()}); } void sg_platf_new_route(simgrid::kernel::routing::RouteCreationArgs* route) @@ -414,7 +415,7 @@ void sg_platf_new_actor(simgrid::kernel::routing::ActorCreationArgs* actor) std::string msg = std::string("Cannot create actor '") + actor->function + "': host '" + actor->host + "' does not exist\nExisting hosts: '"; - std::vector list = simgrid::s4u::Engine::getInstance()->getAllHosts(); + std::vector list = simgrid::s4u::Engine::get_instance()->get_all_hosts(); for (auto const& host : list) { msg += host->get_name(); @@ -491,12 +492,6 @@ void sg_platf_new_peer(simgrid::kernel::routing::PeerCreationArgs* peer) host->pimpl_cpu->set_speed_trace(peer->speed_trace); } -void sg_platf_begin() { /* Do nothing: just for symmetry of user code */ } - -void sg_platf_end() { - simgrid::s4u::onPlatformCreated(); -} - /* Pick the right models for CPU, net and host, and call their model_init_preparse */ static void surf_config_models_setup() { @@ -506,10 +501,10 @@ static void surf_config_models_setup() std::string storage_model_name = simgrid::config::get_value("storage/model"); /* The compound host model is needed when using non-default net/cpu models */ - if ((not xbt_cfg_is_default_value("network/model") || not xbt_cfg_is_default_value("cpu/model")) && - xbt_cfg_is_default_value("host/model")) { + if ((not simgrid::config::is_default("network/model") || not simgrid::config::is_default("cpu/model")) && + simgrid::config::is_default("host/model")) { host_model_name = "compound"; - xbt_cfg_set_string("host/model", host_model_name.c_str()); + simgrid::config::set_value("host/model", host_model_name); } XBT_DEBUG("host model: %s", host_model_name.c_str()); @@ -549,6 +544,8 @@ static void surf_config_models_setup() simgrid::s4u::NetZone* sg_platf_new_Zone_begin(simgrid::kernel::routing::ZoneCreationArgs* zone) { if (not surf_parse_models_setup_already_called) { + simgrid::s4u::on_platform_creation(); + /* Initialize the surf models. That must be done after we got all config, and before we need the models. * That is, after the last tag, if any, and before the first of cluster|peer|AS|trace|trace_connect * @@ -602,10 +599,7 @@ simgrid::s4u::NetZone* sg_platf_new_Zone_begin(simgrid::kernel::routing::ZoneCre } if (current_routing == nullptr) { /* it is the first one */ - xbt_assert(simgrid::s4u::Engine::getInstance()->pimpl->netRoot_ == nullptr, - "All defined components must belong to a networking zone."); - simgrid::s4u::Engine::getInstance()->pimpl->netRoot_ = new_zone; - + simgrid::s4u::Engine::get_instance()->set_netzone_root(new_zone); } else { /* set the father behavior */ if (current_routing->hierarchy_ == simgrid::kernel::routing::NetZoneImpl::RoutingMode::unset) @@ -616,7 +610,6 @@ simgrid::s4u::NetZone* sg_platf_new_Zone_begin(simgrid::kernel::routing::ZoneCre /* set the new current component of the tree */ current_routing = new_zone; - simgrid::s4u::NetZone::onCreation(*new_zone); // notify the signal return new_zone;