Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
change TCP_gamma to not be a compilation-time #define, but a command line option
authormquinson <mquinson@48e7efb5-ca39-0410-a469-dd3cf9ba447f>
Fri, 26 Jun 2009 11:50:46 +0000 (11:50 +0000)
committermquinson <mquinson@48e7efb5-ca39-0410-a469-dd3cf9ba447f>
Fri, 26 Jun 2009 11:50:46 +0000 (11:50 +0000)
git-svn-id: svn+ssh://scm.gforge.inria.fr/svn/simgrid/simgrid/trunk@6367 48e7efb5-ca39-0410-a469-dd3cf9ba447f

ChangeLog
src/surf/network.c
src/surf/surf_config.c
src/surf/surf_private.h
src/surf/workstation_ptask_L07.c

index 24d1064..adb1b2d 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -50,12 +50,6 @@ SimGrid (3.4-svn) unstable; urgency=high
  SIMDAG:
   * Move the configuration infrastructure to surf
 
- XBT:
-  * Also include strbuff from xbt.h public header
-  * xbt_ex_display(): do not free the exception after displaying 
-    This allows to do more with the given exception afterward.
-    Users should call xbt_ex_free() themselves.
-    
  SMPI: 
   * Massive internal cleanups:
     - Store internal structures on processes instead of hosts (allows
@@ -71,6 +65,16 @@ SimGrid (3.4-svn) unstable; urgency=high
   * Compile the examples by default, and use them as regression tests
   * Implement MPI_Wtime()
   
+ SURF:
+  * TCP_gamma can now be specified as command line option using
+    --cfg=TCP_gamma:10000000.0
+  
+ XBT:
+  * Also include strbuff from xbt.h public header
+  * xbt_ex_display(): do not free the exception after displaying 
+    This allows to do more with the given exception afterward.
+    Users should call xbt_ex_free() themselves.
+    
  Build Chain:
   * Do not require doxygen in maintainer mode
 
index 1b960b7..ef69792 100644 (file)
@@ -473,13 +473,11 @@ static void update_resource_state(void *id,
       action->weight += delta;
       if (action->rate < 0)
         lmm_update_variable_bound(network_maxmin_system, action->variable,
-                                  SG_TCP_CTE_GAMMA / (2.0 *
-                                                      action->lat_current));
+                                  sg_tcp_gamma / (2.0 * action->lat_current));
       else
         lmm_update_variable_bound(network_maxmin_system, action->variable,
                                   min(action->rate,
-                                      SG_TCP_CTE_GAMMA / (2.0 *
-                                                          action->lat_current)));
+                                      sg_tcp_gamma / (2.0 * action->lat_current)));
       if (!(action->suspended))
         lmm_update_variable_weight(network_maxmin_system, action->variable,
                                    action->weight);
@@ -544,7 +542,7 @@ static surf_action_t communicate(void *src, void *dst, double size,
   action->generic_action.start = surf_get_clock();
   action->generic_action.finish = -1.0;
   action->generic_action.model_type = (surf_model_t) surf_network_model;
-  action->suspended = 0;        /* Should be useless because of the 
+  action->suspended = 0;        /* Should be useless because of the
                                    calloc but it seems to help valgrind... */
   action->generic_action.state_set =
     surf_network_model->common_public->states.running_action_set;
@@ -582,8 +580,7 @@ static surf_action_t communicate(void *src, void *dst, double size,
   if (action->rate < 0) {
     if (action->lat_current > 0)
       lmm_update_variable_bound(network_maxmin_system, action->variable,
-                                SG_TCP_CTE_GAMMA / (2.0 *
-                                                    action->lat_current));
+                                sg_tcp_gamma / (2.0 * action->lat_current));
     else
       lmm_update_variable_bound(network_maxmin_system, action->variable,
                                 -1.0);
@@ -591,8 +588,7 @@ static surf_action_t communicate(void *src, void *dst, double size,
     if (action->lat_current > 0)
       lmm_update_variable_bound(network_maxmin_system, action->variable,
                                 min(action->rate,
-                                    SG_TCP_CTE_GAMMA / (2.0 *
-                                                        action->lat_current)));
+                                    sg_tcp_gamma / (2.0 * action->lat_current)));
     else
       lmm_update_variable_bound(network_maxmin_system, action->variable,
                                 action->rate);
index 68ca07b..369cfa8 100644 (file)
@@ -15,6 +15,42 @@ XBT_LOG_NEW_DEFAULT_SUBCATEGORY(surf_config,surf,"About the configuration of sur
 
 xbt_cfg_t _surf_cfg_set = NULL;
 
+
+/* Parse the command line, looking for options */
+static void surf_config_cmd_line(int *argc,char **argv)
+{
+       int i, j;
+       char *opt;
+
+       for (i = 1; i < *argc; i++) {
+               int remove_it = 0;
+               if (!strncmp(argv[i], "--cfg=", strlen("--cfg="))) {
+                       opt = strchr(argv[i], '=');
+                       opt++;
+
+                       xbt_cfg_set_parse(_surf_cfg_set,opt);
+                       DEBUG1("Did apply '%s' as config setting", opt);
+                       remove_it = 1;
+               } else if (!strncmp(argv[i], "--cfg-help", strlen("--cfg-help")+1) ||
+                               !strncmp(argv[i], "--help", strlen("--help")+1)) {
+                       printf("Description of the configuration accepted by this simulator:\n");
+                       xbt_cfg_help(_surf_cfg_set);
+                       remove_it=1;
+                       exit(0);
+               }
+               if (remove_it) { /*remove this from argv */
+                       for (j = i + 1; j < *argc; j++) {
+                               argv[j - 1] = argv[j];
+                       }
+
+                       argv[j - 1] = NULL;
+                       (*argc)--;
+                       i--;                      /* compensate effect of next loop incrementation */
+               }
+       }
+}
+
+
 int _surf_init_status = 0;     /* 0: beginning of time;
                                   1: pre-inited (cfg_set created);
                                   2: inited (running) */
@@ -59,39 +95,13 @@ static void _surf_cfg_cb__network_model(const char *name, int pos)
        find_model_description(surf_network_model_description, val);
 }
 
-/* Parse the command line, looking for options */
-static void surf_config_cmd_line(int *argc,char **argv)
+/* callback of the cpu_model variable */
+static void _surf_cfg_cb__tcp_gamma(const char *name, int pos)
 {
-       int i, j;
-       char *opt;
-
-       for (i = 1; i < *argc; i++) {
-               int remove_it = 0;
-               if (!strncmp(argv[i], "--cfg=", strlen("--cfg="))) {
-                       opt = strchr(argv[i], '=');
-                       opt++;
+       sg_tcp_gamma =  xbt_cfg_get_double(_surf_cfg_set, name);
+}
 
-                       xbt_cfg_set_parse(_surf_cfg_set,opt);
-                       DEBUG1("Did apply '%s' as config setting", opt);
-                       remove_it = 1;
-               } else if (!strncmp(argv[i], "--cfg-help", strlen("--cfg-help")+1) ||
-                               !strncmp(argv[i], "--help", strlen("--help")+1)) {
-                       printf("Description of the configuration accepted by this simulator:\n");
-                       xbt_cfg_help(_surf_cfg_set);
-                       remove_it=1;
-                       exit(0);
-               }
-               if (remove_it) { /*remove this from argv */
-                       for (j = i + 1; j < *argc; j++) {
-                               argv[j - 1] = argv[j];
-                       }
 
-                       argv[j - 1] = NULL;
-                       (*argc)--;
-                       i--;                      /* compensate effect of next loop incrementation */
-               }
-       }
-}
 
 /* create the config set, register what should be and parse the command line*/
 void surf_config_init(int *argc, char **argv) {
@@ -134,6 +144,10 @@ void surf_config_init(int *argc, char **argv) {
                xbt_cfg_set_string(_surf_cfg_set, "cpu_model", "Cas01");
                xbt_cfg_set_string(_surf_cfg_set, "network_model", "CM02");
 
+               xbt_cfg_register(_surf_cfg_set,"TCP_gamma","Size of the biggest TCP window",1,1,
+                                       xbt_cfgelm_double,_surf_cfg_cb__tcp_gamma,NULL);
+               xbt_cfg_set_double(_surf_cfg_set, "TCP_gamma", 20000.0);
+
                surf_config_cmd_line(argc,argv);
        }
 }
index 3d742f6..139403c 100644 (file)
@@ -16,7 +16,7 @@
 #include "surf/random_mgr.h"
 
 #define NO_MAX_DURATION -1.0
-#define SG_TCP_CTE_GAMMA 20000.0
+double sg_tcp_gamma;
 
 extern const char *surf_action_state_names[6];
 
index d5d987e..caf3afe 100644 (file)
@@ -108,7 +108,7 @@ static void update_action_bound(surf_action_workstation_L07_t action)
       }
     }
   }
-  lat_bound = SG_TCP_CTE_GAMMA / (2.0 * lat_current);
+  lat_bound = sg_tcp_gamma / (2.0 * lat_current);
   DEBUG2("action (%p) : lat_bound = %g", action, lat_bound);
   if ((action->latency == 0.0) && (action->suspended == 0)) {
     if (action->rate < 0)
@@ -998,11 +998,11 @@ static void add_traces(void)
     link->lat_event = tmgr_history_add_trace(history, trace, 0.0, 0, link);
   }
 /*
-   
+
    xbt_dynar_foreach (traces_connect_list, cpt, value) {
      trace_connect = xbt_str_split_str(value, "#");
      trace_id        = xbt_dynar_get_as(trace_connect, 0, char*);
-     connect_element = atoi(xbt_dynar_get_as(trace_connect, 1, char*)); 
+     connect_element = atoi(xbt_dynar_get_as(trace_connect, 1, char*));
      connect_kind    = atoi(xbt_dynar_get_as(trace_connect, 2, char*));
      connector_id    = xbt_dynar_get_as(trace_connect, 3, char*);