X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/e4abd3f271729beeff499da36267bfb274dd1f6d..98aac24d37ccd81f02e065ef137640c786d47d9c:/src/msg/msg_task.c diff --git a/src/msg/msg_task.c b/src/msg/msg_task.c index b280a7c541..f41ad31150 100644 --- a/src/msg/msg_task.c +++ b/src/msg/msg_task.c @@ -62,6 +62,8 @@ msg_task_t MSG_task_create(const char *name, double compute_duration, simdata->receiver = NULL; simdata->source = NULL; simdata->priority = 1.0; + simdata->bound = 0; + simdata->affinity_mask = 0; simdata->rate = -1.0; simdata->isused = 0; @@ -112,7 +114,7 @@ MSG_parallel_task_create(const char *name, int host_nb, simdata->comm_amount = communication_amount; for (i = 0; i < host_nb; i++) - simdata->host_list[i] = host_list[i]->smx_host; + simdata->host_list[i] = host_list[i]; return task; } @@ -298,7 +300,7 @@ msg_error_t MSG_task_destroy(msg_task_t task) */ msg_error_t MSG_task_cancel(msg_task_t task) { - xbt_assert((task != NULL), "Invalid parameter"); + xbt_assert((task != NULL), "Cannot cancel a NULL task"); if (task->simdata->compute) { simcall_host_execution_cancel(task->simdata->compute); @@ -342,6 +344,23 @@ void MSG_task_set_compute_duration(msg_task_t task, } +/** \ingroup m_task_management + * \brief set the amount data attached with a task #msg_task_t. + * + * \warning If the transfer is ongoing (already started and not finished), + * it is not modified by this call. + */ + +void MSG_task_set_data_size(msg_task_t task, + double data_size) +{ + xbt_assert(task, "Invalid parameter"); + task->simdata->message_size = data_size; + +} + + + /** \ingroup m_task_management * \brief Returns the remaining computation amount of a task #msg_task_t. * @@ -421,3 +440,47 @@ void MSG_task_set_priority(msg_task_t task, double priority) simcall_host_execution_set_priority(task->simdata->compute, task->simdata->priority); } + + +/** \ingroup m_task_management + * \brief Changes the maximum CPU utilization of a computation task. + * Unit is flops/s. + * + * For VMs, there is a pitfall. Please see MSG_vm_set_bound(). + */ +void MSG_task_set_bound(msg_task_t task, double bound) +{ + xbt_assert(task, "Invalid parameter"); + xbt_assert(task->simdata, "Invalid parameter"); + + if (bound == 0) + XBT_INFO("bound == 0 means no capping (i.e., unlimited)."); + + task->simdata->bound = bound; + if (task->simdata->compute) + simcall_host_execution_set_bound(task->simdata->compute, + task->simdata->bound); +} + + +/** \ingroup m_task_management + * \brief Changes the CPU affinity of a computation task. + * + * When pinning the given task to the first CPU core of the given host, use + * 0x01 for the mask value. Each bit of the mask value corresponds to each CPU + * core. See taskset(1) on Linux. + * + * \param task a target task + * \param host the host having a multi-core CPU + * \param mask the value specifying the CPU affinity setting of the task + * + */ +void MSG_task_set_affinity(msg_task_t task, msg_host_t host, unsigned long mask) +{ + xbt_assert(task, "Invalid parameter"); + xbt_assert(task->simdata, "Invalid parameter"); + + task->simdata->affinity_mask = mask; + if (task->simdata->compute) + simcall_host_execution_set_affinity(task->simdata->compute, host, mask); +}