From e73dc2efae11f86d0054e1a3f08eee1a0ca5797f Mon Sep 17 00:00:00 2001 From: alegrand Date: Mon, 25 Jul 2005 16:07:22 +0000 Subject: [PATCH] do not create a parallel task is it does not consume any resource... Return immediately instead. git-svn-id: svn+ssh://scm.gforge.inria.fr/svn/simgrid/simgrid/trunk@1567 48e7efb5-ca39-0410-a469-dd3cf9ba447f --- src/msg/gos.c | 8 ++++++-- src/surf/workstation.c | 29 ++++++++++++++++++----------- 2 files changed, 24 insertions(+), 13 deletions(-) diff --git a/src/msg/gos.c b/src/msg/gos.c index 2e82c5aa5d..5c0092e789 100644 --- a/src/msg/gos.c +++ b/src/msg/gos.c @@ -490,7 +490,8 @@ static void __MSG_parallel_task_execute(m_process_t process, m_task_t task) task->simdata->comm_amount, 1.0, -1.0); - surf_workstation_resource->common_public->action_set_data(simdata->compute,task); + if(simdata->compute) + surf_workstation_resource->common_public->action_set_data(simdata->compute,task); } MSG_error_t MSG_parallel_task_execute(m_task_t task) @@ -502,7 +503,10 @@ MSG_error_t MSG_parallel_task_execute(m_task_t task) __MSG_parallel_task_execute(process, task); - res = __MSG_wait_for_computation(process,task); + if(simdata->compute) + res = __MSG_wait_for_computation(process,task); + else + res = MSG_OK; return res; } diff --git a/src/surf/workstation.c b/src/surf/workstation.c index d98db1f2b3..2f4aef5263 100644 --- a/src/surf/workstation.c +++ b/src/surf/workstation.c @@ -285,6 +285,7 @@ static surf_action_t execute_parallel_task (int workstation_nb, xbt_dict_cursor_t cursor = NULL; char *name = NULL; int nb_link = 0; + int nb_host = 0; network_link_CM02_t link; /* Compute the number of affected resources... */ @@ -295,17 +296,25 @@ static surf_action_t execute_parallel_task (int workstation_nb, int route_size = ROUTE_SIZE(card_src->id, card_dst->id); network_link_CM02_t *route = ROUTE(card_src->id, card_dst->id); - if(communication_amount[i*workstation_nb+j]>=0) + if(communication_amount[i*workstation_nb+j]>0) for(k=0; k< route_size; k++) { xbt_dict_set(network_link_set, route[k]->name, route[k], NULL); } } } - + xbt_dict_foreach(network_link_set, cursor, name, link) { nb_link++; } - + + xbt_dict_free(&network_link_set); + + for (i = 0; i0) nb_host++; + + if(nb_link + workstation_nb == 0) + return NULL; + action = xbt_new0(s_surf_action_parallel_task_CSL05_t, 1); action->generic_action.using = 1; action->generic_action.cost = amount; @@ -325,17 +334,15 @@ static surf_action_t execute_parallel_task (int workstation_nb, if(action->rate>0) action->variable = lmm_variable_new(maxmin_system, action, 1.0, -1.0, - workstation_nb + nb_link); + nb_host + nb_link); else action->variable = lmm_variable_new(maxmin_system, action, 1.0, action->rate, - workstation_nb + nb_link); - - if(nb_link + workstation_nb == 0) - action_change_state((surf_action_t) action, SURF_ACTION_DONE); + nb_host + nb_link); for (i = 0; icpu)->constraint, - action->variable, computation_amount[i]); + if(computation_amount[i]>0) + lmm_expand(maxmin_system, ((cpu_Cas01_t) ((workstation_CLM03_t) workstation_list[i])->cpu)->constraint, + action->variable, computation_amount[i]); for (i=0; iid, card_dst->id); for(k=0; k< route_size; k++) { - if(communication_amount[i*workstation_nb+j]>=0) { + if(communication_amount[i*workstation_nb+j]>0) { lmm_expand_add(maxmin_system, route[k]->constraint, action->variable, communication_amount[i*workstation_nb+j]); } -- 2.20.1