X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/5afc65bd97bab6b7995d028d97d344bd10cf9c2d..c882e24932c718fad85c22cb546f30e158f1b31d:/src/simdag/sd_task.c diff --git a/src/simdag/sd_task.c b/src/simdag/sd_task.c index 0b7e382a76..f0cf1c3a96 100644 --- a/src/simdag/sd_task.c +++ b/src/simdag/sd_task.c @@ -239,13 +239,13 @@ void SD_task_destroy(SD_task_t task) xbt_free(task->communication_amount); xbt_free(task->computation_amount); - xbt_mallocator_release(sd_global->task_mallocator,task); - sd_global->task_number--; - #ifdef HAVE_TRACING if (task->category) xbt_free(task->category); #endif + xbt_mallocator_release(sd_global->task_mallocator,task); + sd_global->task_number--; + XBT_DEBUG("Task destroyed."); } @@ -279,14 +279,22 @@ void SD_task_set_data(SD_task_t task, void *data) /** * \brief Sets the rate of a task * - * This will change the percentage of the available power or network bandwidth - * a task can use. + * This will change the network bandwidth a task can use. This rate + * depends on both the nominal bandwidth on the route onto which the task is + * scheduled (\see SD_task_get_current_bandwidth) and the amount of data to + * transfer. * - * \param task a task - * \param rate the new rate you want to associate with this task + * To divide the nominal bandwidth by 2, the rate then has to be : + * rate = bandwidth/(2*amount) + * + * \param task a \see SD_TASK_COMM_E2E task (end-to-end communication) + * \param rate the new rate you want to associate with this task. */ void SD_task_set_rate(SD_task_t task, double rate) { + xbt_assert(task->kind == SD_TASK_COMM_E2E, + "The rate can be modified for end-to-end communications only."); + task->rate = rate; } @@ -965,8 +973,12 @@ void SD_task_unschedule(SD_task_t task) SD_task_get_name(task)); if (__SD_task_is_scheduled_or_runnable(task) /* if the task is scheduled or runnable */ - &&task->kind == SD_TASK_NOT_TYPED) /* Don't free scheduling data for typed tasks */ + && ((task->kind == SD_TASK_COMP_PAR_AMDAHL) || + (task->kind == SD_TASK_COMM_PAR_MXN_1D_BLOCK))) { /* Don't free scheduling data for typed tasks */ __SD_task_destroy_scheduling_data(task); + task->workstation_list=NULL; + task->workstation_nb = 0; + } if (__SD_task_is_running(task)) /* the task should become SD_FAILED */ surf_workstation_model->action_cancel(task->surf_action); @@ -1428,6 +1440,11 @@ void SD_task_schedulev(SD_task_t task, int count, xbt_assert(task->workstation_nb == count,"Got %d locations, but were expecting %d locations",count,task->workstation_nb); for (i = 0; i < count; i++) task->workstation_list[i] = list[i]; + if (SD_task_get_kind(task)== SD_TASK_COMP_SEQ && !task->computation_amount){ + /*This task has failed and is rescheduled. Reset the computation amount*/ + task->computation_amount = xbt_new0(double, 1); + task->computation_amount[0] = task->remains; + } SD_task_do_schedule(task); break; default: