From: Frederic Suter Date: Thu, 24 Mar 2016 13:59:01 +0000 (+0100) Subject: NOT everything is master-slave (really) X-Git-Tag: v3_13~307 X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/commitdiff_plain/5efe03db9d3a38dc14af6bd0711a5536605c8cd6 NOT everything is master-slave (really) + create new process- "category" for migration, suspend and, kill examples --- diff --git a/.gitignore b/.gitignore index ef2f919927..4ef4269f87 100644 --- a/.gitignore +++ b/.gitignore @@ -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 diff --git a/examples/msg/CMakeLists.txt b/examples/msg/CMakeLists.txt index e7cd8be4b1..5dc73c5c65 100644 --- a/examples/msg/CMakeLists.txt +++ b/examples/msg/CMakeLists.txt @@ -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() diff --git a/examples/msg/masterslave/CMakeLists.txt b/examples/msg/masterslave/CMakeLists.txt index 61c4c4657e..cf1a238f32 100644 --- a/examples/msg/masterslave/CMakeLists.txt +++ b/examples/msg/masterslave/CMakeLists.txt @@ -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 index ea69ac8dc1..0000000000 --- a/examples/msg/masterslave/deployment_masterslave_kill.xml +++ /dev/null @@ -1,5 +0,0 @@ - - - - - diff --git a/examples/msg/masterslave/masterslave_kill.tesh b/examples/msg/masterslave/masterslave_kill.tesh deleted file mode 100644 index fb1aadb026..0000000000 --- a/examples/msg/masterslave/masterslave_kill.tesh +++ /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 diff --git a/examples/msg/masterslave/masterslave_kill.c b/examples/msg/process-kill/process-kill.c similarity index 59% rename from examples/msg/masterslave/masterslave_kill.c rename to examples/msg/process-kill/process-kill.c index 365ebb3427..d33e3724c0 100644 --- a/examples/msg/masterslave/masterslave_kill.c +++ b/examples/msg/process-kill/process-kill.c @@ -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 index 0000000000..4aad9c16ae --- /dev/null +++ b/examples/msg/process-kill/process-kill.tesh @@ -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 diff --git a/examples/msg/migration/migration.c b/examples/msg/process-migration/process-migration.c similarity index 100% rename from examples/msg/migration/migration.c rename to examples/msg/process-migration/process-migration.c diff --git a/examples/msg/migration/migration.tesh b/examples/msg/process-migration/process-migration.tesh similarity index 84% rename from examples/msg/migration/migration.tesh rename to examples/msg/process-migration/process-migration.tesh index ec8c9000a5..2c2ed7c165 100644 --- a/examples/msg/migration/migration.tesh +++ b/examples/msg/process-migration/process-migration.tesh @@ -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. diff --git a/examples/msg/suspend/suspend.c b/examples/msg/process-suspend/process-suspend.c similarity index 100% rename from examples/msg/suspend/suspend.c rename to examples/msg/process-suspend/process-suspend.c diff --git a/examples/msg/suspend/suspend.tesh b/examples/msg/process-suspend/process-suspend.tesh similarity index 91% rename from examples/msg/suspend/suspend.tesh rename to examples/msg/process-suspend/process-suspend.tesh index 341ec900f1..41283ec5c5 100644 --- a/examples/msg/suspend/suspend.tesh +++ b/examples/msg/process-suspend/process-suspend.tesh @@ -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.