Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Bugfix in MSG_parallel_task_execute
authorSamuel Lepetit <samuel.lepetit@inria.fr>
Wed, 20 Jun 2012 14:53:17 +0000 (16:53 +0200)
committerSamuel Lepetit <samuel.lepetit@inria.fr>
Wed, 20 Jun 2012 14:53:27 +0000 (16:53 +0200)
src/msg/msg_gos.c

index 89417a5..23911d7 100644 (file)
@@ -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: