Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
I forgot to update my tree before commiting (once again), and got conflicts as punishment
authorMartin Quinson <martin.quinson@loria.fr>
Sat, 28 Apr 2012 07:48:39 +0000 (09:48 +0200)
committerMartin Quinson <martin.quinson@loria.fr>
Sat, 28 Apr 2012 07:48:39 +0000 (09:48 +0200)
18 files changed:
examples/msg/start_kill_time/deployment.xml [new file with mode: 0644]
examples/msg/start_kill_time/deployment_kill.xml [new file with mode: 0644]
examples/msg/start_kill_time/deployment_start_kill.xml
examples/msg/start_kill_time/start_kill_time.tesh
include/msg/msg.h
include/simgrid/simix.h
src/gras/Virtu/sg_process.c
src/msg/msg_private.h
src/msg/msg_process.c
src/simix/smx_deployment.c
src/simix/smx_process.c
src/simix/smx_process_private.h
src/simix/smx_smurf.c
src/simix/smx_smurf_private.h
src/simix/smx_user.c
src/surf/maxmin.c
src/xbt/xbt_sg_synchro.c
tools/gras/struct_diff.c

diff --git a/examples/msg/start_kill_time/deployment.xml b/examples/msg/start_kill_time/deployment.xml
new file mode 100644 (file)
index 0000000..77a7713
--- /dev/null
@@ -0,0 +1,10 @@
+<?xml version='1.0'?>
+<!DOCTYPE platform SYSTEM "http://simgrid.gforge.inria.fr/simgrid.dtd">
+<platform version="3">
+    <process host="c-0.me" function="master"/>
+       <process host="c-1.me" function="slave"/>
+       <process host="c-2.me" function="slave"/>
+       <process host="c-3.me" function="slave"/>
+       <process host="c-4.me" function="slave"/>
+       <process host="c-5.me" function="slave"/>
+</platform>
\ No newline at end of file
diff --git a/examples/msg/start_kill_time/deployment_kill.xml b/examples/msg/start_kill_time/deployment_kill.xml
new file mode 100644 (file)
index 0000000..c8fe38c
--- /dev/null
@@ -0,0 +1,10 @@
+<?xml version='1.0'?>
+<!DOCTYPE platform SYSTEM "http://simgrid.gforge.inria.fr/simgrid.dtd">
+<platform version="3">
+    <process host="c-0.me" function="master"/>
+       <process host="c-1.me" function="slave" kill_time="6"/>
+       <process host="c-2.me" function="slave" kill_time="6"/>
+       <process host="c-3.me" function="slave" kill_time="6"/>
+       <process host="c-4.me" function="slave" kill_time="6"/>
+       <process host="c-5.me" function="slave" kill_time="6"/>
+</platform>
\ No newline at end of file
index 474c99d..4342a09 100644 (file)
@@ -2,9 +2,9 @@
 <!DOCTYPE platform SYSTEM "http://simgrid.gforge.inria.fr/simgrid.dtd">
 <platform version="3">
     <process host="c-0.me" function="master"/>
-       <process host="c-1.me" function="slave" start_time="1" kill_time="10"/>
-       <process host="c-2.me" function="slave" start_time="2" kill_time="10"/>
-       <process host="c-3.me" function="slave" start_time="3" kill_time="10"/>
-       <process host="c-4.me" function="slave" start_time="4" kill_time="10"/>
-       <process host="c-5.me" function="slave" start_time="5" kill_time="10"/>
+       <process host="c-1.me" function="slave" start_time="1" kill_time="5"/>
+       <process host="c-2.me" function="slave" start_time="2" kill_time="6"/>
+       <process host="c-3.me" function="slave" start_time="3" kill_time="7"/>
+       <process host="c-4.me" function="slave" start_time="4" kill_time="8"/>
+       <process host="c-5.me" function="slave" start_time="5" kill_time="9"/>
 </platform>
\ No newline at end of file
index 4745b6d..f54c9d6 100644 (file)
@@ -1,5 +1,22 @@
 #! ./tesh
 
+p Test0 Process without time
+
+$ $SG_TEST_EXENV ${bindir:=.}/start_kill_time/sk_time ${srcdir:=.}/examples/platforms/cluster.xml ${srcdir:=.}/examples/msg/start_kill_time/deployment.xml "--log=root.fmt:[%10.6r]%e(%i:%P@%h)%e%m%n"
+> [  0.000000] (1:master@c-0.me) Hello!
+> [  0.000000] (2:slave@c-1.me) Hello!
+> [  0.000000] (3:slave@c-2.me) Hello!
+> [  0.000000] (4:slave@c-3.me) Hello!
+> [  0.000000] (5:slave@c-4.me) Hello!
+> [  0.000000] (6:slave@c-5.me) Hello!
+> [ 10.000000] (6:slave@c-5.me) OK, goodbye now.
+> [ 10.000000] (1:master@c-0.me) OK, goodbye now.
+> [ 10.000000] (2:slave@c-1.me) OK, goodbye now.
+> [ 10.000000] (3:slave@c-2.me) OK, goodbye now.
+> [ 10.000000] (4:slave@c-3.me) OK, goodbye now.
+> [ 10.000000] (5:slave@c-4.me) OK, goodbye now.
+> [ 10.000000] (0:@) Simulation time 10
+
 p Test1 Process with start time
 
 $ $SG_TEST_EXENV ${bindir:=.}/start_kill_time/sk_time ${srcdir:=.}/examples/platforms/cluster.xml ${srcdir:=.}/examples/msg/start_kill_time/deployment_start.xml "--log=root.fmt:[%10.6r]%e(%i:%P@%h)%e%m%n"
@@ -17,6 +34,26 @@ $ $SG_TEST_EXENV ${bindir:=.}/start_kill_time/sk_time ${srcdir:=.}/examples/plat
 > [ 15.000000] (6:slave@c-5.me) OK, goodbye now.
 > [ 15.000000] (0:@) Simulation time 15
 
+p Test1 Process with kill time
+
+$ $SG_TEST_EXENV ${bindir:=.}/start_kill_time/sk_time ${srcdir:=.}/examples/platforms/cluster.xml ${srcdir:=.}/examples/msg/start_kill_time/deployment_kill.xml "--log=root.fmt:[%10.6r]%e(%i:%P@%h)%e%m%n"
+> [  0.000000] (1:master@c-0.me) Hello!
+> [  0.000000] (2:slave@c-1.me) Hello!
+> [  0.000000] (3:slave@c-2.me) Hello!
+> [  0.000000] (4:slave@c-3.me) Hello!
+> [  0.000000] (5:slave@c-4.me) Hello!
+> [  0.000000] (6:slave@c-5.me) Hello!
+> [ 10.000000] (1:master@c-0.me) OK, goodbye now.
+> [ 10.000000] (0:@) Simulation time 10
+
 p Test2 Process with start and kill times
 
 $ $SG_TEST_EXENV ${bindir:=.}/start_kill_time/sk_time ${srcdir:=.}/examples/platforms/cluster.xml ${srcdir:=.}/examples/msg/start_kill_time/deployment_start_kill.xml "--log=root.fmt:[%10.6r]%e(%i:%P@%h)%e%m%n"
+> [  0.000000] (1:master@c-0.me) Hello!
+> [  1.000000] (2:slave@c-1.me) Hello!
+> [  2.000000] (3:slave@c-2.me) Hello!
+> [  3.000000] (4:slave@c-3.me) Hello!
+> [  4.000000] (5:slave@c-4.me) Hello!
+> [  5.000000] (6:slave@c-5.me) Hello!
+> [ 10.000000] (1:master@c-0.me) OK, goodbye now.
+> [ 10.000000] (0:@) Simulation time 10
index 625cc6f..d28939b 100644 (file)
@@ -102,6 +102,7 @@ XBT_PUBLIC(m_process_t) MSG_process_create_with_environment(const char
                                                             code,
                                                             void *data,
                                                             m_host_t host,
+                                                            double kill_time,
                                                             int argc,
                                                             char **argv,
                                                             xbt_dict_t
index 4464505..dec17ec 100644 (file)
@@ -93,6 +93,7 @@ typedef void (*smx_creation_func_t) ( /* process */ smx_process_t*,
                                       /* code */ xbt_main_func_t,
                                       /* userdata */ void*,
                                       /* hostname */ const char*,
+                                      /* kill_time */ double,
                                       /* argc */ int,
                                       /* argv */ char**,
                                       /* props */ xbt_dict_t);
@@ -307,6 +308,7 @@ XBT_PUBLIC(void) simcall_process_create(smx_process_t *process,
                                           xbt_main_func_t code,
                                           void *data,
                                           const char *hostname,
+                                          double kill_time,
                                           int argc, char **argv,
                                           xbt_dict_t properties);
 
index 44ca9d5..b524417 100644 (file)
@@ -29,7 +29,7 @@ void gras_agent_spawn(const char *name,
 
   smx_process_t process;
   simcall_process_create(&process, name, code, NULL,
-                           gras_os_myname(), argc, argv, properties);
+                           gras_os_myname(), -1.0, argc, argv, properties);
 }
 
 /* **************************************************************************
index 7a812dd..55a22d6 100644 (file)
@@ -129,7 +129,7 @@ void __MSG_display_process_status(void);
 void MSG_process_cleanup_from_SIMIX(smx_process_t smx_proc);
 void MSG_process_create_from_SIMIX(smx_process_t *process, const char *name,
                                    xbt_main_func_t code, void *data,
-                                   const char *hostname, int argc,
+                                   const char *hostname, double kill_time,  int argc,
                                    char **argv, xbt_dict_t properties);
 void MSG_process_kill_from_SIMIX(smx_process_t p);
 void MSG_comm_copy_data_from_SIMIX(smx_action_t comm, void* buff, size_t buff_size);
index dcd5a8c..6e9a904 100644 (file)
@@ -58,12 +58,12 @@ void MSG_process_cleanup_from_SIMIX(smx_process_t smx_proc)
 /* This function creates a MSG process. It has the prototype enforced by SIMIX_function_register_process_create */
 void MSG_process_create_from_SIMIX(smx_process_t* process, const char *name,
                                     xbt_main_func_t code, void *data,
-                                    const char *hostname, int argc, char **argv,
+                                    const char *hostname, double kill_time, int argc, char **argv,
                                     xbt_dict_t properties)
 {
   m_host_t host = MSG_get_host_by_name(hostname);
   m_process_t p = MSG_process_create_with_environment(name, code, data,
-                                                      host, argc, argv,
+                                                      host, kill_time, argc, argv,
                                                       properties);
   *((m_process_t*) process) = p;
 }
@@ -79,7 +79,7 @@ m_process_t MSG_process_create(const char *name,
                                xbt_main_func_t code, void *data,
                                m_host_t host)
 {
-  return MSG_process_create_with_environment(name, code, data, host, -1,
+  return MSG_process_create_with_environment(name, code, data, host, -1, -1,
                                              NULL, NULL);
 }
 
@@ -113,7 +113,7 @@ m_process_t MSG_process_create_with_arguments(const char *name,
                                               void *data, m_host_t host,
                                               int argc, char **argv)
 {
-  return MSG_process_create_with_environment(name, code, data, host,
+  return MSG_process_create_with_environment(name, code, data, host, -1.0,
                                              argc, argv, NULL);
 }
 
@@ -136,6 +136,7 @@ m_process_t MSG_process_create_with_arguments(const char *name,
    object.  It is for user-level information and can be NULL. It can
    be retrieved with the function \ref MSG_process_get_data.
  * \param host the location where the new process is executed.
+ * \param kill_time the time when the process is killed.
  * \param argc first argument passed to \a code
  * \param argv second argument passed to \a code
  * \param properties list a properties defined for this process
@@ -145,6 +146,7 @@ m_process_t MSG_process_create_with_arguments(const char *name,
 m_process_t MSG_process_create_with_environment(const char *name,
                                                 xbt_main_func_t code,
                                                 void *data, m_host_t host,
+                                                double kill_time,
                                                 int argc, char **argv,
                                                 xbt_dict_t properties)
 {
@@ -174,7 +176,7 @@ m_process_t MSG_process_create_with_environment(const char *name,
 
   /* Let's create the process: SIMIX may decide to start it right now,
    * even before returning the flow control to us */
-  simcall_process_create(&process, name, code, simdata, SIMIX_host_get_name(host->smx_host),
+  simcall_process_create(&process, name, code, simdata, SIMIX_host_get_name(host->smx_host), kill_time,
                            argc, argv, properties);
 
   if (!process) {
index 6c7d332..60b7e6f 100644 (file)
@@ -33,8 +33,8 @@ static void parse_process_init(void)
   parse_argv = xbt_new(char *, 2);
   parse_argv[0] = xbt_strdup(A_surfxml_process_function);
   parse_argc = 1;
-  start_time= surf_parse_get_double(A_surfxml_process_start_time);
-  kill_time = surf_parse_get_double(A_surfxml_process_kill_time);
+  start_time = surf_parse_get_double(A_surfxml_process_start_time);
+  kill_time  = surf_parse_get_double(A_surfxml_process_kill_time);
 }
 
 static void parse_argument(void)
@@ -48,6 +48,7 @@ static void parse_process_finalize(void)
   smx_process_arg_t arg = NULL;
   smx_process_t process = NULL;
   parse_argv[parse_argc] = NULL;
+
   if (start_time > SIMIX_get_clock()) {
     arg = xbt_new0(s_smx_process_arg_t, 1);
     arg->name = parse_argv[0];
@@ -68,22 +69,21 @@ static void parse_process_finalize(void)
     if (simix_global->create_process_function)
       simix_global->create_process_function(&process,
                                             parse_argv[0],
-                                            parse_code, NULL,
-                                            parse_host, parse_argc,
+                                            parse_code,
+                                            NULL,
+                                            parse_host,
+                                            kill_time,
+                                            parse_argc,
                                             parse_argv,
                                             current_property_set);
     else
-      simcall_process_create(&process, parse_argv[0], parse_code, NULL, parse_host, parse_argc, parse_argv,
+      simcall_process_create(&process, parse_argv[0], parse_code, NULL, parse_host, kill_time, parse_argc, parse_argv,
                                current_property_set);
+
     /* verify if process has been created (won't be the case if the host is currently dead, but that's fine) */
     if (!process) {
       return;
     }
-    if (kill_time > SIMIX_get_clock()) {
-      if (simix_global->kill_process_function) {
-        SIMIX_timer_set(start_time, simix_global->kill_process_function, process);
-      }
-    }
   }
   current_property_set = NULL;
 }
index 326f0ae..eee6efd 100644 (file)
@@ -156,6 +156,7 @@ smx_process_t SIMIX_process_create_from_wrapper(smx_process_arg_t args) {
       args->code,
       args->data,
       args->hostname,
+      args->kill_time,
       args->argc,
       args->argv,
       args->properties);
@@ -177,6 +178,7 @@ void SIMIX_process_create(smx_process_t *process,
                           xbt_main_func_t code,
                           void *data,
                           const char *hostname,
+                          double kill_time,
                           int argc, char **argv,
                           xbt_dict_t properties) {
 
@@ -222,6 +224,14 @@ void SIMIX_process_create(smx_process_t *process,
     XBT_DEBUG("Inserting %s(%s) in the to_run list", (*process)->name, host->name);
     xbt_dynar_push_as(simix_global->process_to_run, smx_process_t, *process);
   }
+
+  if (kill_time > SIMIX_get_clock()) {
+    if (simix_global->kill_process_function) {
+      XBT_DEBUG("Process %s(%s) will be kill at time %f", (*process)->name,
+          (*process)->smx_host->name, kill_time);
+      SIMIX_timer_set(kill_time, simix_global->kill_process_function, *process);
+    }
+  }
 }
 
 /**
index a971ba3..2b9359b 100644 (file)
@@ -50,6 +50,7 @@ void SIMIX_process_create(smx_process_t *process,
                           xbt_main_func_t code,
                           void *data,
                           const char *hostname,
+                          double kill_time,
                           int argc, char **argv,
                           xbt_dict_t properties);
 void SIMIX_process_runall(void);
index df7fb25..c752587 100644 (file)
@@ -306,6 +306,7 @@ void SIMIX_simcall_pre(smx_simcall_t simcall, int value)
          simcall->process_create.code,
          simcall->process_create.data,
          simcall->process_create.hostname,
+         simcall->process_create.kill_time,
          simcall->process_create.argc,
          simcall->process_create.argv,
          simcall->process_create.properties);
index dbf4d2c..13233a7 100644 (file)
@@ -223,6 +223,7 @@ typedef struct s_smx_simcall {
       xbt_main_func_t code;
       void *data;
       const char *hostname;
+      double kill_time;
       int argc;
       char **argv;
       xbt_dict_t properties;
index f21e5b9..455b98d 100644 (file)
@@ -343,6 +343,7 @@ e_smx_state_t simcall_host_execution_wait(smx_action_t execution)
  * \param data a pointer to any data one may want to attach to the new object. It is for user-level information and can be NULL.
  * It can be retrieved with the function \ref simcall_process_get_data.
  * \param hostname name of the host where the new agent is executed.
+ * \param kill_time time when the process is killed
  * \param argc first argument passed to \a code
  * \param argv second argument passed to \a code
  * \param properties the properties of the process
@@ -351,6 +352,7 @@ void simcall_process_create(smx_process_t *process, const char *name,
                               xbt_main_func_t code,
                               void *data,
                               const char *hostname,
+                              double kill_time,
                               int argc, char **argv,
                               xbt_dict_t properties)
 {
@@ -362,6 +364,7 @@ void simcall_process_create(smx_process_t *process, const char *name,
   simcall->process_create.code = code;
   simcall->process_create.data = data;
   simcall->process_create.hostname = hostname;
+  simcall->process_create.kill_time = kill_time;
   simcall->process_create.argc = argc;
   simcall->process_create.argv = argv;
   simcall->process_create.properties = properties;
index 27b671f..0470043 100644 (file)
@@ -362,11 +362,11 @@ XBT_INLINE void *lmm_variable_id(lmm_variable_t var)
 }
 
 static XBT_INLINE int saturated_constraint_set_update(lmm_system_t sys,
-                                                       lmm_constraint_t
-                                                       cnst,
-                                                       double *min_usage)
+                                                      lmm_constraint_t
+                                                      cnst,
+                                                      double *min_usage)
 {
-  lmm_constraint_t useless_cnst = NULL;
+  volatile double usage;
 
   XBT_IN("sys=%p, cnst=%p, min_usage=%f", sys, cnst, *min_usage);
   if (cnst->usage <= 0) {
@@ -377,17 +377,15 @@ static XBT_INLINE int saturated_constraint_set_update(lmm_system_t sys,
     XBT_OUT();
     return 1;
   }
-  if ((*min_usage < 0) || (*min_usage > cnst->remaining / cnst->usage)) {
-    *min_usage = cnst->remaining / cnst->usage;
+  usage = cnst->remaining / cnst->usage;
+  if (*min_usage < 0 || *min_usage > usage) {
+    *min_usage = usage;
     XBT_HERE(" min_usage=%f (cnst->remaining=%f, cnst->usage=%f)",
              *min_usage, cnst->remaining, cnst->usage);
-    while ((useless_cnst =
-            xbt_swag_getFirst(&(sys->saturated_constraint_set))))
-      xbt_swag_remove(useless_cnst, &(sys->saturated_constraint_set));
-
-    xbt_swag_insert(cnst, &(sys->saturated_constraint_set));
-  } else if (*min_usage == cnst->remaining / cnst->usage) {
-    xbt_swag_insert(cnst, &(sys->saturated_constraint_set));
+    xbt_swag_reset(&sys->saturated_constraint_set);
+    xbt_swag_insert(cnst, &sys->saturated_constraint_set);
+  } else if (*min_usage == usage) {
+    xbt_swag_insert(cnst, &sys->saturated_constraint_set);
   }
   XBT_OUT();
   return 0;
index 99517c0..d485ba3 100644 (file)
@@ -65,7 +65,7 @@ xbt_thread_t xbt_thread_create(const char *name, void_f_pvoid_t code,
   /*   char*name = bprintf("%s#%p",SIMIX_process_self_get_name(), param); */
   simcall_process_create(&res->s_process, name,
                            xbt_thread_create_wrapper, res,
-                           SIMIX_host_self_get_name(), 0, NULL,
+                           SIMIX_host_self_get_name(), -1.0, 0, NULL,
                            /*props */ NULL);
   res->joinable = joinable;
   res->done = 0;
index c8758a0..8e25f90 100644 (file)
@@ -18,7 +18,7 @@
 #include "xbt/datadesc.h"
 #include "xbt/file_stat.h"
 #include "../../src/xbt/datadesc/datadesc_private.h" // RAAAAH! ugly relative path, but it's late, I want it to be done NOW.
-#include "simix/simix.h"
+#include "simgrid/simix.h"
 #include "../../src/simix/smx_smurf_private.h" // RAAAAH! ugly relative path, but it's even later and it still doesn't work
 
 static void define_types(void) {