Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Cleanup to allow separation of model specification and of optimization mode for each...
authorNavarrop <Pierre.Navarro@imag.fr>
Mon, 12 Dec 2011 11:35:00 +0000 (12:35 +0100)
committerNavarrop <Pierre.Navarro@imag.fr>
Fri, 16 Dec 2011 15:58:01 +0000 (16:58 +0100)
Clean some cruft in the comments.

src/include/surf/surf.h
src/surf/cpu_im.c
src/surf/surf.c
src/surf/surf_config.c
src/surf/workstation.c

index e50dd47..bc8b862 100644 (file)
@@ -338,6 +338,11 @@ XBT_PUBLIC_DATA(surf_model_t) surf_cpu_model;
 /** \brief Initializes the CPU model with the model Cas01
  *  \ingroup SURF_models
  *
 /** \brief Initializes the CPU model with the model Cas01
  *  \ingroup SURF_models
  *
+ *  By default, this model uses the lazy optimization mechanism that
+ *  relies on partial invalidation in LMM and a heap for lazy action update.
+ *  You can change this behavior by setting the cpu/optim configuration
+ *  variable to a different value.
+ *
  *  This function is called by surf_workstation_model_init_CLM03
  *  so you shouldn't have to call it by yourself.
  *
  *  This function is called by surf_workstation_model_init_CLM03
  *  so you shouldn't have to call it by yourself.
  *
@@ -345,21 +350,13 @@ XBT_PUBLIC_DATA(surf_model_t) surf_cpu_model;
  */
 XBT_PUBLIC(void) surf_cpu_model_init_Cas01(void);
 
  */
 XBT_PUBLIC(void) surf_cpu_model_init_Cas01(void);
 
-/** \brief Initializes the CPU model with trace integration
- *  \ingroup SURF_models
- *
- */
-XBT_PUBLIC(void) surf_cpu_model_init_ti(void);
-
-/** \brief Initializes the CPU model with the model Cas01 Improved. This model uses a heap to order the events, decreasing the time complexity to get the minimum next event.
+/** \brief Initializes the CPU model with trace integration [Deprecated]
  *  \ingroup SURF_models
  *
  *  \ingroup SURF_models
  *
- *  This function is called by surf_workstation_model_init_CLM03
- *  so you shouldn't have to call it by yourself.
- *
+ *  You shouldn't have to call it by yourself.
  *  \see surf_workstation_model_init_CLM03()
  */
  *  \see surf_workstation_model_init_CLM03()
  */
-XBT_PUBLIC(void) surf_cpu_model_init_Cas01_im(void);
+XBT_PUBLIC(void) surf_cpu_model_init_ti(void);
 
 /** \brief This function call the share resources function needed
  *
 
 /** \brief This function call the share resources function needed
  *
@@ -370,6 +367,13 @@ XBT_PUBLIC(double) generic_share_resources(double now);
  *
  */
 XBT_PUBLIC(void)   generic_update_actions_state(double now, double delta);
  *
  */
 XBT_PUBLIC(void)   generic_update_actions_state(double now, double delta);
+
+/** \brief The list of all available optimization modes (both for cpu and networks).
+ *  \ingroup SURF_models
+ *  These optimization modes can be set using --cfg=cpu/optim:... and --cfg=network/optim:...
+ */
+XBT_PUBLIC_DATA(s_surf_model_description_t) surf_optimization_mode_description[];
+
 /** \brief The list of all available cpu model models
  *  \ingroup SURF_models
  */
 /** \brief The list of all available cpu model models
  *  \ingroup SURF_models
  */
@@ -566,7 +570,6 @@ XBT_PUBLIC_DATA(surf_model_t) surf_workstation_model;
 
 /** \brief Initializes the platform with a compound workstation model
  *  \ingroup SURF_models
 
 /** \brief Initializes the platform with a compound workstation model
  *  \ingroup SURF_models
- *  \param filename XML platform file name
  *
  *  This function should be called after a cpu_model and a
  *  network_model have been set up.
  *
  *  This function should be called after a cpu_model and a
  *  network_model have been set up.
@@ -574,9 +577,20 @@ XBT_PUBLIC_DATA(surf_model_t) surf_workstation_model;
  */
 XBT_PUBLIC(void) surf_workstation_model_init_compound(void);
 
  */
 XBT_PUBLIC(void) surf_workstation_model_init_compound(void);
 
+/** \brief Initializes the platform with the current best network and cpu models at hand
+ *  \ingroup SURF_models
+ *
+ *  This platform model seperates the workstation model and the network model.
+ *  The workstation model will be initialized with the model compound, the network
+ *  model with the model LV08 (with cross traffic support) and the CPU model with
+ *  the model Cas01.
+ *  Such model is subject to modification with warning in the ChangeLog so monitor it!
+ *
+ */
+XBT_PUBLIC(void) surf_workstation_model_init_current_default(void);
+
 /** \brief Initializes the platform with the workstation model CLM03
  *  \ingroup SURF_models
 /** \brief Initializes the platform with the workstation model CLM03
  *  \ingroup SURF_models
- *  \param filename XML platform file name
  *
  *  This platform model seperates the workstation model and the network model.
  *  The workstation model will be initialized with the model CLM03, the network
  *
  *  This platform model seperates the workstation model and the network model.
  *  The workstation model will be initialized with the model CLM03, the network
@@ -584,26 +598,11 @@ XBT_PUBLIC(void) surf_workstation_model_init_compound(void);
  *  In future releases, some other network models will be implemented and will be
  *  combined with the workstation model CLM03.
  *
  *  In future releases, some other network models will be implemented and will be
  *  combined with the workstation model CLM03.
  *
- *  \see surf_workstation_model_init_KCCFLN05()
  */
 XBT_PUBLIC(void) surf_workstation_model_init_CLM03(void);
 
 /** \brief Initializes the platform with the model KCCFLN05
  *  \ingroup SURF_models
  */
 XBT_PUBLIC(void) surf_workstation_model_init_CLM03(void);
 
 /** \brief Initializes the platform with the model KCCFLN05
  *  \ingroup SURF_models
- *  \param filename XML platform file name
- *
- *  With this model, the workstations and the network are handled
- *  together. The network model is roughly the same as in CM02 but
- *  interference between computations and communications can be taken
- *  into account. This platform model is the default one for MSG and
- *  SimDag.
- *
- */
-XBT_PUBLIC(void) surf_workstation_model_init_KCCFLN05(void);
-
-/** \brief Initializes the platform with the model KCCFLN05
- *  \ingroup SURF_models
- *  \param filename XML platform file name
  *
  *  With this model, only parallel tasks can be used. Resource sharing
  *  is done by identifying bottlenecks and giving an equal share of
  *
  *  With this model, only parallel tasks can be used. Resource sharing
  *  is done by identifying bottlenecks and giving an equal share of
@@ -636,11 +635,9 @@ XBT_PUBLIC_DATA(xbt_cfg_t) _surf_cfg_set;
  *  This function has to be called to initialize the common
  *  structures.  Then you will have to create the environment by
  *  calling 
  *  This function has to be called to initialize the common
  *  structures.  Then you will have to create the environment by
  *  calling 
- *  e.g. surf_workstation_model_init_CLM03() or
- *  surf_workstation_model_init_KCCFLN05().
+ *  e.g. surf_workstation_model_init_CLM03()
  *
  *
- *  \see surf_workstation_model_init_CLM03(),
- *  surf_workstation_model_init_KCCFLN05(), surf_workstation_model_init_compound(), surf_exit()
+ *  \see surf_workstation_model_init_CLM03(), surf_workstation_model_init_compound(), surf_exit()
  */
 XBT_PUBLIC(void) surf_init(int *argc, char **argv);     /* initialize common structures */
 
  */
 XBT_PUBLIC(void) surf_init(int *argc, char **argv);     /* initialize common structures */
 
index 89ec8af..74815e3 100644 (file)
@@ -677,12 +677,27 @@ static void surf_cpu_im_model_init_internal(const char* name)
 /*                  \url{http://grail.sdsc.edu/papers/simgrid_ccgrid01.ps.gz}." */
 /* } */
 
 /*                  \url{http://grail.sdsc.edu/papers/simgrid_ccgrid01.ps.gz}." */
 /* } */
 
-void surf_cpu_model_init_Cas01_im()
+void surf_cpu_model_init_Cas01()
 {
 {
-  if( strcmp(xbt_cfg_get_string(_surf_cfg_set, "cpu/model"),"Cas01"))
-    cpu_update_mechanism = UM_LAZY;
-  else
+  char *optim = xbt_cfg_get_string(_surf_cfg_set, "cpu/optim");
+  char *model = xbt_cfg_get_string(_surf_cfg_set, "cpu/model");
+
+  if(!strcmp(model,"Cas01_fullupdate")) {
+    XBT_WARN("[*Deprecated*. Use --cfg=cpu/model:Cas01 with option --cfg=cpu/optim:Full instead.]");
+  } else if(!strcmp(model,"CpuTI")) {
+    XBT_WARN("[*Deprecated*. Use --cfg=cpu/model:Cas01 with option --cfg=cpu/optim:TI instead.]");
+  }
+
+  if(!strcmp(optim,"Full")) {
     cpu_update_mechanism = UM_FULL;
     cpu_update_mechanism = UM_FULL;
+  } else if (strcmp(optim,"Lazy")) {
+    cpu_update_mechanism = UM_LAZY;
+  } else if (strcmp(optim,"TI")) {
+    surf_cpu_model_init_ti();
+    return;
+  } else {
+    xbt_die("Unsupported optimization (%s) for this model",optim);
+  }
 
   if (surf_cpu_model)
     return;
 
   if (surf_cpu_model)
     return;
index 77c0fed..d995e20 100644 (file)
@@ -117,16 +117,16 @@ s_surf_model_description_t surf_network_model_description[] = {
    "Simplistic network model where all communication take a constant time (one second)",
    surf_network_model_init_Constant},
   {"CM02",
    "Simplistic network model where all communication take a constant time (one second)",
    surf_network_model_init_Constant},
   {"CM02",
-   "Realistic network model with lmm_solve and no correction factors",
+   "Legacy network model with lmm_solve (slow-start and bottleneck sharing with small bandwidth poorly modeled).",
    surf_network_model_init_CM02},
   {"LV08",
    surf_network_model_init_CM02},
   {"LV08",
-   "Realistic network model with lmm_solve, adequate correction factors (latency*=10.4, bandwidth*=.92, S=8775) and partial invalidation optimization",
+   "Realistic network model (slow-start modeled by multiplying latency by 10.4, bandwidth by .92 and bottleneck sharing uses a payload of S=8775 for evaluating RTT). Uses partial invalidation optimization of lmm system and a heap for action management by default (option --cfg=network/optim:Lazy)",
    im_surf_network_model_init_LegrandVelho},
    {"LV08_fullupdate",
    im_surf_network_model_init_LegrandVelho},
    {"LV08_fullupdate",
-    "Realistic network model wit lmm_solve, adequate correction factors (latency*=10.4, bandwidth*=.92, S=8775) but no further optimization. Should produce the same results as LV08, only slower.",
+    "Realistic network model (see LV08) [Deprecated. Use LV08 with option --cfg=network/optim:Full. The Full option updates all actions at every step, which may be useful for debug.]",
    im_surf_network_model_init_LegrandVelho},
   {"SMPI",
    im_surf_network_model_init_LegrandVelho},
   {"SMPI",
-   "Realistic network model with lmm_solve and correction factors on three intervals (< 1KiB, < 64 KiB, >= 64 KiB)",
+   "Realistic network model with lmm_solve specifically tailored for HPC setting (accurate modeling of slow start with correction factors on three intervals (< 1KiB, < 64 KiB, >= 64 KiB))",
    surf_network_model_init_SMPI},
 #ifdef HAVE_GTNETS
   {"GTNets",
    surf_network_model_init_SMPI},
 #ifdef HAVE_GTNETS
   {"GTNets",
@@ -139,32 +139,35 @@ s_surf_model_description_t surf_network_model_description[] = {
        surf_network_model_init_NS3},
 #endif
   {"Reno",
        surf_network_model_init_NS3},
 #endif
   {"Reno",
-   "Model using lagrange_solve instead of lmm_solve (experts only)",
+   "Model from Steven H. Low using lagrange_solve instead of lmm_solve (experts only; check the code for more info)",
    surf_network_model_init_Reno},
   {"Reno2",
    surf_network_model_init_Reno},
   {"Reno2",
-   "Model using lagrange_solve instead of lmm_solve (experts only)",
+   "Model from Steven H. Low using lagrange_solve instead of lmm_solve (experts only; check the code for more info)",
    surf_network_model_init_Reno2},
   {"Vegas",
    surf_network_model_init_Reno2},
   {"Vegas",
-   "Model using lagrange_solve instead of lmm_solve (experts only)",
+   "Model from Steven H. Low using lagrange_solve instead of lmm_solve (experts only; check the code for more info)",
    surf_network_model_init_Vegas},
   {NULL, NULL, NULL}      /* this array must be NULL terminated */
 };
 
 s_surf_model_description_t surf_cpu_model_description[] = {
    surf_network_model_init_Vegas},
   {NULL, NULL, NULL}      /* this array must be NULL terminated */
 };
 
 s_surf_model_description_t surf_cpu_model_description[] = {
-  {"Cas01_fullupdate", "CPU classical model time=size/power",
-   surf_cpu_model_init_Cas01_im},
+  {"Cas01_fullupdate", "CPU classical model time=size/power (Cas01). [Deprecated. Use Cas01 with option --cfg=cpu/optim:Full. The Full option updates all actions at every step, which may be useful for debug.]",
+   surf_cpu_model_init_Cas01},
   {"Cas01",
   {"Cas01",
-   "Variation of Cas01_fullupdate with partial invalidation optimization of lmm system. Should produce the same values, only faster",
-   surf_cpu_model_init_Cas01_im},
+   "CPU classical model time=size/power. Default version uses partial invalidation optimization of lmm system and a heap for action management (default option is --cfg=cpu/optim:Lazy)",
+   surf_cpu_model_init_Cas01},
   {"CpuTI",
   {"CpuTI",
-   "Variation of Cas01 with also trace integration. Should produce the same values, only faster if you use availability traces",
+   "CPU classical model time=size/power (Cas01). [Deprecated. Use Cas01 with option --cfg=cpu/optim:TI. The TI optimization is highly optimized when using traces]",
    surf_cpu_model_init_ti},
   {NULL, NULL,  NULL}      /* this array must be NULL terminated */
 };
 
 s_surf_model_description_t surf_workstation_model_description[] = {
    surf_cpu_model_init_ti},
   {NULL, NULL,  NULL}      /* this array must be NULL terminated */
 };
 
 s_surf_model_description_t surf_workstation_model_description[] = {
+  {"current_default",
+   "Curent default workstation model (may change with versions of SimGrid). Currently Cas01 and LV08 (with full duplex support) as CPU and Network",
+   surf_workstation_model_init_current_default},
   {"CLM03",
   {"CLM03",
-   "Default workstation model, using LV08 and CM02 as network and CPU",
+   "Default workstation model, using Cas01 and CM02 as CPU and Network",
    surf_workstation_model_init_CLM03},
   {"compound",
    "Workstation model allowing you to use other network and CPU models",
    surf_workstation_model_init_CLM03},
   {"compound",
    "Workstation model allowing you to use other network and CPU models",
@@ -174,6 +177,19 @@ s_surf_model_description_t surf_workstation_model_description[] = {
   {NULL, NULL, NULL}      /* this array must be NULL terminated */
 };
 
   {NULL, NULL, NULL}      /* this array must be NULL terminated */
 };
 
+s_surf_model_description_t surf_optimization_mode_description[] = {
+  {"Lazy",
+   "Lazy action management (partial invalidation in lmm + heap in action remaining).",
+   NULL},
+  {"TI",
+   "Trace integration. Highly optimized mode for the Cas01 model when using availability traces.",
+    NULL},
+  {"Full",
+   "Full update of remaining and variables. Slow but may be useful when debugging.",
+   NULL},
+  {NULL, NULL, NULL}      /* this array must be NULL terminated */
+};
+
 /** Displays the long description of all registered models, and quit */
 void model_help(const char *category, s_surf_model_description_t * table)
 {
 /** Displays the long description of all registered models, and quit */
 void model_help(const char *category, s_surf_model_description_t * table)
 {
index 7b25a55..dc156cb 100644 (file)
@@ -108,6 +108,25 @@ static void _surf_cfg_cb__cpu_model(const char *name, int pos)
   find_model_description(surf_cpu_model_description, val);
 }
 
   find_model_description(surf_cpu_model_description, val);
 }
 
+/* callback of the cpu/model variable */
+static void _surf_cfg_cb__optimization_mode(const char *name, int pos)
+{
+  char *val;
+
+  xbt_assert(_surf_init_status < 2,
+              "Cannot change the model after the initialization");
+
+  val = xbt_cfg_get_string(_surf_cfg_set, name);
+
+  if (!strcmp(val, "help")) {
+    model_help("optimization", surf_optimization_mode_description);
+    exit(0);
+  }
+
+  /* New Module missing */
+  find_model_description(surf_optimization_mode_description, val);
+}
+
 /* callback of the workstation_model variable */
 static void _surf_cfg_cb__network_model(const char *name, int pos)
 {
 /* callback of the workstation_model variable */
 static void _surf_cfg_cb__network_model(const char *name, int pos)
 {
@@ -295,6 +314,20 @@ void surf_config_init(int *argc, char **argv)
                      "cpu/model", description, xbt_cfgelm_string,
                      &default_value, 1, 1, &_surf_cfg_cb__cpu_model, NULL);
 
                      "cpu/model", description, xbt_cfgelm_string,
                      &default_value, 1, 1, &_surf_cfg_cb__cpu_model, NULL);
 
+    sprintf(description,
+            "The optimization modes to use for the CPU. Possible values: ");
+    p = description;
+    while (*(++p) != '\0');
+    for (i = 0; surf_optimization_mode_description[i].name; i++)
+      p += sprintf(p, "%s%s", (i == 0 ? "" : ", "),
+                   surf_optimization_mode_description[i].name);
+    sprintf(p,
+            ".\n       (use 'help' as a value to see the long description of each optimization mode)");
+    default_value = xbt_strdup("Lazy");
+    xbt_cfg_register(&_surf_cfg_set,
+                     "cpu/optim", description, xbt_cfgelm_string,
+                     &default_value, 1, 1, &_surf_cfg_cb__optimization_mode, NULL);
+
     sprintf(description,
             "The model to use for the network. Possible values: ");
     p = description;
     sprintf(description,
             "The model to use for the network. Possible values: ");
     p = description;
@@ -310,6 +343,20 @@ void surf_config_init(int *argc, char **argv)
                      &default_value, 1, 1, &_surf_cfg_cb__network_model,
                      NULL);
 
                      &default_value, 1, 1, &_surf_cfg_cb__network_model,
                      NULL);
 
+    sprintf(description,
+            "The optimization modes to use for the network. Possible values: ");
+    p = description;
+    while (*(++p) != '\0');
+    for (i = 0; surf_optimization_mode_description[i].name; i++)
+      p += sprintf(p, "%s%s", (i == 0 ? "" : ", "),
+                   surf_optimization_mode_description[i].name);
+    sprintf(p,
+            ".\n       (use 'help' as a value to see the long description of each optimization mode)");
+    default_value = xbt_strdup("Lazy");
+    xbt_cfg_register(&_surf_cfg_set,
+                     "network/optim", description, xbt_cfgelm_string,
+                     &default_value, 1, 1, &_surf_cfg_cb__optimization_mode, NULL);
+
     sprintf(description,
             "The model to use for the workstation. Possible values: ");
     p = description;
     sprintf(description,
             "The model to use for the workstation. Possible values: ");
     p = description;
index c1ca40f..843ea3b 100644 (file)
@@ -339,6 +339,16 @@ static void surf_workstation_model_init_internal(void)
 
 }
 
 
 }
 
+void surf_workstation_model_init_current_default(void)
+{
+  surf_workstation_model_init_internal();
+  surf_cpu_model_init_Cas01();
+  im_surf_network_model_init_LegrandVelho();
+
+  xbt_dynar_push(model_list, &surf_workstation_model);
+  sg_platf_postparse_add_cb(create_workstations);
+}
+
 /********************************************************************/
 /* The model used in MSG and presented at CCGrid03                  */
 /********************************************************************/
 /********************************************************************/
 /* The model used in MSG and presented at CCGrid03                  */
 /********************************************************************/
@@ -353,8 +363,8 @@ static void surf_workstation_model_init_internal(void)
 void surf_workstation_model_init_CLM03(void)
 {
   surf_workstation_model_init_internal();
 void surf_workstation_model_init_CLM03(void)
 {
   surf_workstation_model_init_internal();
-  surf_cpu_model_init_Cas01_im();
-  im_surf_network_model_init_LegrandVelho();
+  surf_cpu_model_init_Cas01();
+  surf_network_model_init_CM02();
 
   xbt_dynar_push(model_list, &surf_workstation_model);
   sg_platf_postparse_add_cb(create_workstations);
 
   xbt_dynar_push(model_list, &surf_workstation_model);
   sg_platf_postparse_add_cb(create_workstations);