X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/274b996ead50456d7519b1cbd5d4f86e0a9154ec..b784c77ac5599c578f0ff00d6102222b286b0833:/src/msg/msg_task.c diff --git a/src/msg/msg_task.c b/src/msg/msg_task.c index 74151b9940..f1043873db 100644 --- a/src/msg/msg_task.c +++ b/src/msg/msg_task.c @@ -1,4 +1,4 @@ -/* Copyright (c) 2004, 2005, 2006, 2007, 2008, 2009, 2010. The SimGrid Team. +/* Copyright (c) 2004-2013. The SimGrid Team. * All rights reserved. */ /* This program is free software; you can redistribute it and/or modify it @@ -112,16 +112,16 @@ 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; } /*************** Begin GPU ***************/ /** \ingroup m_task_management - * \brief Creates a new #m_gpu_task_t. + * \brief Creates a new #msg_gpu_task_t. - * A constructor for #m_gpu_task_t taking four arguments and returning + * A constructor for #msg_gpu_task_t taking four arguments and returning a pointer to the new created GPU task. * \param name a name for the object. It is for user-level information @@ -136,13 +136,13 @@ MSG_parallel_task_create(const char *name, int host_nb, * \param collect_latency time in seconds to transfer result from the GPU back to the CPU (host) when done - * \see m_gpu_task_t + * \see msg_gpu_task_t * \return The new corresponding object. */ -m_gpu_task_t MSG_gpu_task_create(const char *name, double compute_duration, +msg_gpu_task_t MSG_gpu_task_create(const char *name, double compute_duration, double dispatch_latency, double collect_latency) { - m_gpu_task_t task = xbt_new(s_m_gpu_task_t, 1); + msg_gpu_task_t task = xbt_new(s_msg_gpu_task_t, 1); simdata_gpu_task_t simdata = xbt_new(s_simdata_gpu_task_t, 1); task->simdata = simdata; /* Task structure */ @@ -261,7 +261,7 @@ void MSG_task_set_name(msg_task_t task, const char *name) * supposed to destroy it. The sender should not use it anymore. * If the task failed to be sent, the sender remains the owner of the task. */ -MSG_error_t MSG_task_destroy(msg_task_t task) +msg_error_t MSG_task_destroy(msg_task_t task) { smx_action_t action = NULL; xbt_assert((task != NULL), "Invalid parameter"); @@ -296,9 +296,9 @@ MSG_error_t MSG_task_destroy(msg_task_t task) * \param task the task to cancel. If it was executed or transfered, it stops the process that were working on it. */ -MSG_error_t MSG_task_cancel(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); @@ -312,7 +312,9 @@ MSG_error_t MSG_task_cancel(msg_task_t task) /** \ingroup m_task_management * \brief Returns the computation amount needed to process a task #msg_task_t. - * Once a task has been processed, this amount is thus set to 0... + * + * Once a task has been processed, this amount is set to 0. If you want, you + * can reset this value with #MSG_task_set_compute_duration before restarting the task. */ double MSG_task_get_compute_duration(msg_task_t task) { @@ -325,6 +327,11 @@ double MSG_task_get_compute_duration(msg_task_t task) /** \ingroup m_task_management * \brief set the computation amount needed to process a task #msg_task_t. + * + * \warning If the computation is ongoing (already started and not finished), + * it is not modified by this call. And the termination of the ongoing task with + * set the computation_amount to zero, overriding any value set during the + * execution. */ void MSG_task_set_compute_duration(msg_task_t task, @@ -335,9 +342,29 @@ 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. * + * If the task is ongoing, this call retrieves the remaining amount of work. + * If it is not ongoing, it returns the total amount of work that will be + * executed when the task starts. */ double MSG_task_get_remaining_computation(msg_task_t task) {