Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
isolating latency bounded functions with ifdef's
authorschnorr <schnorr@48e7efb5-ca39-0410-a469-dd3cf9ba447f>
Thu, 30 Sep 2010 11:56:32 +0000 (11:56 +0000)
committerschnorr <schnorr@48e7efb5-ca39-0410-a469-dd3cf9ba447f>
Thu, 30 Sep 2010 11:56:32 +0000 (11:56 +0000)
details:
- to enable them, configure simgrid with enable_latency_bound_tracking set to ON

git-svn-id: svn+ssh://scm.gforge.inria.fr/svn/simgrid/simgrid/trunk@8304 48e7efb5-ca39-0410-a469-dd3cf9ba447f

15 files changed:
examples/msg/gtnets/gtnets.c
src/include/simix/simix.h
src/include/surf/maxmin.h
src/include/surf/surf.h
src/msg/task.c
src/simix/smx_action.c
src/simix/smx_network.c
src/surf/maxmin.c
src/surf/network.c
src/surf/network_constant.c
src/surf/network_gtnets.c
src/surf/network_private.h
src/surf/network_vivaldi.c
src/surf/surf_private.h
src/surf/workstation.c

index d25c64f..22adcee 100644 (file)
@@ -98,7 +98,9 @@ int slave(int argc, char *argv[])
   m_task_t task = NULL;
   int a;
   int id = 0;
+#ifdef HAVE_LATENCY_BOUND_TRACKING
   int limited_latency=0;
+#endif
   double remaining = 0;
   char id_alias[10];
 
@@ -124,21 +126,25 @@ int slave(int argc, char *argv[])
     for (id = 0; id < NTASKS; id++) {
       if (gl_task_array[id] == NULL) {
       } else if (gl_task_array[id] == task) {
+#ifdef HAVE_LATENCY_BOUND_TRACKING
          limited_latency = MSG_task_is_latency_bounded(gl_task_array[id]);
           if(limited_latency){
                  INFO1("WARNING FLOW[%d] is limited by latency!!", id);
           }
+#endif
          INFO5
           ("===> Estimated Bw of FLOW[%d] : %f ;  message from %s to %s  with remaining : %f",
            id, gl_data_size[id] / elapsed_time, masternames[id],
            slavenames[id], 0.0);
       } else {
         remaining = MSG_task_get_remaining_communication(gl_task_array[id]);
+#ifdef HAVE_LATENCY_BOUND_TRACKING
        limited_latency = MSG_task_is_latency_bounded(gl_task_array[id]);
 
         if(limited_latency){
          INFO1("WARNING FLOW[%d] is limited by latency!!", id);
         }
+#endif
         INFO5
           ("===> Estimated Bw of FLOW[%d] : %f ;  message from %s to %s  with remaining : %f",
            id, (gl_data_size[id] - remaining) / elapsed_time, masternames[id],
index 325a5df..6ce4cf1 100644 (file)
@@ -184,7 +184,9 @@ XBT_INLINE XBT_PUBLIC(void) SIMIX_unregister_action_to_semaphore(smx_action_t ac
 
 
 XBT_PUBLIC(double) SIMIX_action_get_remains(smx_action_t action);
+#ifdef HAVE_LATENCY_BOUND_TRACKING
 XBT_PUBLIC(int) SIMIX_action_is_latency_bounded(smx_action_t action);
+#endif
 
 XBT_PUBLIC(e_surf_action_state_t) SIMIX_action_get_state(smx_action_t action);
 
@@ -217,7 +219,9 @@ XBT_PUBLIC(void*) SIMIX_rdv_get_data(smx_rdv_t rdv);
 XBT_INLINE XBT_PUBLIC(void) SIMIX_communication_cancel(smx_comm_t comm);
 XBT_PUBLIC(void) SIMIX_communication_destroy(smx_comm_t comm);
 XBT_PUBLIC(double) SIMIX_communication_get_remains(smx_comm_t comm);
+#ifdef HAVE_LATENCY_BOUND_TRACKING
 XBT_PUBLIC(int)    SIMIX_communication_is_latency_bounded(smx_comm_t comm);
+#endif
 XBT_PUBLIC(void *) SIMIX_communication_get_data(smx_comm_t comm);
 
 XBT_PUBLIC(void *) SIMIX_communication_get_src_buf(smx_comm_t comm);
index 0de4266..383f11a 100644 (file)
@@ -67,8 +67,9 @@ XBT_PUBLIC(void) lmm_expand(lmm_system_t sys, lmm_constraint_t cnst,
      lmm_constraint_t lmm_get_first_active_constraint(lmm_system_t sys);
      lmm_constraint_t lmm_get_next_active_constraint(lmm_system_t sys,
                                                      lmm_constraint_t cnst);
-
+#ifdef HAVE_LATENCY_BOUND_TRACKING
      XBT_PUBLIC(int) lmm_is_variable_limited_by_latency(lmm_variable_t var);
+#endif
 
      void *lmm_constraint_id(lmm_constraint_t cnst);
      void *lmm_variable_id(lmm_variable_t var);
index 4567504..55e83c0 100644 (file)
@@ -73,7 +73,9 @@ XBT_PUBLIC(void) model_help(const char* category, s_surf_model_description_t * t
                                   the task is completed) */
        double remains;          /**< How much of that cost remains to
                                 * be done in the currently running task */
+#ifdef HAVE_LATENCY_BOUND_TRACKING
        int latency_limited;          /**< Set to 1 if is limited by latency, 0 otherwise */
+#endif
 
        double start;            /**< start time  */
        double finish;           /**< finish time : this is modified during the run
@@ -274,7 +276,9 @@ XBT_PUBLIC_DATA(routing_global_t) global_routing;
        void (*set_max_duration) (surf_action_t action, double duration);/**< Set the max duration of an action*/
        void (*set_priority) (surf_action_t action, double priority);/**< Set the priority of an action */
        double (*get_remains) (surf_action_t action);/**< Get the remains of an action */
+#ifdef HAVE_LATENCY_BOUND_TRACKING
        int (*get_latency_limited) (surf_action_t action);/**< Return 1 if action is limited by latency, 0 otherwise */
+#endif
 
        xbt_dict_t resource_set;
 
index 144494a..aed326f 100644 (file)
@@ -274,6 +274,7 @@ double MSG_task_get_remaining_communication(m_task_t task)
   return SIMIX_communication_get_remains(task->simdata->comm);
 }
 
+#ifdef HAVE_LATENCY_BOUND_TRACKING
 /** \ingroup m_task_management
  * \brief Return 1 if communication task is limited by latency, 0 otherwise
  *
@@ -285,6 +286,7 @@ int MSG_task_is_latency_bounded(m_task_t task)
        DEBUG1("calling SIMIX_communication_is_latency_bounded(%p)", task->simdata->comm);
        return SIMIX_communication_is_latency_bounded(task->simdata->comm);
 }
+#endif
 
 /** \ingroup m_task_management
  * \brief Returns the size of the data attached to a task #m_task_t.
index ce3ba8a..1c470ef 100644 (file)
@@ -374,11 +374,13 @@ XBT_INLINE double SIMIX_action_get_remains(smx_action_t action)
   return surf_workstation_model->get_remains(action->surf_action);
 }
 
+#ifdef HAVE_LATENCY_BOUND_TRACKING
 XBT_INLINE int SIMIX_action_is_latency_bounded(smx_action_t action)
 {
   xbt_assert0((action != NULL), "Invalid parameter");
   return surf_workstation_model->get_latency_limited(action->surf_action);
 }
+#endif
 
 smx_action_t SIMIX_action_parallel_execute(char *name, int host_nb,
                                            smx_host_t * host_list,
index 8c8b16d..3c3ef25 100644 (file)
@@ -11,7 +11,9 @@
 
 /* Pimple to get an histogram of message sizes in the simulation */
 xbt_dict_t msg_sizes = NULL;
+#ifdef HAVE_LATENCY_BOUND_TRACKING
 xbt_dict_t latency_limited_dict = NULL;
+#endif
 
 XBT_LOG_NEW_DEFAULT_SUBCATEGORY(simix_network, simix,
                                 "Logging specific to SIMIX (network)");
@@ -162,6 +164,7 @@ void SIMIX_communication_destroy(smx_comm_t comm)
 {
   VERB2("Destroy communication %p; refcount initially %d",comm,comm->refcount);
 
+#ifdef HAVE_LATENCY_BOUND_TRACKING
   //save is latency limited flag to use afterwards
   if (latency_limited_dict == NULL) {
          latency_limited_dict = xbt_dict_new();
@@ -170,6 +173,7 @@ void SIMIX_communication_destroy(smx_comm_t comm)
     DEBUG2("adding key %p with latency limited value %d to the dict", comm, SIMIX_action_is_latency_bounded(comm->act));
     xbt_dicti_set(latency_limited_dict, (uintptr_t)comm, SIMIX_action_is_latency_bounded(comm->act));
   }
+#endif
 
   comm->refcount--;
   if(comm->refcount > 0)
@@ -360,6 +364,7 @@ XBT_INLINE double SIMIX_communication_get_remains(smx_comm_t comm)
   return SIMIX_action_get_remains(comm->act);
 }  
 
+#ifdef HAVE_LATENCY_BOUND_TRACKING
 /**
  *  \brief verify if communication is latency bounded
  *  \param comm The communication
@@ -381,6 +386,7 @@ XBT_INLINE int SIMIX_communication_is_latency_bounded(smx_comm_t comm)
   DEBUG1("calling SIMIX_action_is_latency_bounded(%p)", comm->act);
   return SIMIX_action_is_latency_bounded(comm->act);
 }
+#endif
 
 /******************************************************************************/
 /*                    SIMIX_network_copy_data callbacks                       */
index c35b519..accceb5 100644 (file)
@@ -723,10 +723,12 @@ XBT_INLINE lmm_constraint_t lmm_get_next_active_constraint(lmm_system_t sys,
   return xbt_swag_getNext(cnst, (sys->active_constraint_set).offset);
 }
 
+#ifdef HAVE_LATENCY_BOUND_TRACKING
 XBT_INLINE int lmm_is_variable_limited_by_latency(lmm_variable_t var)
 {
   return (double_equals(var->bound, var->value));
 }
+#endif
 
 
 /** \brief Update the constraint set propagating recursively to
index 262dacc..66d886a 100644 (file)
@@ -275,10 +275,12 @@ void net_action_recycle(surf_action_t action)
   return;
 }
 
+#ifdef HAVE_LATENCY_BOUND_TRACKING
 int net_get_link_latency(surf_action_t action)
 {
   return action->latency_limited;
 }
+#endif
 
 double net_action_get_remains(surf_action_t action)
 {
@@ -300,11 +302,13 @@ static double net_share_resources(double now)
 #define VARIABLE(action) (*((lmm_variable_t*)(((char *) (action)) + xbt_swag_offset(s_action, variable)  )))
 
   xbt_swag_foreach(action, running_actions) {
-       if( lmm_is_variable_limited_by_latency(action->variable) ){
-               (action->generic_action).latency_limited = 1;
-       }else{
-               (action->generic_action).latency_limited = 0;
-       }
+#ifdef HAVE_LATENCY_BOUND_TRACKING
+    if( lmm_is_variable_limited_by_latency(action->variable) ){
+      (action->generic_action).latency_limited = 1;
+    }else{
+      (action->generic_action).latency_limited = 0;
+    }
+#endif
     if (action->latency > 0) {
       if (min < 0)
         min = action->latency;
@@ -515,7 +519,9 @@ static surf_action_t net_communicate(const char *src_name, const char *dst_name,
   action =
     surf_action_new(sizeof(s_surf_action_network_CM02_t), size,
                     surf_network_model, failed);
+#ifdef HAVE_LATENCY_BOUND_TRACKING
   (action->generic_action).latency_limited = 0;
+#endif
 
   xbt_swag_insert(action, action->generic_action.state_set);
   action->rate = rate;
@@ -660,7 +666,9 @@ static void surf_network_model_init_internal(void)
   surf_network_model->action_cancel = net_action_cancel;
   surf_network_model->action_recycle = net_action_recycle;
   surf_network_model->get_remains = net_action_get_remains;
+#ifdef HAVE_LATENCY_BOUND_TRACKING
   surf_network_model->get_latency_limited = net_get_link_latency;
+#endif
 
   surf_network_model->model_private->resource_used = net_resource_used;
   surf_network_model->model_private->share_resources = net_share_resources;
index 8983d39..d12b9ef 100644 (file)
@@ -194,7 +194,9 @@ void surf_network_model_init_Constant(const char *filename)
   surf_network_model->action_cancel = netcste_action_cancel;
   surf_network_model->action_recycle = net_action_recycle;
   surf_network_model->get_remains = net_action_get_remains;
+#ifdef HAVE_LATENCY_BOUND_TRACKING
   surf_network_model->get_latency_limited = net_get_link_latency;
+#endif
 
   surf_network_model->model_private->resource_used = netcste_resource_used;
   surf_network_model->model_private->share_resources = netcste_share_resources;
index a068ec9..7076f77 100644 (file)
@@ -404,9 +404,11 @@ static void surf_network_model_init_internal(void)
   routing_model_create(sizeof(network_link_GTNETS_t), NULL);
 }
 
+#ifdef HAVE_LATENCY_BOUND_TRACKING
 static int get_latency_limited(surf_action_t action){
        return 0;
 }
+#endif
 
 #ifdef HAVE_GTNETS
 void surf_network_model_init_GTNETS(const char *filename)
@@ -417,7 +419,9 @@ void surf_network_model_init_GTNETS(const char *filename)
   define_callbacks(filename);
   xbt_dynar_push(model_list, &surf_network_model);
 
+#ifdef HAVE_LATENCY_BOUND_TRACKING
   surf_network_model->get_latency_limited = get_latency_limited;
+#endif
 
   if(sg_gtnets_jitter > 0.0){
          gtnets_set_jitter(sg_gtnets_jitter);
index ad2af8e..8ce2e6b 100644 (file)
@@ -27,7 +27,9 @@ typedef struct surf_action_network_CM02 {
   double weight;
   lmm_variable_t variable;
   double rate;
+#ifdef HAVE_LATENCY_BOUND_TRACKING
   int latency_limited;
+#endif
   int suspended;
 
 #ifdef HAVE_TRACING
index 852d333..1631827 100644 (file)
@@ -214,9 +214,12 @@ static void netviva_parse_host(void) {
   xbt_dict_set(coords, A_surfxml_host_id,coord,NULL);
 }
 
+#ifdef HAVE_LATENCY_BOUND_TRACKING
 static int netviva_get_latency_limited(surf_action_t action){
   return 0;
 }
+#endif
+
 void surf_network_model_init_Vivaldi(const char *filename)
 {
   xbt_assert(surf_network_model == NULL);
@@ -231,7 +234,9 @@ void surf_network_model_init_Vivaldi(const char *filename)
   surf_network_model->action_cancel = netviva_action_cancel;
   surf_network_model->action_recycle = netviva_action_recycle;
   surf_network_model->get_remains = netviva_action_get_remains;
+#ifdef HAVE_LATENCY_BOUND_TRACKING
   surf_network_model->get_latency_limited = netviva_get_latency_limited;
+#endif
 
   surf_network_model->model_private->resource_used = netviva_resource_used;
   surf_network_model->model_private->share_resources = netviva_share_resources;
index 9be1165..e17fb3e 100644 (file)
@@ -66,7 +66,9 @@ void surf_config(const char *name, va_list pa);
 
 void net_action_recycle(surf_action_t action);
 double net_action_get_remains(surf_action_t action);
+#ifdef HAVE_LATENCY_BOUND_TRACKING
 int net_get_link_latency(surf_action_t action);
+#endif
 void net_action_set_max_duration(surf_action_t action, double duration);
 /*
  * Returns the initial path. On Windows the initial path is
index 08365bd..ba94803 100644 (file)
@@ -178,6 +178,7 @@ static void ws_action_set_priority(surf_action_t action, double priority)
     DIE_IMPOSSIBLE;
 }
 
+#ifdef HAVE_LATENCY_BOUND_TRACKING
 static int ws_get_latency_limited(surf_action_t action)
 {
   if (action->model_type == surf_network_model)
@@ -185,6 +186,7 @@ static int ws_get_latency_limited(surf_action_t action)
   INFO0("You tried to ask if a non network action is limited by latency, aborting...");
   DIE_IMPOSSIBLE;
 }
+#endif
 
 static double ws_action_get_remains(surf_action_t action)
 {
@@ -291,7 +293,9 @@ static void surf_workstation_model_init_internal(void)
   surf_workstation_model->set_max_duration = ws_action_set_max_duration;
   surf_workstation_model->set_priority = ws_action_set_priority;
   surf_workstation_model->get_remains = ws_action_get_remains;
+#ifdef HAVE_LATENCY_BOUND_TRACKING
   surf_workstation_model->get_latency_limited = ws_get_latency_limited;
+#endif
 
   surf_workstation_model->extension.workstation.execute = ws_execute;
   surf_workstation_model->extension.workstation.sleep = ws_action_sleep;