Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
cosmetics
authorMartin Quinson <martin.quinson@loria.fr>
Sun, 8 Jul 2018 22:43:47 +0000 (00:43 +0200)
committerMartin Quinson <martin.quinson@loria.fr>
Mon, 9 Jul 2018 04:46:40 +0000 (06:46 +0200)
src/surf/network_cm02.cpp
src/surf/network_ib.cpp
src/surf/network_ns3.cpp
src/surf/ptask_L07.cpp
src/surf/sg_platf.cpp

index 72d1a9a..7adee01 100644 (file)
@@ -34,8 +34,7 @@ double sg_weight_S_parameter = 0.0;     /* default value; can be set by model or
 /*  } */
 void surf_network_model_init_LegrandVelho()
 {
 /*  } */
 void surf_network_model_init_LegrandVelho()
 {
-  if (surf_network_model)
-    return;
+  xbt_assert(surf_network_model == nullptr, "Cannot set the network model twice");
 
   surf_network_model = new simgrid::kernel::resource::NetworkCm02Model();
   all_existing_models->push_back(surf_network_model);
 
   surf_network_model = new simgrid::kernel::resource::NetworkCm02Model();
   all_existing_models->push_back(surf_network_model);
@@ -58,8 +57,7 @@ void surf_network_model_init_LegrandVelho()
 /* } */
 void surf_network_model_init_CM02()
 {
 /* } */
 void surf_network_model_init_CM02()
 {
-  if (surf_network_model)
-    return;
+  xbt_assert(surf_network_model == nullptr, "Cannot set the network model twice");
 
   simgrid::config::set_default<double>("network/latency-factor", 1.0);
   simgrid::config::set_default<double>("network/bandwidth-factor", 1.0);
 
   simgrid::config::set_default<double>("network/latency-factor", 1.0);
   simgrid::config::set_default<double>("network/bandwidth-factor", 1.0);
@@ -81,8 +79,7 @@ void surf_network_model_init_CM02()
 /*  }                                                                      */
 void surf_network_model_init_Reno()
 {
 /*  }                                                                      */
 void surf_network_model_init_Reno()
 {
-  if (surf_network_model)
-    return;
+  xbt_assert(surf_network_model == nullptr, "Cannot set the network model twice");
 
   namespace lmm = simgrid::kernel::lmm;
   lmm::Lagrange::set_default_protocol_function(lmm::func_reno_f, lmm::func_reno_fp, lmm::func_reno_fpi);
 
   namespace lmm = simgrid::kernel::lmm;
   lmm::Lagrange::set_default_protocol_function(lmm::func_reno_f, lmm::func_reno_fp, lmm::func_reno_fpi);
@@ -98,8 +95,7 @@ void surf_network_model_init_Reno()
 
 void surf_network_model_init_Reno2()
 {
 
 void surf_network_model_init_Reno2()
 {
-  if (surf_network_model)
-    return;
+  xbt_assert(surf_network_model == nullptr, "Cannot set the network model twice");
 
   namespace lmm = simgrid::kernel::lmm;
   lmm::Lagrange::set_default_protocol_function(lmm::func_reno2_f, lmm::func_reno2_fp, lmm::func_reno2_fpi);
 
   namespace lmm = simgrid::kernel::lmm;
   lmm::Lagrange::set_default_protocol_function(lmm::func_reno2_f, lmm::func_reno2_fp, lmm::func_reno2_fpi);
@@ -114,8 +110,7 @@ void surf_network_model_init_Reno2()
 
 void surf_network_model_init_Vegas()
 {
 
 void surf_network_model_init_Vegas()
 {
-  if (surf_network_model)
-    return;
+  xbt_assert(surf_network_model == nullptr, "Cannot set the network model twice");
 
   namespace lmm = simgrid::kernel::lmm;
   lmm::Lagrange::set_default_protocol_function(lmm::func_vegas_f, lmm::func_vegas_fp, lmm::func_vegas_fpi);
 
   namespace lmm = simgrid::kernel::lmm;
   lmm::Lagrange::set_default_protocol_function(lmm::func_vegas_f, lmm::func_vegas_fp, lmm::func_vegas_fpi);
index a633584..d672a8d 100644 (file)
@@ -85,8 +85,7 @@ static void IB_action_init_callback(simgrid::kernel::resource::NetworkAction* ac
 /*  } */
 void surf_network_model_init_IB()
 {
 /*  } */
 void surf_network_model_init_IB()
 {
-  if (surf_network_model)
-    return;
+  xbt_assert(surf_network_model == nullptr, "Cannot set the network model twice");
 
   surf_network_model = new simgrid::kernel::resource::NetworkIBModel();
   all_existing_models->push_back(surf_network_model);
 
   surf_network_model = new simgrid::kernel::resource::NetworkIBModel();
   all_existing_models->push_back(surf_network_model);
index bc8a59a..cfc5864 100644 (file)
@@ -136,8 +136,7 @@ static void postparse_cb()
  *********/
 void surf_network_model_init_NS3()
 {
  *********/
 void surf_network_model_init_NS3()
 {
-  if (surf_network_model)
-    return;
+  xbt_assert(surf_network_model == nullptr, "Cannot set the network model twice");
 
   surf_network_model = new simgrid::kernel::resource::NetworkNS3Model();
   all_existing_models->push_back(surf_network_model);
 
   surf_network_model = new simgrid::kernel::resource::NetworkNS3Model();
   all_existing_models->push_back(surf_network_model);
index 36a7e0f..f0deae5 100644 (file)
@@ -18,8 +18,8 @@ XBT_LOG_EXTERNAL_CATEGORY(xbt_cfg);
 void surf_host_model_init_ptask_L07()
 {
   XBT_CINFO(xbt_cfg,"Switching to the L07 model to handle parallel tasks.");
 void surf_host_model_init_ptask_L07()
 {
   XBT_CINFO(xbt_cfg,"Switching to the L07 model to handle parallel tasks.");
-  xbt_assert(not surf_cpu_model_pm, "CPU model type already defined");
-  xbt_assert(not surf_network_model, "network model type already defined");
+  xbt_assert(not surf_cpu_model_pm, "Cannot switch to ptasks: CPU model already defined");
+  xbt_assert(not surf_network_model, "Cannot switch to ptasks: network model already defined");
 
   surf_host_model = new simgrid::surf::HostL07Model();
   all_existing_models->push_back(surf_host_model);
 
   surf_host_model = new simgrid::surf::HostL07Model();
   all_existing_models->push_back(surf_host_model);
index accf45b..3343bfc 100644 (file)
@@ -549,11 +549,11 @@ simgrid::kernel::routing::NetZoneImpl* sg_platf_new_Zone_begin(simgrid::kernel::
     simgrid::s4u::on_platform_creation();
 
     /* Initialize the surf models. That must be done after we got all config, and before we need the models.
     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 <config> tag, if any, and before the first of cluster|peer|AS|trace|trace_connect
+     * That is, after the last <config> tag, if any, and before the first of cluster|peer|zone|trace|trace_connect
      *
      * I'm not sure for <trace> and <trace_connect>, there may be a bug here
      * (FIXME: check it out by creating a file beginning with one of these tags)
      *
      * I'm not sure for <trace> and <trace_connect>, there may be a bug here
      * (FIXME: check it out by creating a file beginning with one of these tags)
-     * but cluster and peer create ASes internally, so putting the code in there is ok.
+     * but cluster and peer come down to zone creations, so putting this verification here is correct.
      */
     surf_parse_models_setup_already_called = 1;
     surf_config_models_setup();
      */
     surf_parse_models_setup_already_called = 1;
     surf_config_models_setup();