Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Follow surf's prototype for parallel tasks.
authoralegrand <alegrand@48e7efb5-ca39-0410-a469-dd3cf9ba447f>
Thu, 13 Sep 2007 13:13:31 +0000 (13:13 +0000)
committeralegrand <alegrand@48e7efb5-ca39-0410-a469-dd3cf9ba447f>
Thu, 13 Sep 2007 13:13:31 +0000 (13:13 +0000)
git-svn-id: svn+ssh://scm.gforge.inria.fr/svn/simgrid/simgrid/trunk@4620 48e7efb5-ca39-0410-a469-dd3cf9ba447f

src/include/simix/simix.h
src/simdag/sd_task.c
src/simix/smx_action.c

index 3fa031e..dfc863a 100644 (file)
@@ -135,9 +135,9 @@ XBT_PUBLIC(double) SIMIX_action_get_remains(smx_action_t action);
 
 XBT_PUBLIC(e_surf_action_state_t) SIMIX_action_get_state(smx_action_t action);
 
-XBT_PUBLIC(smx_action_t) SIMIX_action_parallel_execute(char * name, 
+XBT_PUBLIC(smx_action_t) SIMIX_action_parallel_execute(const char * name, 
                                                       int host_nb,      
-                                                      smx_host_t *host_list,
+                                                      const smx_host_t *host_list,
                                                       double *computation_amount,
                                                       double *communication_amount,
                                                       double amount,
index 361f544..c9db873 100644 (file)
@@ -673,21 +673,32 @@ void __SD_task_really_run(SD_task_t task) {
                    value, task->rate);
     }
   }
-  if(!task->surf_action) 
+  if(!task->surf_action) {
+    double *computation_amount = xbt_new(double, task->workstation_nb);
+    double *communication_amount = xbt_new(double, task->workstation_nb * 
+                                          task->workstation_nb);
+
+    memcpy(computation_amount, task->computation_amount, sizeof(double) * 
+          task->workstation_nb);
+    memcpy(communication_amount, task->communication_amount, 
+          sizeof(double) * task->workstation_nb * task->workstation_nb);
+
     task->surf_action = surf_workstation_model->extension_public->
       execute_parallel_task(task->workstation_nb,
                            surf_workstations,
-                           task->computation_amount,
-                           task->communication_amount,
+                           computation_amount,
+                           communication_amount,
                            task->amount,
                            task->rate);
+  } else {
+    xbt_free(surf_workstations);
+  }
 
   surf_workstation_model->common_public->action_set_data(task->surf_action, task);
   task->state_changed = 1;
 
   DEBUG1("surf_action = %p",  task->surf_action);
 
-  xbt_free(surf_workstations);
   __SD_task_destroy_scheduling_data(task); /* now the scheduling data are not useful anymore */
   __SD_task_set_state(task, SD_RUNNING);
   xbt_assert2(__SD_task_is_running(task), "Bad state of task '%s': %d",
index 681da73..97ad685 100644 (file)
@@ -261,8 +261,8 @@ double SIMIX_action_get_remains(smx_action_t action)
   return action->simdata->surf_action->remains;
 }
 
-smx_action_t SIMIX_action_parallel_execute(char *name, int host_nb,
-                                          smx_host_t *host_list,
+smx_action_t SIMIX_action_parallel_execute(const char *name, int host_nb,
+                                          const smx_host_t *host_list,
                                           double *computation_amount,
                                           double *communication_amount,
                                           double amount, double rate)