Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
WIP on simcalls: fd8c267 Stop making direct calls to SIMIX for host handling, use...
authorCristian Rosa <cristian@rtfm.org.ar>
Tue, 18 Sep 2012 16:42:28 +0000 (13:42 -0300)
committershenshei <paul.bedaride@gmail.com>
Wed, 28 Nov 2012 08:17:53 +0000 (09:17 +0100)
src/simix/smx_host.c
src/simix/smx_host_private.h
src/simix/smx_process.c
src/simix/smx_smurf.c
src/simix/smx_smurf_private.h

index e07d835..1984381 100644 (file)
@@ -119,7 +119,7 @@ const char* SIMIX_host_self_get_name(void)
   if (host == NULL || SIMIX_process_self() == simix_global->maestro_process)
     return "";
 
-  return SIMIX_host_get_name(host);
+  return SIMIX_host_get_name(SIMIX_pack_args(PTR(host)));
 }
 
 const char* SIMIX_host_get_name(u_smx_scalar_t *args)
@@ -167,12 +167,14 @@ int SIMIX_host_get_state(u_smx_scalar_t *args)
 
 void* SIMIX_host_self_get_data(void)
 {
-  return SIMIX_host_get_data(SIMIX_host_self());
+  smx_host_t self = SIMIX_host_self();
+  return SIMIX_host_get_data(SIMIX_pack_args(PTR(self)));
 }
 
 void SIMIX_host_self_set_data(void *data)
 {
-  SIMIX_host_set_data(SIMIX_host_self(), data);
+  smx_host_t self = SIMIX_host_self();
+  SIMIX_host_set_data(SIMIX_pack_args(PTR(self), PTR(data)));
 }
 
 void* SIMIX_host_get_data(u_smx_scalar_t *args)
@@ -228,7 +230,7 @@ void SIMIX_host_add_auto_restart_process(smx_host_t host,
   arg->properties = properties;
   arg->auto_restart = auto_restart;
 
-  if( SIMIX_host_get_state(host) == SURF_RESOURCE_OFF
+  if( SIMIX_host_get_state(SIMIX_pack_args(PTR(host))) == SURF_RESOURCE_OFF
       && !xbt_dict_get_or_null(watched_hosts_lib,host->name)){
     xbt_dict_set(watched_hosts_lib,host->name,host,NULL);
     XBT_DEBUG("Have push host %s to watched_hosts_lib because state == SURF_RESOURCE_OFF",host->name);
@@ -417,8 +419,7 @@ void SIMIX_host_execution_set_priority(u_smx_scalar_t *args)
 
 void SIMIX_pre_host_execution_wait(u_smx_scalar_t *args)
 {
-  smx_simcall_t simcall = args[0].p;
-  smx_action_t action = simcall->host_execution_wait.execution;
+  smx_action_t action = args[0].p;
 
   XBT_DEBUG("Wait for execution of action %p, state %d", action, (int)action->state);
 
@@ -491,7 +492,7 @@ void SIMIX_execution_finish(smx_action_t action)
   }
 
   /* We no longer need it */
-  SIMIX_host_execution_destroy(action);
+  SIMIX_host_execution_destroy(SIMIX_pack_args(PTR(action)));
 }
 
 void SIMIX_post_host_execute(smx_action_t action)
index cf238ee..9a0ec79 100644 (file)
@@ -31,13 +31,14 @@ void SIMIX_host_add_auto_restart_process(smx_host_t host,
                                          int argc, char **argv,
                                          xbt_dict_t properties,
                                          int auto_restart);
+
 void SIMIX_host_restart_processes(smx_host_t host);
 void SIMIX_host_autorestart(smx_host_t host);
 xbt_dict_t SIMIX_host_get_properties(u_smx_scalar_t *args);
 double SIMIX_host_get_speed(u_smx_scalar_t *args);
 double SIMIX_host_get_available_speed(u_smx_scalar_t *args);
 int SIMIX_host_get_state(u_smx_scalar_t *args);
-smx_action_t SIMIX_host_execute(u_smx_scalar_t *args);
+smx_action_t SIMIX_host_execute(smx_process_t issuer, u_smx_scalar_t *args);
 smx_action_t SIMIX_host_parallel_execute(u_smx_scalar_t *args);
 void SIMIX_host_execution_destroy(u_smx_scalar_t *args);
 void SIMIX_host_execution_cancel(u_smx_scalar_t *args);
index 8c26267..7ae2c2b 100644 (file)
@@ -444,8 +444,7 @@ smx_action_t SIMIX_process_suspend(smx_process_t process, smx_process_t issuer)
       return NULL;
     }
   } else {
-    SIMIX_simcall(SIMCALL_HOST_EXECUTE, PTR("suspend"), PTR(process->smx_host), DOUBLE(0.0), DOUBLE(1.0));
-    return process->simcall.host_execute.result;
+    return SIMIX_host_execute(SIMIX_pack_args(PTR("suspend"), PTR(process->smx_host), DOUBLE(0.0), DOUBLE(1.0)));
   }
 }
 
index 5a573ff..4471f16 100644 (file)
@@ -228,41 +228,41 @@ void SIMIX_simcall_pre(smx_simcall_t simcall, int value)
 
     case SIMCALL_HOST_GET_BY_NAME:
       simcall->host_get_by_name.result =
-        SIMIX_host_get_by_name(simcall->host_get_by_name.name);
+        SIMIX_host_get_by_name(simcall->args);
       SIMIX_simcall_answer(simcall);
       break;
 
     case SIMCALL_HOST_GET_NAME:
-      simcall->host_get_name.result =  SIMIX_host_get_name(simcall->host_get_name.host);
+      simcall->host_get_name.result =  SIMIX_host_get_name(simcall->args);
       SIMIX_simcall_answer(simcall);
       break;
 
     case SIMCALL_HOST_GET_PROPERTIES:
       simcall->host_get_properties.result =
-        SIMIX_host_get_properties(simcall->host_get_properties.host);
+        SIMIX_host_get_properties(simcall->args);
       SIMIX_simcall_answer(simcall);
       break;
 
     case SIMCALL_HOST_GET_SPEED:
       simcall->host_get_speed.result = 
-        SIMIX_host_get_speed(simcall->host_get_speed.host);
+        SIMIX_host_get_speed(simcall->args);
       SIMIX_simcall_answer(simcall);
       break;
 
     case SIMCALL_HOST_GET_AVAILABLE_SPEED:
       simcall->host_get_available_speed.result =
-        SIMIX_host_get_available_speed(simcall->host_get_available_speed.host);
+        SIMIX_host_get_available_speed(simcall->args);
       SIMIX_simcall_answer(simcall);
       break;
 
     case SIMCALL_HOST_GET_STATE:
       simcall->host_get_state.result = 
-        SIMIX_host_get_state(simcall->host_get_state.host);
+        SIMIX_host_get_state(simcall->args);
       SIMIX_simcall_answer(simcall);
       break;
 
     case SIMCALL_HOST_GET_DATA:
-      simcall->host_get_data.result =  SIMIX_host_get_data(simcall->host_get_data.host);
+      simcall->host_get_data.result =  SIMIX_host_get_data(simcall->args);
       SIMIX_simcall_answer(simcall);
       break;
 
@@ -277,48 +277,39 @@ void SIMIX_simcall_pre(smx_simcall_t simcall, int value)
       break;
 
     case SIMCALL_HOST_PARALLEL_EXECUTE:
-      simcall->host_parallel_execute.result = SIMIX_host_parallel_execute(
-    simcall->host_parallel_execute.name,
-    simcall->host_parallel_execute.host_nb,
-    simcall->host_parallel_execute.host_list,
-    simcall->host_parallel_execute.computation_amount,
-    simcall->host_parallel_execute.communication_amount,
-    simcall->host_parallel_execute.amount,
-    simcall->host_parallel_execute.rate);
+      simcall->host_parallel_execute.result = SIMIX_host_parallel_execute(simcall->args);
       SIMIX_simcall_answer(simcall);
       break;
 
     case SIMCALL_HOST_EXECUTION_DESTROY:
-      SIMIX_host_execution_destroy(simcall->host_execution_destroy.execution);
+      SIMIX_host_execution_destroy(simcall->args);
       SIMIX_simcall_answer(simcall);
       break;
 
     case SIMCALL_HOST_EXECUTION_CANCEL:
-      SIMIX_host_execution_cancel(simcall->host_execution_cancel.execution);
+      SIMIX_host_execution_cancel(simcall->args);
       SIMIX_simcall_answer(simcall);
       break;
 
     case SIMCALL_HOST_EXECUTION_GET_REMAINS:
       simcall->host_execution_get_remains.result =
-        SIMIX_host_execution_get_remains(simcall->host_execution_get_remains.execution);
+        SIMIX_host_execution_get_remains(simcall->args);
       SIMIX_simcall_answer(simcall);
       break;
 
     case SIMCALL_HOST_EXECUTION_GET_STATE:
       simcall->host_execution_get_state.result =
-        SIMIX_host_execution_get_state(simcall->host_execution_get_state.execution);
+        SIMIX_host_execution_get_state(simcall->args);
       SIMIX_simcall_answer(simcall);
       break;
 
     case SIMCALL_HOST_EXECUTION_SET_PRIORITY:
-      SIMIX_host_execution_set_priority(
-    simcall->host_execution_set_priority.execution,
-    simcall->host_execution_set_priority.priority);
+      SIMIX_host_execution_set_priority(simcall->args);
       SIMIX_simcall_answer(simcall);
       break;
 
     case SIMCALL_HOST_EXECUTION_WAIT:
-      SIMIX_pre_host_execution_wait(simcall);
+      SIMIX_pre_host_execution_wait(simcall->args);
       break;
 
     case SIMCALL_PROCESS_CREATE:
index b90f25e..6d3d645 100644 (file)
@@ -671,6 +671,9 @@ union u_smx_scalar {
   void*           p;
 };
 
+#define SIMIX_pack_args(...) (u_smx_scalar_t[]){MAP(INIT_FIELD, __VA_ARGS__)}
+
+
 /*
  * Define scalar type wrappers to ease the use of simcalls.
  * These are used to wrap the arguments in SIMIX_simcall macro.