From 56d873227b0d9a0254e04f63eaf6d76efdb0ef19 Mon Sep 17 00:00:00 2001 From: suter Date: Fri, 9 Aug 2013 10:16:51 +0200 Subject: [PATCH] add new simdag function upon user request. --- ChangeLog | 4 +++- include/simdag/simdag.h | 1 + src/simdag/sd_task.c | 22 +++++++++++++++++++++- 3 files changed, 25 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index a1d55addbe..d3a01e4f2a 100644 --- a/ChangeLog +++ b/ChangeLog @@ -44,9 +44,11 @@ SimGrid (3.10) NOT RELEASED; urgency=low * Add all missing Fortran bindings, SMPI should work with Fortran 90 (no privatization of global variables yet) + SimDag: + * Add a new function SD_task_set_amount() upon user request. PLATFORM: - * Handle units for values (10ms, 10kiloflops, 10Bps, ...) + * Handle units for values (10ms, 10kiloflops, 10Bps, 1GB, ...) * Remove rule based routing (no more pcre dependency) * Add a limiter_link option to cluster tag, to specify a maximum reachable bandwidth in fullduplex mode when it is < 2*nominal bw diff --git a/include/simdag/simdag.h b/include/simdag/simdag.h index 9afe61d509..bd9ee4e439 100644 --- a/include/simdag/simdag.h +++ b/include/simdag/simdag.h @@ -135,6 +135,7 @@ XBT_PUBLIC(void) SD_task_set_rate(SD_task_t task, double rate); XBT_PUBLIC(void) SD_task_watch(SD_task_t task, e_SD_task_state_t state); XBT_PUBLIC(void) SD_task_unwatch(SD_task_t task, e_SD_task_state_t state); XBT_PUBLIC(double) SD_task_get_amount(SD_task_t task); +XBT_PUBLIC(void) SD_task_set_amount(SD_task_t task, double amount); XBT_PUBLIC(double) SD_task_get_alpha(SD_task_t task); XBT_PUBLIC(double) SD_task_get_remaining_amount(SD_task_t task); XBT_PUBLIC(double) SD_task_get_execution_time(SD_task_t task, diff --git a/src/simdag/sd_task.c b/src/simdag/sd_task.c index af052fb289..733febca5f 100644 --- a/src/simdag/sd_task.c +++ b/src/simdag/sd_task.c @@ -476,7 +476,27 @@ double SD_task_get_amount(SD_task_t task) } /** - * \brief Returns the alpha parameter of a SD_TASK_COMP_PAR_AMDAH task + * \brief Sets the total amount of work of a task + * For sequential typed tasks (COMP_SEQ and COMM_E2E), it also sets the + * appropriate values in the computation_amount and communication_amount arrays + * respectively. Nothing more than modifying task->amount is done for paralle + * typed tasks (COMP_PAR_AMDAHL and COMM_PAR_MXN_1D_BLOCK) as the distribution + * of the amount of work is done at scheduling time. + * + * \param task a task + * \param amount the new amount of work to execute + */ +void SD_task_set_amount(SD_task_t task, double amount) +{ + task->amount = amount; + if (task->kind == SD_TASK_COMP_SEQ) + task->computation_amount[0] = amount; + if (task->kind == SD_TASK_COMM_E2E) + task->communication_amount[2] = amount; +} + +/** + * \brief Returns the alpha parameter of a SD_TASK_COMP_PAR_AMDAHL task * * \param task a parallel task assuming Amdahl's law as speedup model * \return the alpha parameter (serial part of a task in percent) for this task -- 2.20.1