Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Rename sg_surf_precision to sg_precision_timing for clarity
authorMartin Quinson <martin.quinson@ens-rennes.fr>
Thu, 16 Feb 2023 22:39:54 +0000 (23:39 +0100)
committerMartin Quinson <martin.quinson@ens-rennes.fr>
Fri, 17 Feb 2023 07:30:13 +0000 (08:30 +0100)
16 files changed:
src/kernel/lmm/System.cpp
src/kernel/resource/Action.cpp
src/kernel/resource/CpuImpl.cpp
src/kernel/resource/StandardLinkImpl.cpp
src/s4u/s4u_Actor.cpp
src/simgrid/sg_config.cpp
src/smpi/bindings/smpi_pmpi.cpp
src/smpi/internals/smpi_bench.cpp
src/surf/cpu_cas01.cpp
src/surf/cpu_ti.cpp
src/surf/network_cm02.cpp
src/surf/network_constant.cpp
src/surf/network_ib.cpp
src/surf/network_ns3.cpp
src/surf/ptask_L07.cpp
src/surf/surf_interface.hpp

index 5aa1082..5df8786 100644 (file)
@@ -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 {
index 0cb147c..ed431b7 100644 (file)
@@ -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()
index f7dc10b..9ff7651 100644 (file)
@@ -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<CpuAction*>(get_action_heap().pop());
     XBT_DEBUG("Something happened to action %p", action);
 
index 30471d0..6876a4b 100644 (file)
@@ -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;
   }
 }
index 284faaa..f488c35 100644 (file)
@@ -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).");
   }
index ed9b59a..2793ca5 100644 (file)
@@ -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",
index d825ffe..3168044 100644 (file)
@@ -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)
index 520cd14..794fa3e 100644 (file)
@@ -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<unsigned long long>(1.0 / sg_surf_precision);
+  return static_cast<unsigned long long>(1.0 / sg_precision_timing);
 }
 
 unsigned long long smpi_rastro_timestamp ()
 {
   const SmpiBenchGuard suspend_bench;
-  return static_cast<unsigned long long>(simgrid::s4u::Engine::get_clock() / sg_surf_precision);
+  return static_cast<unsigned long long>(simgrid::s4u::Engine::get_clock() / sg_precision_timing);
 }
 
 /* ****************************** Functions related to the SMPI_SAMPLE_ macros ************************************/
index 83aa5f9..11faee7 100644 (file)
@@ -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);
index 954ae50..029965a 100644 (file)
@@ -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<CpuTiAction*>(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);
index 54e369e..c5f4aaf 100644 (file)
@@ -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<NetworkCm02Action*>(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;
       }
index 6183b2d..d11996d 100644 (file)
@@ -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;
       }
index 04fba51..10a2d01 100644 (file)
@@ -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);
index aaa77ed..01dddaf 100644 (file)
@@ -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());
index 564a2be..725e62e 100644 (file)
@@ -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);
       }
index 23bf1e7..b5dfbd3 100644 (file)
@@ -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<std::string, simgrid::kernel::profile::Profile*> traces_set_list;