SimGrid (3.19) NOT RELEASED YET (target: March 20 2018, 16:15:27 UTC)
+ MSG
+ - Fix MSG_task_get_remaining_work_ratio() to return 1.0 for tasks that have
+ not started.
+
S4U
- Execution->setHost() can be called after start() to migrate it.
- Comm::test_any() is now implemented.
msg_task_t MSG_parallel_task_create(const char *name, int host_nb, const msg_host_t * host_list,
double *flops_amount, double *bytes_amount, void *data)
{
- msg_task_t task = MSG_task_create(name, 0, 0, data);
+ // Task's flops amount is set to an arbitrary value > 0.0 to be able to distinguish, in
+ // MSG_task_get_remaining_work_ratio(), a finished task and a task that has not started yet.
+ msg_task_t task = MSG_task_create(name, 1.0, 0, data);
simdata_task_t simdata = task->simdata;
/* Simulator Data specific to parallel tasks */
* to do: starts at 1 and goes to 0. Returns 0 if not started or finished.
*
* It works for either parallel or sequential tasks.
- * TODO: Improve this function by returning 1 if the task has not started
*/
double MSG_task_get_remaining_work_ratio(msg_task_t task) {
// Task in progress
return task->simdata->compute->remainingRatio();
} else {
- // Task not started or finished
- return 0;
+ // Task not started (flops_amount is > 0.0) or finished (flops_amount is set to 0.0)
+ return task->simdata->flops_amount > 0.0 ? 1.0 : 0.0;
}
}
XBT_INFO("get the progress of %s before the task starts", task->name);
progress = MSG_task_get_remaining_work_ratio(task);
- xbt_assert(progress == 0, "Progress should be 0 not %f", progress);
+ xbt_assert(progress == 1.0, "Progress should be 1.0 not %f", progress);
XBT_INFO("Executing task: \"%s\"", task->name);
MSG_task_execute(task);
XBT_INFO("get the progress of %s before the task starts", task->name);
progress = MSG_task_get_remaining_work_ratio(task);
- xbt_assert(progress == 0, "Progress should be 0 not %f", progress);
+ xbt_assert(progress == 1.0, "Progress should be 1.0 not %f", progress);
XBT_INFO("Executing task: \"%s\"", task->name);
MSG_parallel_task_execute(task);