From 5c0a9161484f1e1bb650f80d787719a28652b5f4 Mon Sep 17 00:00:00 2001 From: Samuel Lepetit Date: Wed, 20 Jun 2012 16:53:17 +0200 Subject: [PATCH] Bugfix in MSG_parallel_task_execute --- src/msg/msg_gos.c | 25 +++++++++++-------------- 1 file changed, 11 insertions(+), 14 deletions(-) diff --git a/src/msg/msg_gos.c b/src/msg/msg_gos.c index 89417a5137..23911d7624 100644 --- a/src/msg/msg_gos.c +++ b/src/msg/msg_gos.c @@ -99,6 +99,8 @@ MSG_error_t MSG_parallel_task_execute(m_task_t task) MSG_error_t status = MSG_OK; simdata = task->simdata; + m_process_t self = SIMIX_process_self(); + p_simdata = SIMIX_process_self_get_data(self); #ifdef HAVE_TRACING TRACE_msg_task_execute_start(task); @@ -110,17 +112,14 @@ MSG_error_t MSG_parallel_task_execute(m_task_t task) XBT_DEBUG("Computing on %s", MSG_process_get_name(MSG_process_self())); - if (simdata->computation_amount == 0) { + if (simdata->computation_amount == 0 && !simdata->host_nb) { #ifdef HAVE_TRACING TRACE_msg_task_execute_end(task); #endif return MSG_OK; } - m_process_t self = SIMIX_process_self(); - p_simdata = SIMIX_process_self_get_data(self); - p_simdata->waiting_action = simdata->compute; TRY { #ifdef HAVE_TRACING simcall_set_category(simdata->compute, task->category); @@ -128,12 +127,12 @@ MSG_error_t MSG_parallel_task_execute(m_task_t task) simdata->isused=1; - if (simdata->host_nb) { - simcall_host_parallel_execute(task->name, simdata->host_nb, + if (simdata->host_nb > 0) { + simdata->compute = simcall_host_parallel_execute(task->name, simdata->host_nb, simdata->host_list, simdata->comp_amount, simdata->comm_amount, 1.0, -1.0); - comp_state = simcall_host_execution_wait(simdata->compute); + XBT_DEBUG("Parallel execution action created: %p", simdata->compute); } else { simdata->compute = @@ -141,8 +140,9 @@ MSG_error_t MSG_parallel_task_execute(m_task_t task) simdata->computation_amount, simdata->priority); - comp_state = simcall_host_execution_wait(simdata->compute); } + p_simdata->waiting_action = simdata->compute; + comp_state = simcall_host_execution_wait(simdata->compute); p_simdata->waiting_action = NULL; @@ -156,12 +156,9 @@ MSG_error_t MSG_parallel_task_execute(m_task_t task) status = MSG_HOST_FAILURE; break; case cancel_error: - /* action ended, set comm and compute = NULL, the actions is already destroyed in the main function */ - simdata->comm = NULL; - simdata->compute = NULL; - #ifdef HAVE_TRACING - TRACE_msg_task_execute_end(task); - #endif + #ifdef HAVE_TRACING + TRACE_msg_task_execute_end(task); + #endif status = MSG_TASK_CANCELED; break; default: -- 2.20.1