From 7cb1f8f04ea7ad3bf6a0eedec6f8e28e3f961970 Mon Sep 17 00:00:00 2001 From: schnorr Date: Thu, 30 Sep 2010 11:56:32 +0000 Subject: [PATCH] isolating latency bounded functions with ifdef's 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 --- examples/msg/gtnets/gtnets.c | 6 ++++++ src/include/simix/simix.h | 4 ++++ src/include/surf/maxmin.h | 3 ++- src/include/surf/surf.h | 4 ++++ src/msg/task.c | 2 ++ src/simix/smx_action.c | 2 ++ src/simix/smx_network.c | 6 ++++++ src/surf/maxmin.c | 2 ++ src/surf/network.c | 18 +++++++++++++----- src/surf/network_constant.c | 2 ++ src/surf/network_gtnets.c | 4 ++++ src/surf/network_private.h | 2 ++ src/surf/network_vivaldi.c | 5 +++++ src/surf/surf_private.h | 2 ++ src/surf/workstation.c | 4 ++++ 15 files changed, 60 insertions(+), 6 deletions(-) diff --git a/examples/msg/gtnets/gtnets.c b/examples/msg/gtnets/gtnets.c index d25c64f934..22adcee44a 100644 --- a/examples/msg/gtnets/gtnets.c +++ b/examples/msg/gtnets/gtnets.c @@ -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], diff --git a/src/include/simix/simix.h b/src/include/simix/simix.h index 325a5df296..6ce4cf178a 100644 --- a/src/include/simix/simix.h +++ b/src/include/simix/simix.h @@ -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); diff --git a/src/include/surf/maxmin.h b/src/include/surf/maxmin.h index 0de4266d61..383f11a826 100644 --- a/src/include/surf/maxmin.h +++ b/src/include/surf/maxmin.h @@ -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); diff --git a/src/include/surf/surf.h b/src/include/surf/surf.h index 456750487d..55e83c0af1 100644 --- a/src/include/surf/surf.h +++ b/src/include/surf/surf.h @@ -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; diff --git a/src/msg/task.c b/src/msg/task.c index 144494a1a1..aed326f71c 100644 --- a/src/msg/task.c +++ b/src/msg/task.c @@ -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. diff --git a/src/simix/smx_action.c b/src/simix/smx_action.c index ce3ba8af36..1c470ef6d7 100644 --- a/src/simix/smx_action.c +++ b/src/simix/smx_action.c @@ -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, diff --git a/src/simix/smx_network.c b/src/simix/smx_network.c index 8c8b16d1d7..3c3ef25962 100644 --- a/src/simix/smx_network.c +++ b/src/simix/smx_network.c @@ -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 */ diff --git a/src/surf/maxmin.c b/src/surf/maxmin.c index c35b51936f..accceb5c93 100644 --- a/src/surf/maxmin.c +++ b/src/surf/maxmin.c @@ -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 diff --git a/src/surf/network.c b/src/surf/network.c index 262dacca13..66d886ab20 100644 --- a/src/surf/network.c +++ b/src/surf/network.c @@ -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; diff --git a/src/surf/network_constant.c b/src/surf/network_constant.c index 8983d39777..d12b9efc06 100644 --- a/src/surf/network_constant.c +++ b/src/surf/network_constant.c @@ -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; diff --git a/src/surf/network_gtnets.c b/src/surf/network_gtnets.c index a068ec9b6d..7076f77760 100644 --- a/src/surf/network_gtnets.c +++ b/src/surf/network_gtnets.c @@ -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); diff --git a/src/surf/network_private.h b/src/surf/network_private.h index ad2af8e0c6..8ce2e6b353 100644 --- a/src/surf/network_private.h +++ b/src/surf/network_private.h @@ -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 diff --git a/src/surf/network_vivaldi.c b/src/surf/network_vivaldi.c index 852d333c16..163182798c 100644 --- a/src/surf/network_vivaldi.c +++ b/src/surf/network_vivaldi.c @@ -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; diff --git a/src/surf/surf_private.h b/src/surf/surf_private.h index 9be116555f..e17fb3e732 100644 --- a/src/surf/surf_private.h +++ b/src/surf/surf_private.h @@ -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 diff --git a/src/surf/workstation.c b/src/surf/workstation.c index 08365bd080..ba94803a1b 100644 --- a/src/surf/workstation.c +++ b/src/surf/workstation.c @@ -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; -- 2.20.1