X-Git-Url: http://bilbo.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/84402e8e2ee2a2d0bef25fdceb0a263ed8b471f6..14a648ee027ce06fa61629ce45d7db2b1e1cafa8:/src/surf/sg_platf.cpp diff --git a/src/surf/sg_platf.cpp b/src/surf/sg_platf.cpp index 3dc8bb3a30..e1218f8afd 100644 --- a/src/surf/sg_platf.cpp +++ b/src/surf/sg_platf.cpp @@ -67,7 +67,7 @@ void sg_platf_exit() { } /** @brief Add a host to the current AS */ -void sg_platf_new_host(simgrid::kernel::routing::HostCreationArgs* args) +void sg_platf_new_host(const simgrid::kernel::routing::HostCreationArgs* args) { std::map props; if (args->properties) { @@ -79,12 +79,10 @@ void sg_platf_new_host(simgrid::kernel::routing::HostCreationArgs* args) simgrid::s4u::Host* host = routing_get_current()->create_host(args->id, args->speed_per_pstate, args->core_amount, &props); - host->pimpl_->storage_ = mount_list; + host->pimpl_->set_storages(mount_list); mount_list.clear(); - host->pimpl_->disks_ = std::move(args->disks); - for (auto d : host->pimpl_->disks_) - d->set_host(host); + host->pimpl_->set_disks(args->disks, host); /* Change from the defaults */ if (args->state_trace) @@ -118,6 +116,13 @@ simgrid::kernel::routing::NetPoint* sg_platf_new_router(const std::string& name, static void sg_platf_new_link(const simgrid::kernel::routing::LinkCreationArgs* link, const std::string& link_name) { + static double last_warned_latency = sg_surf_precision; + if (link->latency != 0.0 && link->latency < last_warned_latency) { + XBT_WARN("Latency for link %s is smaller than surf/precision (%g < %g)." + " For more accuracy, consider setting \"--cfg=surf/precision:%g\".", + link_name.c_str(), link->latency, sg_surf_precision, link->latency); + last_warned_latency = link->latency; + } simgrid::kernel::resource::LinkImpl* l = surf_network_model->create_link(link_name, link->bandwidths, link->latency, link->policy); @@ -233,7 +238,7 @@ void sg_platf_new_cluster(simgrid::kernel::routing::ClusterCreationArgs* cluster linkUp = simgrid::s4u::Link::by_name_or_null(tmp_link); linkDown = simgrid::s4u::Link::by_name_or_null(tmp_link); - auto* as_cluster = static_cast(current_as); + ClusterZone* as_cluster = current_as; as_cluster->private_links_.insert({as_cluster->node_pos(rankId), {linkUp->get_impl(), linkDown->get_impl()}}); } @@ -378,7 +383,8 @@ void sg_platf_new_storage(simgrid::kernel::routing::StorageCreationArgs* storage storage->id.c_str(), stype->model.c_str(), stype->id.c_str(), storage->content.c_str(), storage->properties); - auto s = surf_storage_model->createStorage(storage->id, stype->id, storage->content, storage->attach); + auto s = surf_storage_model->createStorage(storage->filename, storage->lineno, storage->id, stype->id, + storage->content, storage->attach); if (storage->properties) { s->set_properties(*storage->properties); @@ -446,7 +452,8 @@ void sg_platf_new_actor(simgrid::kernel::routing::ActorCreationArgs* actor) } xbt_die("%s", msg.c_str()); } - const simgrid::simix::ActorCodeFactory& factory = SIMIX_get_actor_code_factory(actor->function); + const simgrid::kernel::actor::ActorCodeFactory& factory = + simgrid::kernel::EngineImpl::get_instance()->get_function(actor->function); xbt_assert(factory, "Error while creating an actor from the XML file: Function '%s' not registered", actor->function); double start_time = actor->start_time; @@ -454,7 +461,7 @@ void sg_platf_new_actor(simgrid::kernel::routing::ActorCreationArgs* actor) bool auto_restart = actor->restart_on_failure; std::string actor_name = actor->args[0]; - simgrid::simix::ActorCode code = factory(std::move(actor->args)); + simgrid::kernel::actor::ActorCode code = factory(std::move(actor->args)); std::shared_ptr> properties(actor->properties); simgrid::kernel::actor::ProcessArg* arg = @@ -660,13 +667,13 @@ void sg_platf_new_Zone_seal() xbt_assert(current_routing, "Cannot seal the current AS: none under construction"); current_routing->seal(); simgrid::s4u::NetZone::on_seal(*current_routing->get_iface()); - current_routing = static_cast(current_routing->get_father()); + current_routing = current_routing->get_father(); } /** @brief Add a link connecting a host to the rest of its AS (which must be cluster or vivaldi) */ void sg_platf_new_hostlink(const simgrid::kernel::routing::HostLinkCreationArgs* hostlink) { - simgrid::kernel::routing::NetPoint* netpoint = simgrid::s4u::Host::by_name(hostlink->id)->get_netpoint(); + const 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()); xbt_assert(dynamic_cast(current_routing), "Only hosts from Cluster and Vivaldi ASes can get a host_link.");