Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
convert and simplify msg/process-lifetime
authorFrederic Suter <frederic.suter@cc.in2p3.fr>
Wed, 4 Mar 2020 12:15:28 +0000 (13:15 +0100)
committerFrederic Suter <frederic.suter@cc.in2p3.fr>
Wed, 4 Mar 2020 12:15:28 +0000 (13:15 +0100)
14 files changed:
.gitignore
MANIFEST.in
examples/c/CMakeLists.txt
examples/c/actor-lifetime/actor-lifetime.c [new file with mode: 0644]
examples/c/actor-lifetime/actor-lifetime.tesh [new file with mode: 0644]
examples/c/actor-lifetime/actor-lifetime_d.xml [new file with mode: 0644]
examples/s4u/actor-lifetime/s4u-actor-lifetime.tesh
teshsuite/msg/CMakeLists.txt
teshsuite/msg/process-lifetime/baseline_d.xml [deleted file]
teshsuite/msg/process-lifetime/kill_d.xml [deleted file]
teshsuite/msg/process-lifetime/process-lifetime.c [deleted file]
teshsuite/msg/process-lifetime/process-lifetime.tesh [deleted file]
teshsuite/msg/process-lifetime/start_d.xml [deleted file]
teshsuite/msg/process-lifetime/start_kill_d.xml [deleted file]

index 80d0695..fe6000b 100644 (file)
@@ -122,18 +122,21 @@ examples/c/actor-daemon/actor-daemon-c
 examples/c/actor-exiting/actor-exiting-c
 examples/c/actor-join/actor-join-c
 examples/c/actor-kill/actor-kill-c
+examples/c/actor-lifetime/actor-lifetime-c
 examples/c/actor-migrate/actor-migrate-c
 examples/c/actor-suspend/actor-suspend-c
 examples/c/actor-yield/actor-yield-c
 examples/c/app-chainsend/app-chainsend-c
 examples/c/app-pingpong/app-pingpong-c
 examples/c/app-token-ring/app-token-ring-c
+examples/c/async-wait/async-wait-c
 examples/c/async-waitall/async-waitall-c
 examples/c/async-waitany/async-waitany-c
 examples/c/cloud-capping/cloud-capping-c
 examples/c/cloud-migration/cloud-migration-c
 examples/c/cloud-simple/cloud-simple-c
 examples/c/energy-exec/energy-exec-c
+examples/c/energy-exec-ptask/energy-exec-ptask-c
 examples/c/energy-vm/energy-vm-c
 examples/c/exec-dvfs/exec-dvfs-c
 examples/c/io-disk-raw/io-disk-raw-c
index f87c266..f0e936d 100644 (file)
@@ -27,6 +27,9 @@ include examples/c/actor-join/actor-join.c
 include examples/c/actor-join/actor-join.tesh
 include examples/c/actor-kill/actor-kill.c
 include examples/c/actor-kill/actor-kill.tesh
+include examples/c/actor-lifetime/actor-lifetime.c
+include examples/c/actor-lifetime/actor-lifetime.tesh
+include examples/c/actor-lifetime/actor-lifetime_d.xml
 include examples/c/actor-migrate/actor-migrate.c
 include examples/c/actor-migrate/actor-migrate.tesh
 include examples/c/actor-suspend/actor-suspend.c
@@ -667,12 +670,6 @@ include teshsuite/msg/io-file/io-file.tesh
 include teshsuite/msg/platform-properties/platform-properties.c
 include teshsuite/msg/platform-properties/platform-properties.tesh
 include teshsuite/msg/platform-properties/platform-properties_d.xml
-include teshsuite/msg/process-lifetime/baseline_d.xml
-include teshsuite/msg/process-lifetime/kill_d.xml
-include teshsuite/msg/process-lifetime/process-lifetime.c
-include teshsuite/msg/process-lifetime/process-lifetime.tesh
-include teshsuite/msg/process-lifetime/start_d.xml
-include teshsuite/msg/process-lifetime/start_kill_d.xml
 include teshsuite/msg/task-priority/task-priority.c
 include teshsuite/msg/task-priority/task-priority.tesh
 include teshsuite/msg/task-priority/task-priority_d.xml
index 6ceedc4..ed0ddcf 100644 (file)
@@ -2,7 +2,8 @@
 ######################################################################
 
 foreach(x
-        actor-create actor-daemon actor-exiting actor-join actor-kill actor-migrate actor-suspend actor-yield
+        actor-create actor-daemon actor-exiting actor-join actor-kill actor-lifetime actor-migrate actor-suspend 
+        actor-yield
         app-pingpong app-token-ring 
         async-wait async-waitall async-waitany
         cloud-capping cloud-migration cloud-simple
@@ -42,6 +43,7 @@ set(tesh_files    ${tesh_files} ${CMAKE_CURRENT_SOURCE_DIR}/app-chainsend/app-ch
                                 PARENT_SCOPE)
 
 set(xml_files     ${xml_files} ${CMAKE_CURRENT_SOURCE_DIR}/actor-create/actor-create_d.xml
+                               ${CMAKE_CURRENT_SOURCE_DIR}/actor-lifetime/actor-lifetime_d.xml
                                ${CMAKE_CURRENT_SOURCE_DIR}/actor-yield/actor-yield_d.xml
                                ${CMAKE_CURRENT_SOURCE_DIR}/app-chainsend/app-chainsend_d.xml
                                ${CMAKE_CURRENT_SOURCE_DIR}/app-pingpong/app-pingpong_d.xml
@@ -55,7 +57,8 @@ set(xml_files     ${xml_files} ${CMAKE_CURRENT_SOURCE_DIR}/actor-create/actor-cr
                                PARENT_SCOPE)
 
 foreach(x
-        actor-create actor-daemon actor-exiting actor-join actor-kill actor-migrate actor-suspend actor-yield
+        actor-create actor-daemon actor-exiting actor-join actor-kill actor-lifetime actor-migrate actor-suspend 
+        actor-yield
         app-chainsend app-pingpong app-token-ring
         async-wait async-waitall async-waitany
         cloud-capping cloud-migration cloud-simple
diff --git a/examples/c/actor-lifetime/actor-lifetime.c b/examples/c/actor-lifetime/actor-lifetime.c
new file mode 100644 (file)
index 0000000..f980f66
--- /dev/null
@@ -0,0 +1,48 @@
+/* Copyright (c) 2007-2020. The SimGrid Team. All rights reserved.          */
+
+/* This program is free software; you can redistribute it and/or modify it
+ * under the terms of the license (GNU LGPL) which comes with this package. */
+
+#include "simgrid/actor.h"
+#include "simgrid/engine.h"
+
+#include "xbt/asserts.h"
+#include "xbt/log.h"
+
+#include <stdio.h> /* snprintf */
+
+XBT_LOG_NEW_DEFAULT_CATEGORY(test, "Messages specific for this example");
+
+/* Executed on process termination*/
+static int my_onexit(XBT_ATTRIB_UNUSED int ignored1, XBT_ATTRIB_UNUSED void* ignored2)
+{
+  XBT_INFO("Exiting now (done sleeping or got killed)."); /* - Just display an informative message (see tesh file) */
+  return 0;
+}
+
+/* Just sleep until termination */
+static void sleeper(int argc, char* argv[])
+{
+  sg_actor_on_exit(my_onexit, NULL);
+
+  XBT_INFO("Hello! I go to sleep.");
+  sg_actor_sleep_for(10);
+  XBT_INFO("Done sleeping.");
+}
+
+int main(int argc, char* argv[])
+{
+  simgrid_init(&argc, argv);
+  xbt_assert(argc > 2,
+             "Usage: %s platform_file deployment_file\n"
+             "\tExample: %s msg_platform.xml msg_deployment.xml\n",
+             argv[0], argv[0]);
+
+  simgrid_load_platform(argv[1]); /* - Load the platform description */
+  simgrid_register_function("sleeper", sleeper);
+  simgrid_load_deployment(argv[2]); /* - Deploy the sleeper processes with explicit start/kill times */
+
+  simgrid_run(); /* - Run the simulation */
+
+  return 0;
+}
diff --git a/examples/c/actor-lifetime/actor-lifetime.tesh b/examples/c/actor-lifetime/actor-lifetime.tesh
new file mode 100644 (file)
index 0000000..ba0616e
--- /dev/null
@@ -0,0 +1,13 @@
+#!/usr/bin/env tesh
+
+$ ${bindir:=.}/actor-lifetime-c ${platfdir}/cluster_backbone.xml actor-lifetime_d.xml "--log=root.fmt:[%10.6r]%e(%i:%P@%h)%e%m%n"
+> [  0.000000] (1:sleeper@node-0.simgrid.org) Hello! I go to sleep.
+> [  0.000000] (2:sleeper@node-1.simgrid.org) Hello! I go to sleep.
+> [  2.000000] (3:sleeper@node-0.simgrid.org) Hello! I go to sleep.
+> [  3.000000] (2:sleeper@node-1.simgrid.org) Exiting now (done sleeping or got killed).
+> [  4.000000] (4:sleeper@node-2.simgrid.org) Hello! I go to sleep.
+> [  7.000000] (4:sleeper@node-2.simgrid.org) Exiting now (done sleeping or got killed).
+> [ 10.000000] (1:sleeper@node-0.simgrid.org) Done sleeping.
+> [ 10.000000] (1:sleeper@node-0.simgrid.org) Exiting now (done sleeping or got killed).
+> [ 12.000000] (3:sleeper@node-0.simgrid.org) Done sleeping.
+> [ 12.000000] (3:sleeper@node-0.simgrid.org) Exiting now (done sleeping or got killed).
diff --git a/examples/c/actor-lifetime/actor-lifetime_d.xml b/examples/c/actor-lifetime/actor-lifetime_d.xml
new file mode 100644 (file)
index 0000000..dd59a51
--- /dev/null
@@ -0,0 +1,8 @@
+<?xml version='1.0'?>
+<!DOCTYPE platform SYSTEM "https://simgrid.org/simgrid.dtd">
+<platform version="4.1">
+  <actor host="node-0.simgrid.org" function="sleeper"                              />
+  <actor host="node-0.simgrid.org" function="sleeper" start_time="2"               />
+  <actor host="node-1.simgrid.org" function="sleeper"                kill_time="3" />
+  <actor host="node-2.simgrid.org" function="sleeper" start_time="4" kill_time="7" />
+</platform>
index c3d3b15..082c112 100644 (file)
@@ -11,4 +11,3 @@ $ ${bindir:=.}/s4u-actor-lifetime ${platfdir}/cluster_backbone.xml s4u-actor-lif
 > [ 10.000000] (1:sleeper@node-0.simgrid.org) Exiting now (done sleeping or got killed).
 > [ 12.000000] (3:sleeper@node-0.simgrid.org) Done sleeping.
 > [ 12.000000] (3:sleeper@node-0.simgrid.org) Exiting now (done sleeping or got killed).
-
index a1f800b..e4dc4c4 100644 (file)
@@ -1,7 +1,6 @@
 # C examples
 foreach(x cloud-two-tasks
           get_sender
-          process-lifetime
           platform-properties
           io-file
           task-priority
@@ -46,10 +45,6 @@ set(tesh_files    ${tesh_files}    ${CMAKE_CURRENT_SOURCE_DIR}/app-bittorrent/ap
 set(bin_files    ${bin_files}      ${CMAKE_CURRENT_SOURCE_DIR}/app-bittorrent/generate.py                  PARENT_SCOPE)
 set(xml_files     ${xml_files}     ${CMAKE_CURRENT_SOURCE_DIR}/app-bittorrent/app-bittorrent_d.xml
                                    ${CMAKE_CURRENT_SOURCE_DIR}/platform-properties/platform-properties_d.xml
-                                   ${CMAKE_CURRENT_SOURCE_DIR}/process-lifetime/baseline_d.xml
-                                   ${CMAKE_CURRENT_SOURCE_DIR}/process-lifetime/kill_d.xml
-                                   ${CMAKE_CURRENT_SOURCE_DIR}/process-lifetime/start_d.xml
-                                   ${CMAKE_CURRENT_SOURCE_DIR}/process-lifetime/start_kill_d.xml
                                    ${CMAKE_CURRENT_SOURCE_DIR}/task-priority/task-priority_d.xml
                                    ${CMAKE_CURRENT_SOURCE_DIR}/trace_integration/test-hbp1.0-hbp1.0-hbp1.0.xml
                                    ${CMAKE_CURRENT_SOURCE_DIR}/trace_integration/test-hbp1.0-hbp3.0-hbp4.0.xml
@@ -71,7 +66,6 @@ if(enable_msg)
     host_on_off_processes
     get_sender
     task_destroy_cancel task_listen_from task_progress 
-    process-lifetime
     io-file
     platform-properties
     task-priority
diff --git a/teshsuite/msg/process-lifetime/baseline_d.xml b/teshsuite/msg/process-lifetime/baseline_d.xml
deleted file mode 100644 (file)
index c43dc77..0000000
+++ /dev/null
@@ -1,8 +0,0 @@
-<?xml version='1.0'?>
-<!DOCTYPE platform SYSTEM "https://simgrid.org/simgrid.dtd">
-<platform version="4.1">
-  <!-- Just sleeps for 10 seconds and quits -->
-  <actor host="node-0.simgrid.org" function="sleeper">  
-    <argument value="10"/>
-  </actor>
-</platform>
diff --git a/teshsuite/msg/process-lifetime/kill_d.xml b/teshsuite/msg/process-lifetime/kill_d.xml
deleted file mode 100644 (file)
index 1d386bc..0000000
+++ /dev/null
@@ -1,13 +0,0 @@
-<?xml version='1.0'?>
-<!DOCTYPE platform SYSTEM "https://simgrid.org/simgrid.dtd">
-<platform version="4.1">
-  <actor host="node-1.simgrid.org" function="sleeper" kill_time="6">
-    <argument value="10"/>
-  </actor>
-  <actor host="node-2.simgrid.org" function="sleeper" kill_time="6">
-    <argument value="6"/>
-  </actor>
-  <actor host="node-3.simgrid.org" function="sleeper" kill_time="10"> 
-    <argument value="6"/>
-  </actor>
-</platform>
diff --git a/teshsuite/msg/process-lifetime/process-lifetime.c b/teshsuite/msg/process-lifetime/process-lifetime.c
deleted file mode 100644 (file)
index 4454ee8..0000000
+++ /dev/null
@@ -1,45 +0,0 @@
-/* Copyright (c) 2007-2020. The SimGrid Team. All rights reserved.          */
-
-/* This program is free software; you can redistribute it and/or modify it
- * under the terms of the license (GNU LGPL) which comes with this package. */
-
-#include "simgrid/msg.h"
-
-#include <stdio.h> /* snprintf */
-
-XBT_LOG_NEW_DEFAULT_CATEGORY(msg_test, "Messages specific for this msg example");
-
-/* Executed on process termination*/
-static int my_onexit(XBT_ATTRIB_UNUSED int ignored1, XBT_ATTRIB_UNUSED void* ignored2)
-{
-  XBT_INFO("Exiting now (done sleeping or got killed)."); /* - Just display an informative message (see tesh file) */
-  return 0;
-}
-
-/* Just sleep until termination */
-static int sleeper(int argc, char* argv[])
-{
-  xbt_assert(argc == 2);
-  XBT_INFO("Hello! I go to sleep.");
-  MSG_process_on_exit(my_onexit, NULL);
-
-  MSG_process_sleep(xbt_str_parse_int(argv[1], "sleeper process expects an integer parameter but got %s"));
-  XBT_INFO("Done sleeping.");
-  return 0;
-}
-
-int main(int argc, char* argv[])
-{
-  MSG_init(&argc, argv);
-  xbt_assert(argc > 2, "Usage: %s platform_file deployment_file\n"
-                       "\tExample: %s msg_platform.xml msg_deployment.xml\n",
-             argv[0], argv[0]);
-
-  MSG_create_environment(argv[1]); /* - Load the platform description */
-  MSG_function_register("sleeper", sleeper);
-  MSG_launch_application(argv[2]); /* - Deploy the sleeper processes with explicit start/kill times */
-
-  msg_error_t res = MSG_main(); /* - Run the simulation */
-  XBT_INFO("Simulation time %g", MSG_get_clock());
-  return res != MSG_OK;
-}
diff --git a/teshsuite/msg/process-lifetime/process-lifetime.tesh b/teshsuite/msg/process-lifetime/process-lifetime.tesh
deleted file mode 100644 (file)
index 8f10283..0000000
+++ /dev/null
@@ -1,65 +0,0 @@
-#!/usr/bin/env tesh
-
-p Test0 Process without time
-
-$ ${bindir:=.}/process-lifetime ${platfdir}/cluster_backbone.xml ${srcdir:=.}/baseline_d.xml "--log=root.fmt:[%10.6r]%e(%i:%P@%h)%e%m%n"
-> [  0.000000] (1:sleeper@node-0.simgrid.org) Hello! I go to sleep.
-> [ 10.000000] (1:sleeper@node-0.simgrid.org) Done sleeping.
-> [ 10.000000] (1:sleeper@node-0.simgrid.org) Exiting now (done sleeping or got killed).
-> [ 10.000000] (0:maestro@) Simulation time 10
-
-p Test1 Process with start time
-
-$ ${bindir:=.}/process-lifetime ${platfdir}/cluster_backbone.xml ${srcdir:=.}/start_d.xml "--log=root.fmt:[%10.6r]%e(%i:%P@%h)%e%m%n"
-> [  0.000000] (1:sleeper@node-0.simgrid.org) Hello! I go to sleep.
-> [  1.000000] (2:sleeper@node-1.simgrid.org) Hello! I go to sleep.
-> [  2.000000] (3:sleeper@node-2.simgrid.org) Hello! I go to sleep.
-> [  3.000000] (4:sleeper@node-3.simgrid.org) Hello! I go to sleep.
-> [  4.000000] (5:sleeper@node-4.simgrid.org) Hello! I go to sleep.
-> [  5.000000] (6:sleeper@node-5.simgrid.org) Hello! I go to sleep.
-> [ 10.000000] (1:sleeper@node-0.simgrid.org) Done sleeping.
-> [ 10.000000] (1:sleeper@node-0.simgrid.org) Exiting now (done sleeping or got killed).
-> [ 11.000000] (2:sleeper@node-1.simgrid.org) Done sleeping.
-> [ 11.000000] (2:sleeper@node-1.simgrid.org) Exiting now (done sleeping or got killed).
-> [ 12.000000] (3:sleeper@node-2.simgrid.org) Done sleeping.
-> [ 12.000000] (3:sleeper@node-2.simgrid.org) Exiting now (done sleeping or got killed).
-> [ 13.000000] (4:sleeper@node-3.simgrid.org) Done sleeping.
-> [ 13.000000] (4:sleeper@node-3.simgrid.org) Exiting now (done sleeping or got killed).
-> [ 14.000000] (5:sleeper@node-4.simgrid.org) Done sleeping.
-> [ 14.000000] (5:sleeper@node-4.simgrid.org) Exiting now (done sleeping or got killed).
-> [ 15.000000] (6:sleeper@node-5.simgrid.org) Done sleeping.
-> [ 15.000000] (6:sleeper@node-5.simgrid.org) Exiting now (done sleeping or got killed).
-> [ 15.000000] (0:maestro@) Simulation time 15
-
-p Test1 Process with kill time
-
-! output sort
-$ ${bindir:=.}/process-lifetime ${platfdir}/cluster_backbone.xml ${srcdir:=.}/kill_d.xml "--log=root.fmt:[%10.6r]%e(%i:%P@%h)%e%m%n"
-> [  0.000000] (1:sleeper@node-1.simgrid.org) Hello! I go to sleep.
-> [  0.000000] (2:sleeper@node-2.simgrid.org) Hello! I go to sleep.
-> [  0.000000] (3:sleeper@node-3.simgrid.org) Hello! I go to sleep.
-> [  6.000000] (1:sleeper@node-1.simgrid.org) Exiting now (done sleeping or got killed).
-> [  6.000000] (2:sleeper@node-2.simgrid.org) Exiting now (done sleeping or got killed).
-> [  6.000000] (3:sleeper@node-3.simgrid.org) Done sleeping.
-> [  6.000000] (3:sleeper@node-3.simgrid.org) Exiting now (done sleeping or got killed).
-> [  6.000000] (0:maestro@) Simulation time 6
-
-p Test2 Process with start and kill times
-
-! output sort
-$ ${bindir:=.}/process-lifetime ${platfdir}/cluster_backbone.xml ${srcdir:=.}/start_kill_d.xml "--log=root.fmt:[%10.6r]%e(%i:%P@%h)%e%m%n"
-> [  0.000000] (1:sleeper@node-0.simgrid.org) Hello! I go to sleep.
-> [  1.000000] (2:sleeper@node-1.simgrid.org) Hello! I go to sleep.
-> [  2.000000] (3:sleeper@node-2.simgrid.org) Hello! I go to sleep.
-> [  3.000000] (4:sleeper@node-3.simgrid.org) Hello! I go to sleep.
-> [  4.000000] (5:sleeper@node-4.simgrid.org) Hello! I go to sleep.
-> [  5.000000] (1:sleeper@node-0.simgrid.org) Exiting now (done sleeping or got killed).
-> [  5.000000] (6:sleeper@node-5.simgrid.org) Hello! I go to sleep.
-> [  6.000000] (2:sleeper@node-1.simgrid.org) Exiting now (done sleeping or got killed).
-> [  6.000000] (3:sleeper@node-2.simgrid.org) Done sleeping.
-> [  6.000000] (3:sleeper@node-2.simgrid.org) Exiting now (done sleeping or got killed).
-> [  7.000000] (4:sleeper@node-3.simgrid.org) Done sleeping.
-> [  7.000000] (4:sleeper@node-3.simgrid.org) Exiting now (done sleeping or got killed).
-> [  9.000000] (5:sleeper@node-4.simgrid.org) Exiting now (done sleeping or got killed).
-> [ 10.000000] (6:sleeper@node-5.simgrid.org) Exiting now (done sleeping or got killed).
-> [ 10.000000] (0:maestro@) Simulation time 10
diff --git a/teshsuite/msg/process-lifetime/start_d.xml b/teshsuite/msg/process-lifetime/start_d.xml
deleted file mode 100644 (file)
index e26d0c8..0000000
+++ /dev/null
@@ -1,22 +0,0 @@
-<?xml version='1.0'?>
-<!DOCTYPE platform SYSTEM "https://simgrid.org/simgrid.dtd">
-<platform version="4.1">
-  <actor host="node-0.simgrid.org" function="sleeper" start_time="0">
-    <argument value="10"/>
-  </actor>
-  <actor host="node-1.simgrid.org" function="sleeper" start_time="1">
-    <argument value="10"/>
-  </actor>
-  <actor host="node-2.simgrid.org" function="sleeper" start_time="2">
-    <argument value="10"/>
-  </actor>
-  <actor host="node-3.simgrid.org" function="sleeper" start_time="3">
-    <argument value="10"/>
-  </actor>
-  <actor host="node-4.simgrid.org" function="sleeper" start_time="4">
-    <argument value="10"/>
-  </actor>
-  <actor host="node-5.simgrid.org" function="sleeper" start_time="5">
-    <argument value="10"/>
-  </actor>
-</platform>
diff --git a/teshsuite/msg/process-lifetime/start_kill_d.xml b/teshsuite/msg/process-lifetime/start_kill_d.xml
deleted file mode 100644 (file)
index 86c3266..0000000
+++ /dev/null
@@ -1,22 +0,0 @@
-<?xml version='1.0'?>
-<!DOCTYPE platform SYSTEM "https://simgrid.org/simgrid.dtd">
-<platform version="4.1">
-  <actor host="node-0.simgrid.org" function="sleeper" start_time="0" kill_time="5">
-    <argument value="10"/>
-  </actor>
-  <actor host="node-1.simgrid.org" function="sleeper" start_time="1" kill_time="6">
-    <argument value="10"/>
-  </actor>
-  <actor host="node-2.simgrid.org" function="sleeper" start_time="2" kill_time="7">
-    <argument value="4" />
-  </actor>
-  <actor host="node-3.simgrid.org" function="sleeper" start_time="3" kill_time="8">
-    <argument value="4" />
-  </actor>
-  <actor host="node-4.simgrid.org" function="sleeper" start_time="4" kill_time="9">
-    <argument value="5" />
-  </actor>
-  <actor host="node-5.simgrid.org" function="sleeper" start_time="5" kill_time="10">
-    <argument value="5"/>
-  </actor>
-</platform>