Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
NOT everything is master-slave (really)
authorFrederic Suter <frederic.suter@cc.in2p3.fr>
Thu, 24 Mar 2016 13:59:01 +0000 (14:59 +0100)
committerFrederic Suter <frederic.suter@cc.in2p3.fr>
Thu, 24 Mar 2016 14:07:17 +0000 (15:07 +0100)
  + create new process- "category" for migration, suspend and, kill examples

.gitignore
examples/msg/CMakeLists.txt
examples/msg/masterslave/CMakeLists.txt
examples/msg/masterslave/deployment_masterslave_kill.xml [deleted file]
examples/msg/masterslave/masterslave_kill.tesh [deleted file]
examples/msg/process-kill/process-kill.c [moved from examples/msg/masterslave/masterslave_kill.c with 59% similarity]
examples/msg/process-kill/process-kill.tesh [new file with mode: 0644]
examples/msg/process-migration/process-migration.c [moved from examples/msg/migration/migration.c with 100% similarity]
examples/msg/process-migration/process-migration.tesh [moved from examples/msg/migration/migration.tesh with 84% similarity]
examples/msg/process-suspend/process-suspend.c [moved from examples/msg/suspend/suspend.c with 100% similarity]
examples/msg/process-suspend/process-suspend.tesh [moved from examples/msg/suspend/suspend.tesh with 91% similarity]

index ef2f919..4ef4269 100644 (file)
@@ -151,7 +151,7 @@ examples/msg/masterslave/masterslave_arg
 examples/msg/masterslave/masterslave_cluster
 examples/msg/masterslave/masterslave_failure
 examples/msg/masterslave/masterslave_forwarder
-examples/msg/masterslave/masterslave_kill
+examples/msg/process-kill/process-kill
 examples/msg/masterslave/masterslave_mailbox
 examples/msg/masterslave/toto.txt
 examples/msg/mc/bugged1
@@ -169,7 +169,7 @@ examples/msg/mc/test/snapshot_comparison2
 examples/msg/mc/test/snapshot_comparison3
 examples/msg/mc/test/snapshot_comparison4
 examples/msg/mc/test/snapshot_comparison5
-examples/msg/migration/migration
+examples/msg/process-migration/process-migration
 examples/msg/ms.trace
 examples/msg/ns3/ns3
 examples/msg/pmm/pmm
@@ -181,10 +181,9 @@ examples/msg/sendrecv/sendrecv
 examples/msg/set-maestro/set-maestro
 examples/msg/simulation.trace
 examples/msg/start_kill_time/start_kill_time
-examples/msg/suspend/suspend
+examples/msg/process-suspend/process-suspend
 examples/msg/tasks.trace
 examples/msg/token_ring/token_ring
-examples/msg/toto.txt
 examples/msg/trace/test_trace_integration
 examples/msg/tracing/categories
 examples/msg/tracing/link_srcdst_user_variables
index e7cd8be..5dc73c5 100644 (file)
@@ -1,6 +1,6 @@
 foreach(x actions-mpi actions-storage async-wait async-waitall async-waitany dht-chord dht-pastry 
-          exception energy-consumption energy-onoff energy-pstate energy-ptask energy-vm 
-          migration pmm priority properties sendrecv set-maestro suspend start_kill_time synchro token_ring)
+          exception energy-consumption energy-onoff energy-pstate energy-ptask energy-vm pmm priority process-kill 
+          process-migration process-suspend properties sendrecv set-maestro start_kill_time synchro token_ring)
   add_executable       (${x}     ${x}/${x}.c)
   target_link_libraries(${x}     simgrid)
   set_target_properties(${x}  PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/${x})
@@ -42,8 +42,8 @@ set(xml_files    ${xml_files}     ${CMAKE_CURRENT_SOURCE_DIR}/actions-mpi/action
                                   ${CMAKE_CURRENT_SOURCE_DIR}/start_kill_time/start_d.xml
                                   ${CMAKE_CURRENT_SOURCE_DIR}/start_kill_time/start_kill_d.xml             PARENT_SCOPE)
 
-foreach(x actions-mpi actions-storage async-wait async-waitall async-waitany dht-chord migration priority properties
-        sendrecv suspend synchro start_kill_time token_ring)
+foreach(x actions-mpi actions-storage async-wait async-waitall async-waitany dht-chord priority process-kill
+        process-migration process-suspend properties sendrecv synchro start_kill_time token_ring)
   ADD_TESH_FACTORIES(msg-${x} "thread;ucontext;raw;boost" --setenv bindir=${CMAKE_BINARY_DIR}/examples/msg/${x} --setenv srcdir=${CMAKE_HOME_DIRECTORY}/examples/platforms --cd ${CMAKE_HOME_DIRECTORY}/examples/msg/${x} ${x}.tesh)
 endforeach()
 
index 61c4c46..cf1a238 100644 (file)
@@ -11,21 +11,16 @@ endforeach()
 
 add_executable       (masterslave_arg       masterslave_arg.c)
 target_link_libraries(masterslave_arg       simgrid)
-add_executable       (masterslave_kill      masterslave_kill.c)
-target_link_libraries(masterslave_kill      simgrid)
 
 ADD_TESH_FACTORIES(msg-masterslave             "thread;ucontext;raw;boost" --setenv srcdir=${CMAKE_HOME_DIRECTORY}/examples/msg --cd ${CMAKE_BINARY_DIR}/examples/msg ${CMAKE_HOME_DIRECTORY}/examples/msg/masterslave/masterslave_crosstraffic.tesh)
-ADD_TESH_FACTORIES(msg-masterslave-kill        "thread;ucontext;raw;boost" --setenv srcdir=${CMAKE_HOME_DIRECTORY}/examples/msg --cd ${CMAKE_BINARY_DIR}/examples/msg ${CMAKE_HOME_DIRECTORY}/examples/msg/masterslave/masterslave_kill.tesh)
 ADD_TESH_FACTORIES(msg-masterslave-multicore   "thread;ucontext;raw;boost" --setenv srcdir=${CMAKE_HOME_DIRECTORY}/examples/msg --cd ${CMAKE_BINARY_DIR}/examples/msg ${CMAKE_HOME_DIRECTORY}/examples/msg/masterslave/masterslave_multicore.tesh)
 ADD_TESH_FACTORIES(msg-masterslave-cpu-ti      "thread;ucontext;raw;boost" --setenv bindir=${CMAKE_BINARY_DIR}/examples/msg/masterslave --cd ${CMAKE_HOME_DIRECTORY}/examples/msg masterslave/masterslave_cpu_ti_crosstraffic.tesh)
 ADD_TESH_FACTORIES(msg-masterslave-vivaldi     "thread;ucontext;raw;boost" --setenv srcdir=${CMAKE_HOME_DIRECTORY}/examples/msg --cd ${CMAKE_BINARY_DIR}/examples/msg ${CMAKE_HOME_DIRECTORY}/examples/msg/masterslave/masterslave_vivaldi.tesh)
 ADD_TESH_FACTORIES(msg-masterslave-no-crosstraffic "thread;ucontext;raw;boost" --setenv srcdir=${CMAKE_HOME_DIRECTORY}/examples/msg --cd ${CMAKE_BINARY_DIR}/examples/msg ${CMAKE_HOME_DIRECTORY}/examples/msg/masterslave/masterslave.tesh)
 
-set(examples_src  ${examples_src}  ${CMAKE_CURRENT_SOURCE_DIR}/masterslave_arg.c
-                                   ${CMAKE_CURRENT_SOURCE_DIR}/masterslave_kill.c                          PARENT_SCOPE)
+set(examples_src  ${examples_src}  ${CMAKE_CURRENT_SOURCE_DIR}/masterslave_arg.c                           PARENT_SCOPE)
 set(tesh_files    ${tesh_files}    ${CMAKE_CURRENT_SOURCE_DIR}/masterslave.tesh
                                    ${CMAKE_CURRENT_SOURCE_DIR}/masterslave_crosstraffic.tesh
-                                   ${CMAKE_CURRENT_SOURCE_DIR}/masterslave_kill.tesh
                                    ${CMAKE_CURRENT_SOURCE_DIR}/masterslave_cpu_ti.tesh
                                    ${CMAKE_CURRENT_SOURCE_DIR}/masterslave_cpu_ti_crosstraffic.tesh
                                    ${CMAKE_CURRENT_SOURCE_DIR}/masterslave_cas01_im.tesh
@@ -33,7 +28,6 @@ set(tesh_files    ${tesh_files}    ${CMAKE_CURRENT_SOURCE_DIR}/masterslave.tesh
                                    ${CMAKE_CURRENT_SOURCE_DIR}/masterslave_vivaldi.tesh                    PARENT_SCOPE)
 set(xml_files   ${xml_files}       ${CMAKE_CURRENT_SOURCE_DIR}/deployment_masterslave_forwarder.xml
                                    ${CMAKE_CURRENT_SOURCE_DIR}/deployment_masterslave_mailbox.xml
-                                   ${CMAKE_CURRENT_SOURCE_DIR}/deployment_masterslave_kill.xml
                                    ${CMAKE_CURRENT_SOURCE_DIR}/deployment_masterslave_mailbox_multicore.xml
                                    ${CMAKE_CURRENT_SOURCE_DIR}/deployment_masterslave_vivaldi.xml
                                    ${CMAKE_CURRENT_SOURCE_DIR}/deployment_masterslave.xml                  PARENT_SCOPE)
diff --git a/examples/msg/masterslave/deployment_masterslave_kill.xml b/examples/msg/masterslave/deployment_masterslave_kill.xml
deleted file mode 100644 (file)
index ea69ac8..0000000
+++ /dev/null
@@ -1,5 +0,0 @@
-<?xml version='1.0'?>
-<!DOCTYPE platform SYSTEM "http://simgrid.gforge.inria.fr/simgrid/simgrid.dtd">
-<platform version="4">
-  <process host="Tremblay" function="master"/>
-</platform>
diff --git a/examples/msg/masterslave/masterslave_kill.tesh b/examples/msg/masterslave/masterslave_kill.tesh
deleted file mode 100644 (file)
index fb1aadb..0000000
+++ /dev/null
@@ -1,12 +0,0 @@
-#! ./tesh
-
-p Testing a simple master/slave example application
-
-$ $SG_TEST_EXENV masterslave/masterslave_kill$EXEEXT ${srcdir:=.}/../platforms/small_platform.xml ${srcdir:=.}/masterslave/deployment_masterslave_kill.xml --log=surf_maxmin.thres:error
-> [Tremblay:master:(1) 0.000000] [msg_test/INFO] Hello!
-> [Fafard:slave:(2) 0.000000] [msg_test/INFO] Hello!
-> [Fafard:slave:(2) 0.000000] [msg_test/INFO] Suspending myself
-> [Tremblay:master:(1) 10.000000] [msg_test/INFO] Resume process
-> [Tremblay:master:(1) 10.000000] [msg_test/INFO] Kill process
-> [Tremblay:master:(1) 10.000000] [msg_test/INFO] OK, goodbye now.
-> [10.000000] [msg_test/INFO] Simulation time 10
similarity index 59%
rename from examples/msg/masterslave/masterslave_kill.c
rename to examples/msg/process-kill/process-kill.c
index 365ebb3..d33e372 100644 (file)
@@ -8,31 +8,30 @@
 
 XBT_LOG_NEW_DEFAULT_CATEGORY(msg_test, "Messages specific for this msg example");
 
-/** Lazy guy function. This process suspends itself asap.  */
-static int slave(int argc, char *argv[])
+static int victim(int argc, char *argv[])
 {
   XBT_INFO("Hello!");
   XBT_INFO("Suspending myself");
   MSG_process_suspend(MSG_process_self());
   XBT_INFO("OK, OK. Let's work");
-  MSG_task_execute(MSG_task_create("toto", 1e9, 0, NULL));
+  MSG_task_execute(MSG_task_create("work", 1e9, 0, NULL));
   XBT_INFO("Bye!");
   return 0;
 }
 
-static int master(int argc, char *argv[])
+static int killer(int argc, char *argv[])
 {
-  msg_process_t bob = NULL;
+  msg_process_t poor_victim = NULL;
 
   XBT_INFO("Hello!");
-  bob = MSG_process_create("slave", slave, NULL, MSG_host_by_name("Fafard"));
+  poor_victim = MSG_process_create("victim", victim, NULL, MSG_host_by_name("Fafard"));
   MSG_process_sleep(10.0);
 
   XBT_INFO("Resume process");
-  MSG_process_resume(bob);
+  MSG_process_resume(poor_victim);
 
   XBT_INFO("Kill process");
-  MSG_process_kill(bob);
+  MSG_process_kill(poor_victim);
 
   XBT_INFO("OK, goodbye now.");
   return 0;
@@ -43,14 +42,13 @@ int main(int argc, char *argv[])
   msg_error_t res = MSG_OK;
 
   MSG_init(&argc, argv);
-  xbt_assert(argc > 2, "Usage: %s platform_file deployment_file\n"
-             "\tExample: %s msg_platform.xml msg_deployment_suspend.xml\n", argv[0], argv[0]);
+  xbt_assert(argc == 2, "Usage: %s platform_file\n\tExample: %s msg_platform.xml\n", argv[0], argv[0]);
 
   MSG_create_environment(argv[1]);
 
-  MSG_function_register("master", master);
-  MSG_function_register("slave", slave);
-  MSG_launch_application(argv[2]);
+  MSG_function_register("killer", killer);
+  MSG_function_register("victim", victim);
+  MSG_process_create("killer", killer, NULL, MSG_host_by_name("Tremblay"));
 
   res = MSG_main();
 
diff --git a/examples/msg/process-kill/process-kill.tesh b/examples/msg/process-kill/process-kill.tesh
new file mode 100644 (file)
index 0000000..4aad9c1
--- /dev/null
@@ -0,0 +1,12 @@
+#! ./tesh
+
+p Testing a MSG_process_kill function
+
+$ $SG_TEST_EXENV ${bindir:=.}/process-kill ${srcdir:=.}/small_platform.xml --log=surf_maxmin.thres:error
+> [Tremblay:killer:(1) 0.000000] [msg_test/INFO] Hello!
+> [Fafard:victim:(2) 0.000000] [msg_test/INFO] Hello!
+> [Fafard:victim:(2) 0.000000] [msg_test/INFO] Suspending myself
+> [Tremblay:killer:(1) 10.000000] [msg_test/INFO] Resume process
+> [Tremblay:killer:(1) 10.000000] [msg_test/INFO] Kill process
+> [Tremblay:killer:(1) 10.000000] [msg_test/INFO] OK, goodbye now.
+> [10.000000] [msg_test/INFO] Simulation time 10
@@ -3,7 +3,7 @@
 p Testing the migration feature of MSG
 
 ! output sort 19
-$ $SG_TEST_EXENV ${bindir:=.}/migration ${srcdir:=.}/platform.xml "--log=root.fmt:[%10.6r]%e(%i:%P@%h)%e%m%n"
+$ $SG_TEST_EXENV ${bindir:=.}/process-migration ${srcdir:=.}/platform.xml "--log=root.fmt:[%10.6r]%e(%i:%P@%h)%e%m%n"
 > [  0.000000] (1:emigrant@Jacquelin) I'll look for a new job on another machine where the grass is greener.
 > [  0.000000] (1:emigrant@Boivin) Yeah, found something to do
 > [  0.000000] (2:policeman@Boivin) Wait a bit before migrating the emigrant.
similarity index 91%
rename from examples/msg/suspend/suspend.tesh
rename to examples/msg/process-suspend/process-suspend.tesh
index 341ec90..41283ec 100644 (file)
@@ -3,7 +3,7 @@
 p Testing the suspend/resume feature of MSG
 
 ! output sort 19
-$ $SG_TEST_EXENV ${bindir:=.}/suspend ${srcdir:=.}/platform.xml "--log=root.fmt:[%10.6r]%e(%i:%P@%h)%e%m%n"
+$ $SG_TEST_EXENV ${bindir:=.}/process-suspend ${srcdir:=.}/platform.xml "--log=root.fmt:[%10.6r]%e(%i:%P@%h)%e%m%n"
 > [  0.000000] (1:dream_master@Jacquelin) Let's create a lazy guy.
 > [  0.000000] (1:dream_master@Jacquelin) Let's wait a little bit...
 > [  0.000000] (2:Lazy@Jacquelin) Nobody's watching me ? Let's go to sleep.