From 76a0df97ebdbc98eb6700edf89c7fea3d9d60e24 Mon Sep 17 00:00:00 2001 From: Martin Quinson Date: Thu, 16 Feb 2023 23:39:54 +0100 Subject: [PATCH] Rename sg_surf_precision to sg_precision_timing for clarity --- src/kernel/lmm/System.cpp | 2 +- src/kernel/resource/Action.cpp | 4 ++-- src/kernel/resource/CpuImpl.cpp | 2 +- src/kernel/resource/StandardLinkImpl.cpp | 4 ++-- src/s4u/s4u_Actor.cpp | 4 ++-- src/simgrid/sg_config.cpp | 2 +- src/smpi/bindings/smpi_pmpi.cpp | 4 ++-- src/smpi/internals/smpi_bench.cpp | 6 +++--- src/surf/cpu_cas01.cpp | 2 +- src/surf/cpu_ti.cpp | 6 +++--- src/surf/network_cm02.cpp | 4 ++-- src/surf/network_constant.cpp | 2 +- src/surf/network_ib.cpp | 2 +- src/surf/network_ns3.cpp | 4 ++-- src/surf/ptask_L07.cpp | 2 +- src/surf/surf_interface.hpp | 2 +- 16 files changed, 26 insertions(+), 26 deletions(-) diff --git a/src/kernel/lmm/System.cpp b/src/kernel/lmm/System.cpp index 5aa108295a..5df8786f7a 100644 --- a/src/kernel/lmm/System.cpp +++ b/src/kernel/lmm/System.cpp @@ -14,7 +14,7 @@ XBT_LOG_NEW_DEFAULT_SUBCATEGORY(ker_lmm, kernel, "Kernel Linear Max-Min solver"); double sg_maxmin_precision = 1E-5; /* Change this with --cfg=maxmin/precision:VALUE */ -double sg_surf_precision = 1E-9; /* Change this with --cfg=surf/precision:VALUE */ +double sg_precision_timing = 1E-9; /* Change this with --cfg=surf/precision:VALUE */ int sg_concurrency_limit = -1; /* Change this with --cfg=maxmin/concurrency-limit:VALUE */ namespace simgrid::kernel::lmm { diff --git a/src/kernel/resource/Action.cpp b/src/kernel/resource/Action.cpp index 0cb147ce3b..ed431b7449 100644 --- a/src/kernel/resource/Action.cpp +++ b/src/kernel/resource/Action.cpp @@ -194,12 +194,12 @@ double Action::get_remains() void Action::update_max_duration(double delta) { if (max_duration_ != NO_MAX_DURATION) - double_update(&max_duration_, delta, sg_surf_precision); + double_update(&max_duration_, delta, sg_precision_timing); } void Action::update_remains(double delta) { - double_update(&remains_, delta, sg_maxmin_precision * sg_surf_precision); + double_update(&remains_, delta, sg_maxmin_precision * sg_precision_timing); } void Action::set_last_update() diff --git a/src/kernel/resource/CpuImpl.cpp b/src/kernel/resource/CpuImpl.cpp index f7dc10ba8a..9ff76514ae 100644 --- a/src/kernel/resource/CpuImpl.cpp +++ b/src/kernel/resource/CpuImpl.cpp @@ -18,7 +18,7 @@ namespace simgrid::kernel::resource { void CpuModel::update_actions_state_lazy(double now, double /*delta*/) { - while (not get_action_heap().empty() && double_equals(get_action_heap().top_date(), now, sg_surf_precision)) { + while (not get_action_heap().empty() && double_equals(get_action_heap().top_date(), now, sg_precision_timing)) { auto* action = static_cast(get_action_heap().pop()); XBT_DEBUG("Something happened to action %p", action); diff --git a/src/kernel/resource/StandardLinkImpl.cpp b/src/kernel/resource/StandardLinkImpl.cpp index 30471d020b..6876a4b0bd 100644 --- a/src/kernel/resource/StandardLinkImpl.cpp +++ b/src/kernel/resource/StandardLinkImpl.cpp @@ -62,11 +62,11 @@ void StandardLinkImpl::set_sharing_policy(s4u::Link::SharingPolicy policy, const void StandardLinkImpl::latency_check(double latency) const { - static double last_warned_latency = sg_surf_precision; + static double last_warned_latency = sg_precision_timing; if (latency != 0.0 && 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\".", - get_cname(), latency, sg_surf_precision, latency); + get_cname(), latency, sg_precision_timing, latency); last_warned_latency = latency; } } diff --git a/src/s4u/s4u_Actor.cpp b/src/s4u/s4u_Actor.cpp index 284faaa1f4..f488c35eb2 100644 --- a/src/s4u/s4u_Actor.cpp +++ b/src/s4u/s4u_Actor.cpp @@ -313,13 +313,13 @@ void sleep_for(double duration) if (duration <= 0) /* that's a no-op */ return; - if (duration < sg_surf_precision) { + if (duration < sg_precision_timing) { static unsigned int warned = 0; // At most 20 such warnings warned++; if (warned <= 20) XBT_INFO("The parameter to sleep_for() is smaller than the SimGrid numerical accuracy (%g < %g). " "Please refer to https://simgrid.org/doc/latest/Configuring_SimGrid.html#numerical-precision", - duration, sg_surf_precision); + duration, sg_precision_timing); if (warned == 20) XBT_VERB("(further warnings about the numerical accuracy of sleep_for() will be omitted)."); } diff --git a/src/simgrid/sg_config.cpp b/src/simgrid/sg_config.cpp index ed9b59a100..2793ca5ecc 100644 --- a/src/simgrid/sg_config.cpp +++ b/src/simgrid/sg_config.cpp @@ -146,7 +146,7 @@ void sg_config_init(int *argc, char **argv) simgrid_host_models().create_flag("host/model", "The model to use for the host", "default", false); simgrid_disk_models().create_flag("disk/model", "The model to use for the disk", "S19", false); - simgrid::config::bind_flag(sg_surf_precision, "surf/precision", + simgrid::config::bind_flag(sg_precision_timing, "surf/precision", "Numerical precision used when updating simulation times (in seconds)"); simgrid::config::bind_flag(sg_maxmin_precision, "maxmin/precision", diff --git a/src/smpi/bindings/smpi_pmpi.cpp b/src/smpi/bindings/smpi_pmpi.cpp index d825ffe4a7..3168044af7 100644 --- a/src/smpi/bindings/smpi_pmpi.cpp +++ b/src/smpi/bindings/smpi_pmpi.cpp @@ -152,10 +152,10 @@ double PMPI_Wtime() return smpi_mpi_wtime(); } -extern double sg_surf_precision; +extern double sg_precision_timing; double PMPI_Wtick() { - return sg_surf_precision; + return sg_precision_timing; } int PMPI_Address(const void* location, MPI_Aint* address) diff --git a/src/smpi/internals/smpi_bench.cpp b/src/smpi/internals/smpi_bench.cpp index 520cd14847..794fa3e9fc 100644 --- a/src/smpi/internals/smpi_bench.cpp +++ b/src/smpi/internals/smpi_bench.cpp @@ -13,7 +13,7 @@ #include "smpi_utils.hpp" #include "src/internal_config.h" #include "src/mc/mc_replay.hpp" -#include "src/surf/surf_interface.hpp" // sg_surf_precision +#include "src/surf/surf_interface.hpp" // sg_precision_timing #include "xbt/config.hpp" #include "xbt/file.hpp" @@ -256,13 +256,13 @@ double smpi_mpi_wtime() unsigned long long smpi_rastro_resolution () { const SmpiBenchGuard suspend_bench; - return static_cast(1.0 / sg_surf_precision); + return static_cast(1.0 / sg_precision_timing); } unsigned long long smpi_rastro_timestamp () { const SmpiBenchGuard suspend_bench; - return static_cast(simgrid::s4u::Engine::get_clock() / sg_surf_precision); + return static_cast(simgrid::s4u::Engine::get_clock() / sg_precision_timing); } /* ****************************** Functions related to the SMPI_SAMPLE_ macros ************************************/ diff --git a/src/surf/cpu_cas01.cpp b/src/surf/cpu_cas01.cpp index 83aa5f9654..11faee71f9 100644 --- a/src/surf/cpu_cas01.cpp +++ b/src/surf/cpu_cas01.cpp @@ -159,7 +159,7 @@ CpuAction* CpuCas01::execution_start(double size, int requested_cores, double us CpuAction* CpuCas01::sleep(double duration) { if (duration > 0) - duration = std::max(duration, sg_surf_precision); + duration = std::max(duration, sg_precision_timing); XBT_IN("(%s, %g)", get_cname(), duration); auto* action = new CpuCas01Action(get_model(), 1.0, not is_on(), speed_.scale * speed_.peak, get_constraint(), 1); diff --git a/src/surf/cpu_ti.cpp b/src/surf/cpu_ti.cpp index 954ae50a67..029965abdb 100644 --- a/src/surf/cpu_ti.cpp +++ b/src/surf/cpu_ti.cpp @@ -120,7 +120,7 @@ double CpuTiProfile::integrate_simple_point(double a) const XBT_DEBUG("a %f ind %ld integral %f ind + 1 %f ind %f time +1 %f time %f", a, ind, integral, integral_[ind + 1], integral_[ind], time_points_[ind + 1], time_points_[ind]); - double_update(&a_aux, time_points_[ind], sg_maxmin_precision * sg_surf_precision); + double_update(&a_aux, time_points_[ind], sg_maxmin_precision * sg_precision_timing); if (a_aux > 0) integral += ((integral_[ind + 1] - integral_[ind]) / (time_points_[ind + 1] - time_points_[ind])) * (a - time_points_[ind]); @@ -311,7 +311,7 @@ double CpuTiModel::next_occurring_event(double now) void CpuTiModel::update_actions_state(double now, double /*delta*/) { - while (not get_action_heap().empty() && double_equals(get_action_heap().top_date(), now, sg_surf_precision)) { + while (not get_action_heap().empty() && double_equals(get_action_heap().top_date(), now, sg_precision_timing)) { auto* action = static_cast(get_action_heap().pop()); XBT_DEBUG("Action %p: finish", action); action->finish(Action::State::FINISHED); @@ -520,7 +520,7 @@ CpuAction* CpuTi::execution_start(double size, double user_bound) CpuAction* CpuTi::sleep(double duration) { if (duration > 0) - duration = std::max(duration, sg_surf_precision); + duration = std::max(duration, sg_precision_timing); XBT_IN("(%s,%g)", get_cname(), duration); auto* action = new CpuTiAction(this, 1.0); diff --git a/src/surf/network_cm02.cpp b/src/surf/network_cm02.cpp index 54e369e2e3..c5f4aaf0ff 100644 --- a/src/surf/network_cm02.cpp +++ b/src/surf/network_cm02.cpp @@ -162,7 +162,7 @@ StandardLinkImpl* NetworkCm02Model::create_wifi_link(const std::string& name, co void NetworkCm02Model::update_actions_state_lazy(double now, double /*delta*/) { - while (not get_action_heap().empty() && double_equals(get_action_heap().top_date(), now, sg_surf_precision)) { + while (not get_action_heap().empty() && double_equals(get_action_heap().top_date(), now, sg_precision_timing)) { auto* action = static_cast(get_action_heap().pop()); XBT_DEBUG("Something happened to action %p", action); @@ -192,7 +192,7 @@ void NetworkCm02Model::update_actions_state_full(double /*now*/, double delta) XBT_DEBUG("Something happened to action %p", &action); if (action.latency_ > 0) { if (action.latency_ > delta) { - double_update(&action.latency_, delta, sg_surf_precision); + double_update(&action.latency_, delta, sg_precision_timing); } else { action.latency_ = 0.0; } diff --git a/src/surf/network_constant.cpp b/src/surf/network_constant.cpp index 6183b2da80..d11996d011 100644 --- a/src/surf/network_constant.cpp +++ b/src/surf/network_constant.cpp @@ -60,7 +60,7 @@ void NetworkConstantModel::update_actions_state(double /*now*/, double delta) ++it; // increment iterator here since the following calls to action.finish() may invalidate it if (action.latency_ > 0) { if (action.latency_ > delta) { - double_update(&action.latency_, delta, sg_surf_precision); + double_update(&action.latency_, delta, sg_precision_timing); } else { action.latency_ = 0.0; } diff --git a/src/surf/network_ib.cpp b/src/surf/network_ib.cpp index 04fba51398..10a2d01834 100644 --- a/src/surf/network_ib.cpp +++ b/src/surf/network_ib.cpp @@ -143,7 +143,7 @@ void NetworkIBModel::compute_IB_factors(IBNode* root) const double penalized_bw = num_comm_out ? comm->init_rate / penalty : comm->init_rate; - if (not double_equals(penalized_bw, rate_before_update, sg_surf_precision)) { + if (not double_equals(penalized_bw, rate_before_update, sg_precision_timing)) { XBT_DEBUG("%d->%d action %p penalty updated : bw now %f, before %f , initial rate %f", root->id_, comm->destination->id_, comm->action, penalized_bw, comm->action->get_bound(), comm->init_rate); get_maxmin_system()->update_variable_bound(comm->action->get_variable(), penalized_bw); diff --git a/src/surf/network_ns3.cpp b/src/surf/network_ns3.cpp index aaa77ed748..01dddaff35 100644 --- a/src/surf/network_ns3.cpp +++ b/src/surf/network_ns3.cpp @@ -395,7 +395,7 @@ double NetworkNS3Model::next_occurring_event(double now) // NS-3 stops as soon as a flow ends, // but it does not process the other flows that may finish at the same (simulated) time. // If another flow ends at the same time, time_to_next_flow_completion = 0 - if (double_equals(time_to_next_flow_completion, 0, sg_surf_precision)) + if (double_equals(time_to_next_flow_completion, 0, sg_precision_timing)) time_to_next_flow_completion = 0.0; XBT_DEBUG("min : %f", now); @@ -515,7 +515,7 @@ NetworkNS3Action::NetworkNS3Action(Model* model, double totalBytes, s4u::Host* s // If there is no other started actions, we need to move NS-3 forward to be sync with SimGrid if (model->get_started_action_set()->size() == 1) { - while (double_positive(EngineImpl::get_clock() - ns3::Simulator::Now().GetSeconds(), sg_surf_precision)) { + while (double_positive(EngineImpl::get_clock() - ns3::Simulator::Now().GetSeconds(), sg_precision_timing)) { XBT_DEBUG("Synchronizing NS-3 (time %f) with SimGrid (time %f)", ns3::Simulator::Now().GetSeconds(), EngineImpl::get_clock()); ns3_simulator(EngineImpl::get_clock() - ns3::Simulator::Now().GetSeconds()); diff --git a/src/surf/ptask_L07.cpp b/src/surf/ptask_L07.cpp index 564a2be9e1..725e62e955 100644 --- a/src/surf/ptask_L07.cpp +++ b/src/surf/ptask_L07.cpp @@ -113,7 +113,7 @@ void HostL07Model::update_actions_state(double /*now*/, double delta) ++it; // increment iterator here since the following calls to action.finish() may invalidate it if (action.get_latency() > 0) { if (action.get_latency() > delta) { - action.update_latency(delta, sg_surf_precision); + action.update_latency(delta, sg_precision_timing); } else { action.set_latency(0.0); } diff --git a/src/surf/surf_interface.hpp b/src/surf/surf_interface.hpp index 23bf1e7a71..b5dfbd3c17 100644 --- a/src/surf/surf_interface.hpp +++ b/src/surf/surf_interface.hpp @@ -27,7 +27,7 @@ /* user-visible parameters */ XBT_PUBLIC_DATA double sg_maxmin_precision; -XBT_PUBLIC_DATA double sg_surf_precision; +XBT_PUBLIC_DATA double sg_precision_timing; XBT_PUBLIC_DATA int sg_concurrency_limit; extern XBT_PRIVATE std::unordered_map traces_set_list; -- 2.20.1