From 056fcda8802174e02762ca38474eae060fd55aa2 Mon Sep 17 00:00:00 2001 From: Frederic Suter Date: Thu, 13 Feb 2020 07:23:40 +0100 Subject: [PATCH 1/1] convert cloud simple --- MANIFEST.in | 4 +- examples/c/CMakeLists.txt | 4 +- examples/c/cloud-simple/cloud-simple.c | 247 ++++++++++++++++ examples/c/cloud-simple/cloud-simple.tesh | 54 ++++ teshsuite/msg/CMakeLists.txt | 4 +- teshsuite/msg/cloud-simple/cloud-simple.c | 283 ------------------- teshsuite/msg/cloud-simple/cloud-simple.tesh | 56 ---- 7 files changed, 308 insertions(+), 344 deletions(-) create mode 100644 examples/c/cloud-simple/cloud-simple.c create mode 100644 examples/c/cloud-simple/cloud-simple.tesh delete mode 100644 teshsuite/msg/cloud-simple/cloud-simple.c delete mode 100644 teshsuite/msg/cloud-simple/cloud-simple.tesh diff --git a/MANIFEST.in b/MANIFEST.in index 7db7a4ae31..5463085b75 100644 --- a/MANIFEST.in +++ b/MANIFEST.in @@ -45,6 +45,8 @@ include examples/c/async-waitall/async-waitall_d.xml include examples/c/async-waitany/async-waitany.c include examples/c/async-waitany/async-waitany.tesh include examples/c/async-waitany/async-waitany_d.xml +include examples/c/cloud-simple/cloud-simple.c +include examples/c/cloud-simple/cloud-simple.tesh include examples/c/energy-exec/energy-exec.c include examples/c/energy-exec/energy-exec.tesh include examples/c/io-disk-raw/io-disk-raw.c @@ -645,8 +647,6 @@ include teshsuite/msg/cloud-capping/cloud-capping.c include teshsuite/msg/cloud-capping/cloud-capping.tesh include teshsuite/msg/cloud-migration/cloud-migration.c include teshsuite/msg/cloud-migration/cloud-migration.tesh -include teshsuite/msg/cloud-simple/cloud-simple.c -include teshsuite/msg/cloud-simple/cloud-simple.tesh include teshsuite/msg/cloud-two-tasks/cloud-two-tasks.c include teshsuite/msg/cloud-two-tasks/cloud-two-tasks.tesh include teshsuite/msg/energy-pstate/energy-pstate.c diff --git a/examples/c/CMakeLists.txt b/examples/c/CMakeLists.txt index 23e2e054bc..f3099042ff 100644 --- a/examples/c/CMakeLists.txt +++ b/examples/c/CMakeLists.txt @@ -1,7 +1,8 @@ foreach(x actor-create actor-daemon actor-exiting actor-join actor-kill actor-migrate actor-suspend actor-yield app-pingpong app-token-ring - async-waitall async-waitany + async-waitall async-waitany + cloud-simple energy-exec io-disk-raw) add_executable (${x}-c EXCLUDE_FROM_ALL ${x}/${x}.c) @@ -27,6 +28,7 @@ foreach(x actor-create actor-daemon actor-exiting actor-join actor-kill actor-migrate actor-suspend actor-yield app-pingpong app-token-ring async-waitall async-waitany + cloud-simple energy-exec io-disk-raw) ADD_TESH(c-${x} --setenv platfdir=${CMAKE_HOME_DIRECTORY}/examples/platforms diff --git a/examples/c/cloud-simple/cloud-simple.c b/examples/c/cloud-simple/cloud-simple.c new file mode 100644 index 0000000000..2247ee7256 --- /dev/null +++ b/examples/c/cloud-simple/cloud-simple.c @@ -0,0 +1,247 @@ +/* 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 "simgrid/host.h" +#include "simgrid/mailbox.h" +#include "simgrid/plugins/live_migration.h" +#include "simgrid/vm.h" +#include "xbt/log.h" +#include "xbt/str.h" +#include "xbt/sysdep.h" + +XBT_LOG_NEW_DEFAULT_CATEGORY(cloud_simple, "Messages specific for this example"); + +static void computation_fun(XBT_ATTRIB_UNUSED int argc, XBT_ATTRIB_UNUSED char* argv[]) +{ + const char* pr_name = sg_actor_get_name(sg_actor_self()); + const char* host_name = sg_host_get_name(sg_host_self()); + + double clock_sta = simgrid_get_clock(); + sg_actor_self_execute(1000000); + double clock_end = simgrid_get_clock(); + + XBT_INFO("%s:%s task executed %g", host_name, pr_name, clock_end - clock_sta); +} + +static void launch_computation_worker(sg_host_t host) +{ + sg_actor_t actor = sg_actor_init("compute", host); + sg_actor_start(actor, computation_fun, 0, NULL); +} + +struct task_priv { + sg_host_t tx_host; + sg_actor_t tx_proc; + double clock_sta; +}; + +static void communication_tx_fun(int argc, char* argv[]) +{ + xbt_assert(argc == 2); + sg_mailbox_t mbox = sg_mailbox_by_name(argv[1]); + + struct task_priv* priv = xbt_new(struct task_priv, 1); + priv->tx_proc = sg_actor_self(); + priv->tx_host = sg_host_self(); + priv->clock_sta = simgrid_get_clock(); + + sg_mailbox_put(mbox, priv, 1000000); +} + +static void communication_rx_fun(int argc, char* argv[]) +{ + const char* pr_name = sg_actor_get_name(sg_actor_self()); + const char* host_name = sg_host_get_name(sg_host_self()); + xbt_assert(argc == 2); + sg_mailbox_t mbox = sg_mailbox_by_name(argv[1]); + + struct task_priv* priv = (struct task_priv*)sg_mailbox_get(mbox); + double clock_end = simgrid_get_clock(); + + XBT_INFO("%s:%s to %s:%s => %g sec", sg_host_get_name(priv->tx_host), sg_actor_get_name(priv->tx_proc), host_name, + pr_name, clock_end - priv->clock_sta); + + free(priv); +} + +static void launch_communication_worker(sg_host_t tx_host, sg_host_t rx_host) +{ + char* mbox = bprintf("MBOX:%s-%s", sg_host_get_name(tx_host), sg_host_get_name(rx_host)); + + const char* tx_argv[] = {"comm_tx", mbox, NULL}; + + sg_actor_t tx = sg_actor_init("comm_tx", tx_host); + sg_actor_start(tx, communication_tx_fun, 2, tx_argv); + + const char* rx_argv[] = {"comm_rx", mbox, NULL}; + + sg_actor_t rx = sg_actor_init("comm_rx", rx_host); + sg_actor_start(rx, communication_rx_fun, 2, rx_argv); + + xbt_free(mbox); +} + +static void master_main(XBT_ATTRIB_UNUSED int argc, XBT_ATTRIB_UNUSED char* argv[]) +{ + sg_host_t pm0 = sg_host_by_name("Fafard"); + sg_host_t pm1 = sg_host_by_name("Tremblay"); + sg_host_t pm2 = sg_host_by_name("Bourassa"); + + XBT_INFO("## Test 1 (started): check computation on normal PMs"); + + XBT_INFO("### Put a task on a PM"); + launch_computation_worker(pm0); + sg_actor_sleep_for(2); + + XBT_INFO("### Put two tasks on a PM"); + launch_computation_worker(pm0); + launch_computation_worker(pm0); + sg_actor_sleep_for(2); + + XBT_INFO("### Put a task on each PM"); + launch_computation_worker(pm0); + launch_computation_worker(pm1); + sg_actor_sleep_for(2); + + XBT_INFO("## Test 1 (ended)"); + + XBT_INFO("## Test 2 (started): check impact of running a task inside a VM (there is no degradation for the moment)"); + + XBT_INFO("### Put a VM on a PM, and put a task to the VM"); + sg_vm_t vm0 = sg_vm_create_core(pm0, "VM0"); + sg_vm_start(vm0); + launch_computation_worker((sg_host_t)vm0); + sg_actor_sleep_for(2); + sg_vm_destroy(vm0); + + XBT_INFO("## Test 2 (ended)"); + + XBT_INFO( + "## Test 3 (started): check impact of running a task collocated with a VM (there is no VM noise for the moment)"); + + XBT_INFO("### Put a VM on a PM, and put a task to the PM"); + vm0 = sg_vm_create_core(pm0, "VM0"); + sg_vm_start(vm0); + launch_computation_worker(pm0); + sg_actor_sleep_for(2); + sg_vm_destroy(vm0); + + XBT_INFO("## Test 3 (ended)"); + + XBT_INFO("## Test 4 (started): compare the cost of running two tasks inside two different VMs collocated or not (for" + " the moment, there is no degradation for the VMs. Hence, the time should be equals to the time of test 1"); + + XBT_INFO("### Put two VMs on a PM, and put a task to each VM"); + vm0 = sg_vm_create_core(pm0, "VM0"); + sg_vm_t vm1 = sg_vm_create_core(pm0, "VM1"); + sg_vm_start(vm0); + sg_vm_start(vm1); + launch_computation_worker((sg_host_t)vm0); + launch_computation_worker((sg_host_t)vm1); + sg_actor_sleep_for(2); + sg_vm_destroy(vm0); + sg_vm_destroy(vm1); + + XBT_INFO("### Put a VM on each PM, and put a task to each VM"); + vm0 = sg_vm_create_core(pm0, "VM0"); + vm1 = sg_vm_create_core(pm1, "VM1"); + sg_vm_start(vm0); + sg_vm_start(vm1); + launch_computation_worker((sg_host_t)vm0); + launch_computation_worker((sg_host_t)vm1); + sg_actor_sleep_for(2); + sg_vm_destroy(vm0); + sg_vm_destroy(vm1); + XBT_INFO("## Test 4 (ended)"); + + XBT_INFO("## Test 5 (started): Analyse network impact"); + XBT_INFO("### Make a connection between PM0 and PM1"); + launch_communication_worker(pm0, pm1); + sg_actor_sleep_for(5); + + XBT_INFO("### Make two connection between PM0 and PM1"); + launch_communication_worker(pm0, pm1); + launch_communication_worker(pm0, pm1); + sg_actor_sleep_for(5); + + XBT_INFO("### Make a connection between PM0 and VM0@PM0"); + vm0 = sg_vm_create_core(pm0, "VM0"); + sg_vm_start(vm0); + launch_communication_worker(pm0, (sg_host_t)vm0); + sg_actor_sleep_for(5); + sg_vm_destroy(vm0); + + XBT_INFO("### Make a connection between PM0 and VM0@PM1"); + vm0 = sg_vm_create_core(pm1, "VM0"); + sg_vm_start(vm0); + launch_communication_worker(pm0, (sg_host_t)vm0); + sg_actor_sleep_for(5); + sg_vm_destroy(vm0); + + XBT_INFO("### Make two connections between PM0 and VM0@PM1"); + vm0 = sg_vm_create_core(pm1, "VM0"); + sg_vm_start(vm0); + launch_communication_worker(pm0, (sg_host_t)vm0); + launch_communication_worker(pm0, (sg_host_t)vm0); + sg_actor_sleep_for(5); + sg_vm_destroy(vm0); + + XBT_INFO("### Make a connection between PM0 and VM0@PM1, and also make a connection between PM0 and PM1"); + vm0 = sg_vm_create_core(pm1, "VM0"); + sg_vm_start(vm0); + launch_communication_worker(pm0, (sg_host_t)vm0); + launch_communication_worker(pm0, pm1); + sg_actor_sleep_for(5); + sg_vm_destroy(vm0); + + XBT_INFO("### Make a connection between VM0@PM0 and PM1@PM1, and also make a connection between VM0@PM0 and VM1@PM1"); + vm0 = sg_vm_create_core(pm0, "VM0"); + vm1 = sg_vm_create_core(pm1, "VM1"); + sg_vm_start(vm0); + sg_vm_start(vm1); + launch_communication_worker((sg_host_t)vm0, (sg_host_t)vm1); + launch_communication_worker((sg_host_t)vm0, (sg_host_t)vm1); + sg_actor_sleep_for(5); + sg_vm_destroy(vm0); + sg_vm_destroy(vm1); + + XBT_INFO("## Test 5 (ended)"); + + XBT_INFO("## Test 6 (started): Check migration impact (not yet implemented neither on the CPU resource nor on the" + " network one"); + XBT_INFO("### Relocate VM0 between PM0 and PM1"); + vm0 = sg_vm_create_core(pm0, "VM0"); + sg_vm_set_ramsize(vm0, 1L * 1024 * 1024 * 1024); // 1GiB + + sg_vm_start(vm0); + launch_communication_worker((sg_host_t)vm0, pm2); + sg_actor_sleep_for(0.01); + sg_vm_migrate(vm0, pm1); + sg_actor_sleep_for(0.01); + sg_vm_migrate(vm0, pm0); + sg_actor_sleep_for(5); + sg_vm_destroy(vm0); + XBT_INFO("## Test 6 (ended)"); +} + +int main(int argc, char* argv[]) +{ + /* Get the arguments */ + simgrid_init(&argc, argv); + sg_vm_live_migration_plugin_init(); + + /* load the platform file */ + simgrid_load_platform(argv[1]); + + sg_actor_t actor = sg_actor_init("master_", sg_host_by_name("Fafard")); + sg_actor_start(actor, master_main, 0, NULL); + + simgrid_run(); + XBT_INFO("Simulation time %g", simgrid_get_clock()); + + return 0; +} diff --git a/examples/c/cloud-simple/cloud-simple.tesh b/examples/c/cloud-simple/cloud-simple.tesh new file mode 100644 index 0000000000..ea5d2cb94b --- /dev/null +++ b/examples/c/cloud-simple/cloud-simple.tesh @@ -0,0 +1,54 @@ +#!/usr/bin/env tesh + +$ ${bindir:=.}/cloud-simple-c --log=no_loc ${platfdir}/small_platform.xml +> [Fafard:master_:(1) 0.000000] [cloud_simple/INFO] ## Test 1 (started): check computation on normal PMs +> [Fafard:master_:(1) 0.000000] [cloud_simple/INFO] ### Put a task on a PM +> [Fafard:compute:(2) 0.013107] [cloud_simple/INFO] Fafard:compute task executed 0.0131068 +> [Fafard:master_:(1) 2.000000] [cloud_simple/INFO] ### Put two tasks on a PM +> [Fafard:compute:(4) 2.026214] [cloud_simple/INFO] Fafard:compute task executed 0.0262137 +> [Fafard:compute:(3) 2.026214] [cloud_simple/INFO] Fafard:compute task executed 0.0262137 +> [Fafard:master_:(1) 4.000000] [cloud_simple/INFO] ### Put a task on each PM +> [Tremblay:compute:(6) 4.010194] [cloud_simple/INFO] Tremblay:compute task executed 0.0101942 +> [Fafard:compute:(5) 4.013107] [cloud_simple/INFO] Fafard:compute task executed 0.0131068 +> [Fafard:master_:(1) 6.000000] [cloud_simple/INFO] ## Test 1 (ended) +> [Fafard:master_:(1) 6.000000] [cloud_simple/INFO] ## Test 2 (started): check impact of running a task inside a VM (there is no degradation for the moment) +> [Fafard:master_:(1) 6.000000] [cloud_simple/INFO] ### Put a VM on a PM, and put a task to the VM +> [VM0:compute:(7) 6.013107] [cloud_simple/INFO] VM0:compute task executed 0.0131068 +> [Fafard:master_:(1) 8.000000] [cloud_simple/INFO] ## Test 2 (ended) +> [Fafard:master_:(1) 8.000000] [cloud_simple/INFO] ## Test 3 (started): check impact of running a task collocated with a VM (there is no VM noise for the moment) +> [Fafard:master_:(1) 8.000000] [cloud_simple/INFO] ### Put a VM on a PM, and put a task to the PM +> [Fafard:compute:(8) 8.013107] [cloud_simple/INFO] Fafard:compute task executed 0.0131068 +> [Fafard:master_:(1) 10.000000] [cloud_simple/INFO] ## Test 3 (ended) +> [Fafard:master_:(1) 10.000000] [cloud_simple/INFO] ## Test 4 (started): compare the cost of running two tasks inside two different VMs collocated or not (for the moment, there is no degradation for the VMs. Hence, the time should be equals to the time of test 1 +> [Fafard:master_:(1) 10.000000] [cloud_simple/INFO] ### Put two VMs on a PM, and put a task to each VM +> [VM0:compute:(9) 10.026214] [cloud_simple/INFO] VM0:compute task executed 0.0262137 +> [VM1:compute:(10) 10.026214] [cloud_simple/INFO] VM1:compute task executed 0.0262137 +> [Fafard:master_:(1) 12.000000] [cloud_simple/INFO] ### Put a VM on each PM, and put a task to each VM +> [VM1:compute:(12) 12.010194] [cloud_simple/INFO] VM1:compute task executed 0.0101942 +> [VM0:compute:(11) 12.013107] [cloud_simple/INFO] VM0:compute task executed 0.0131068 +> [Fafard:master_:(1) 14.000000] [cloud_simple/INFO] ## Test 4 (ended) +> [Fafard:master_:(1) 14.000000] [cloud_simple/INFO] ## Test 5 (started): Analyse network impact +> [Fafard:master_:(1) 14.000000] [cloud_simple/INFO] ### Make a connection between PM0 and PM1 +> [Tremblay:comm_rx:(14) 14.158397] [cloud_simple/INFO] Fafard:comm_tx to Tremblay:comm_rx => 0.158397 sec +> [Fafard:master_:(1) 19.000000] [cloud_simple/INFO] ### Make two connection between PM0 and PM1 +> [Tremblay:comm_rx:(18) 19.291085] [cloud_simple/INFO] Fafard:comm_tx to Tremblay:comm_rx => 0.291085 sec +> [Tremblay:comm_rx:(16) 19.291085] [cloud_simple/INFO] Fafard:comm_tx to Tremblay:comm_rx => 0.291085 sec +> [Fafard:master_:(1) 24.000000] [cloud_simple/INFO] ### Make a connection between PM0 and VM0@PM0 +> [VM0:comm_rx:(20) 24.002265] [cloud_simple/INFO] Fafard:comm_tx to VM0:comm_rx => 0.00226529 sec +> [Fafard:master_:(1) 29.000000] [cloud_simple/INFO] ### Make a connection between PM0 and VM0@PM1 +> [VM0:comm_rx:(22) 29.158397] [cloud_simple/INFO] Fafard:comm_tx to VM0:comm_rx => 0.158397 sec +> [Fafard:master_:(1) 34.000000] [cloud_simple/INFO] ### Make two connections between PM0 and VM0@PM1 +> [VM0:comm_rx:(26) 34.291085] [cloud_simple/INFO] Fafard:comm_tx to VM0:comm_rx => 0.291085 sec +> [VM0:comm_rx:(24) 34.291085] [cloud_simple/INFO] Fafard:comm_tx to VM0:comm_rx => 0.291085 sec +> [Fafard:master_:(1) 39.000000] [cloud_simple/INFO] ### Make a connection between PM0 and VM0@PM1, and also make a connection between PM0 and PM1 +> [Tremblay:comm_rx:(30) 39.291085] [cloud_simple/INFO] Fafard:comm_tx to Tremblay:comm_rx => 0.291085 sec +> [VM0:comm_rx:(28) 39.291085] [cloud_simple/INFO] Fafard:comm_tx to VM0:comm_rx => 0.291085 sec +> [Fafard:master_:(1) 44.000000] [cloud_simple/INFO] ### Make a connection between VM0@PM0 and PM1@PM1, and also make a connection between VM0@PM0 and VM1@PM1 +> [VM1:comm_rx:(34) 44.291085] [cloud_simple/INFO] VM0:comm_tx to VM1:comm_rx => 0.291085 sec +> [VM1:comm_rx:(32) 44.291085] [cloud_simple/INFO] VM0:comm_tx to VM1:comm_rx => 0.291085 sec +> [Fafard:master_:(1) 49.000000] [cloud_simple/INFO] ## Test 5 (ended) +> [Fafard:master_:(1) 49.000000] [cloud_simple/INFO] ## Test 6 (started): Check migration impact (not yet implemented neither on the CPU resource nor on the network one +> [Fafard:master_:(1) 49.000000] [cloud_simple/INFO] ### Relocate VM0 between PM0 and PM1 +> [Bourassa:comm_rx:(36) 49.204993] [cloud_simple/INFO] VM0:comm_tx to Bourassa:comm_rx => 0.204993 sec +> [Fafard:master_:(1) 339.199251] [cloud_simple/INFO] ## Test 6 (ended) +> [339.199251] [cloud_simple/INFO] Simulation time 339.199 diff --git a/teshsuite/msg/CMakeLists.txt b/teshsuite/msg/CMakeLists.txt index 0881eb084d..c7b3badbc2 100644 --- a/teshsuite/msg/CMakeLists.txt +++ b/teshsuite/msg/CMakeLists.txt @@ -1,6 +1,6 @@ # C examples foreach(x async-wait - cloud-capping cloud-migration cloud-two-tasks cloud-simple + cloud-capping cloud-migration cloud-two-tasks get_sender host_on_off host_on_off_recv process-lifetime energy-ptask energy-pstate platform-properties @@ -88,7 +88,7 @@ if(enable_msg) foreach(x async-wait app-bittorrent app-chainsend - cloud-capping cloud-migration cloud-two-tasks cloud-simple + cloud-capping cloud-migration cloud-two-tasks energy-pstate host_on_off host_on_off_processes host_on_off_recv get_sender diff --git a/teshsuite/msg/cloud-simple/cloud-simple.c b/teshsuite/msg/cloud-simple/cloud-simple.c deleted file mode 100644 index 9c96a2c4c2..0000000000 --- a/teshsuite/msg/cloud-simple/cloud-simple.c +++ /dev/null @@ -1,283 +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 "simgrid/plugins/live_migration.h" - -XBT_LOG_NEW_DEFAULT_CATEGORY(msg_test, "Messages specific for this msg example"); - -static int computation_fun(XBT_ATTRIB_UNUSED int argc, XBT_ATTRIB_UNUSED char* argv[]) -{ - const char* pr_name = MSG_process_get_name(MSG_process_self()); - const char* host_name = MSG_host_get_name(MSG_host_self()); - - msg_task_t task = MSG_task_create("Task", 1000000, 1000000, NULL); - - double clock_sta = MSG_get_clock(); - MSG_task_execute(task); - double clock_end = MSG_get_clock(); - - XBT_INFO("%s:%s task executed %g", host_name, pr_name, clock_end - clock_sta); - - MSG_task_destroy(task); - - return 0; -} - -static void launch_computation_worker(msg_host_t host) -{ - const char* pr_name = "compute"; - char** argv = xbt_new(char*, 2); - argv[0] = xbt_strdup(pr_name); - argv[1] = NULL; - - MSG_process_create_with_arguments(pr_name, computation_fun, NULL, host, 1, argv); -} - -struct task_priv { - msg_host_t tx_host; - msg_process_t tx_proc; - double clock_sta; -}; - -static int communication_tx_fun(int argc, char* argv[]) -{ - xbt_assert(argc == 2); - const char* mbox = argv[1]; - - msg_task_t task = MSG_task_create("Task", 1000000, 1000000, NULL); - - struct task_priv* priv = xbt_new(struct task_priv, 1); - priv->tx_proc = MSG_process_self(); - priv->tx_host = MSG_host_self(); - priv->clock_sta = MSG_get_clock(); - - MSG_task_set_data(task, priv); - - MSG_task_send(task, mbox); - - return 0; -} - -static int communication_rx_fun(int argc, char* argv[]) -{ - const char* pr_name = MSG_process_get_name(MSG_process_self()); - const char* host_name = MSG_host_get_name(MSG_host_self()); - xbt_assert(argc == 2); - const char* mbox = argv[1]; - - msg_task_t task = NULL; - MSG_task_recv(&task, mbox); - - struct task_priv* priv = MSG_task_get_data(task); - double clock_end = MSG_get_clock(); - - XBT_INFO("%s:%s to %s:%s => %g sec", MSG_host_get_name(priv->tx_host), MSG_process_get_name(priv->tx_proc), host_name, - pr_name, clock_end - priv->clock_sta); - - xbt_free(priv); - MSG_task_destroy(task); - - return 0; -} - -static void launch_communication_worker(msg_host_t tx_host, msg_host_t rx_host) -{ - char* mbox = bprintf("MBOX:%s-%s", MSG_host_get_name(tx_host), MSG_host_get_name(rx_host)); - const char* pr_name_tx = "comm_tx"; - - char** argv = xbt_new(char*, 3); - argv[0] = xbt_strdup(pr_name_tx); - argv[1] = xbt_strdup(mbox); - argv[2] = NULL; - - MSG_process_create_with_arguments(pr_name_tx, communication_tx_fun, NULL, tx_host, 2, argv); - - const char* pr_name_rx = "comm_rx"; - argv = xbt_new(char*, 3); - argv[0] = xbt_strdup(pr_name_rx); - argv[1] = xbt_strdup(mbox); - argv[2] = NULL; - - MSG_process_create_with_arguments(pr_name_rx, communication_rx_fun, NULL, rx_host, 2, argv); - - xbt_free(mbox); -} - -static int master_main(XBT_ATTRIB_UNUSED int argc, XBT_ATTRIB_UNUSED char* argv[]) -{ - msg_host_t pm0 = MSG_host_by_name("Fafard"); - msg_host_t pm1 = MSG_host_by_name("Tremblay"); - msg_host_t pm2 = MSG_host_by_name("Bourassa"); - - XBT_INFO("## Test 1 (started): check computation on normal PMs"); - - XBT_INFO("### Put a task on a PM"); - launch_computation_worker(pm0); - MSG_process_sleep(2); - - XBT_INFO("### Put two tasks on a PM"); - launch_computation_worker(pm0); - launch_computation_worker(pm0); - MSG_process_sleep(2); - - XBT_INFO("### Put a task on each PM"); - launch_computation_worker(pm0); - launch_computation_worker(pm1); - MSG_process_sleep(2); - - XBT_INFO("## Test 1 (ended)"); - - XBT_INFO("## Test 2 (started): check impact of running a task inside a VM (there is no degradation for the moment)"); - - XBT_INFO("### Put a VM on a PM, and put a task to the VM"); - msg_vm_t vm0 = MSG_vm_create_core(pm0, "VM0"); - MSG_vm_start(vm0); - launch_computation_worker((msg_host_t)vm0); - MSG_process_sleep(2); - MSG_vm_destroy(vm0); - - XBT_INFO("## Test 2 (ended)"); - - XBT_INFO( - "## Test 3 (started): check impact of running a task collocated with a VM (there is no VM noise for the moment)"); - - XBT_INFO("### Put a VM on a PM, and put a task to the PM"); - vm0 = MSG_vm_create_core(pm0, "VM0"); - MSG_vm_start(vm0); - launch_computation_worker(pm0); - MSG_process_sleep(2); - MSG_vm_destroy(vm0); - - XBT_INFO("## Test 3 (ended)"); - - XBT_INFO("## Test 4 (started): compare the cost of running two tasks inside two different VMs collocated or not (for" - " the moment, there is no degradation for the VMs. Hence, the time should be equals to the time of test 1"); - - XBT_INFO("### Put two VMs on a PM, and put a task to each VM"); - vm0 = MSG_vm_create_core(pm0, "VM0"); - msg_vm_t vm1 = MSG_vm_create_core(pm0, "VM1"); - MSG_vm_start(vm0); - MSG_vm_start(vm1); - launch_computation_worker((msg_host_t)vm0); - launch_computation_worker((msg_host_t)vm1); - MSG_process_sleep(2); - MSG_vm_destroy(vm0); - MSG_vm_destroy(vm1); - - XBT_INFO("### Put a VM on each PM, and put a task to each VM"); - vm0 = MSG_vm_create_core(pm0, "VM0"); - vm1 = MSG_vm_create_core(pm1, "VM1"); - MSG_vm_start(vm0); - MSG_vm_start(vm1); - launch_computation_worker((msg_host_t)vm0); - launch_computation_worker((msg_host_t)vm1); - MSG_process_sleep(2); - MSG_vm_destroy(vm0); - MSG_vm_destroy(vm1); - XBT_INFO("## Test 4 (ended)"); - - XBT_INFO("## Test 5 (started): Analyse network impact"); - XBT_INFO("### Make a connection between PM0 and PM1"); - launch_communication_worker(pm0, pm1); - MSG_process_sleep(5); - - XBT_INFO("### Make two connection between PM0 and PM1"); - launch_communication_worker(pm0, pm1); - launch_communication_worker(pm0, pm1); - MSG_process_sleep(5); - - XBT_INFO("### Make a connection between PM0 and VM0@PM0"); - vm0 = MSG_vm_create_core(pm0, "VM0"); - MSG_vm_start(vm0); - launch_communication_worker(pm0, (msg_host_t)vm0); - MSG_process_sleep(5); - MSG_vm_destroy(vm0); - - XBT_INFO("### Make a connection between PM0 and VM0@PM1"); - vm0 = MSG_vm_create_core(pm1, "VM0"); - MSG_vm_start(vm0); - launch_communication_worker(pm0, (msg_host_t)vm0); - MSG_process_sleep(5); - MSG_vm_destroy(vm0); - - XBT_INFO("### Make two connections between PM0 and VM0@PM1"); - vm0 = MSG_vm_create_core(pm1, "VM0"); - MSG_vm_start(vm0); - launch_communication_worker(pm0, (msg_host_t)vm0); - launch_communication_worker(pm0, (msg_host_t)vm0); - MSG_process_sleep(5); - MSG_vm_destroy(vm0); - - XBT_INFO("### Make a connection between PM0 and VM0@PM1, and also make a connection between PM0 and PM1"); - vm0 = MSG_vm_create_core(pm1, "VM0"); - MSG_vm_start(vm0); - launch_communication_worker(pm0, (msg_host_t)vm0); - launch_communication_worker(pm0, pm1); - MSG_process_sleep(5); - MSG_vm_destroy(vm0); - - XBT_INFO("### Make a connection between VM0@PM0 and PM1@PM1, and also make a connection between VM0@PM0 and VM1@PM1"); - vm0 = MSG_vm_create_core(pm0, "VM0"); - vm1 = MSG_vm_create_core(pm1, "VM1"); - MSG_vm_start(vm0); - MSG_vm_start(vm1); - launch_communication_worker((msg_host_t)vm0, (msg_host_t)vm1); - launch_communication_worker((msg_host_t)vm0, (msg_host_t)vm1); - MSG_process_sleep(5); - MSG_vm_destroy(vm0); - MSG_vm_destroy(vm1); - - XBT_INFO("## Test 5 (ended)"); - - XBT_INFO("## Test 6 (started): Check migration impact (not yet implemented neither on the CPU resource nor on the" - " network one"); - XBT_INFO("### Relocate VM0 between PM0 and PM1"); - vm0 = MSG_vm_create_core(pm0, "VM0"); - MSG_vm_set_ramsize(vm0, 1L * 1024 * 1024 * 1024); // 1GiB - - MSG_vm_start(vm0); - launch_communication_worker((msg_host_t)vm0, pm2); - MSG_process_sleep(0.01); - MSG_vm_migrate(vm0, pm1); - MSG_process_sleep(0.01); - MSG_vm_migrate(vm0, pm0); - MSG_process_sleep(5); - MSG_vm_destroy(vm0); - XBT_INFO("## Test 6 (ended)"); - - return 0; -} - -static void launch_master(msg_host_t host) -{ - const char* pr_name = "master_"; - char** argv = xbt_new(char*, 2); - argv[0] = xbt_strdup(pr_name); - argv[1] = NULL; - - MSG_process_create_with_arguments(pr_name, master_main, NULL, host, 1, argv); -} - -int main(int argc, char* argv[]) -{ - /* Get the arguments */ - MSG_init(&argc, argv); - sg_vm_live_migration_plugin_init(); - - /* load the platform file */ - const char* platform = "../../platforms/small_platform.xml"; - if (argc == 2) - platform = argv[1]; - MSG_create_environment(platform); - - msg_host_t pm0 = MSG_host_by_name("Fafard"); - launch_master(pm0); - - int res = MSG_main(); - XBT_INFO("Bye (simulation time %g)", MSG_get_clock()); - - return !(res == MSG_OK); -} diff --git a/teshsuite/msg/cloud-simple/cloud-simple.tesh b/teshsuite/msg/cloud-simple/cloud-simple.tesh deleted file mode 100644 index b54216602d..0000000000 --- a/teshsuite/msg/cloud-simple/cloud-simple.tesh +++ /dev/null @@ -1,56 +0,0 @@ -#!/usr/bin/env tesh - -p Testing a vm with two successive tasks - -$ ${bindir:=.}/cloud-simple --log=no_loc ${platfdir}/small_platform.xml -> [Fafard:master_:(1) 0.000000] [msg_test/INFO] ## Test 1 (started): check computation on normal PMs -> [Fafard:master_:(1) 0.000000] [msg_test/INFO] ### Put a task on a PM -> [Fafard:compute:(2) 0.013107] [msg_test/INFO] Fafard:compute task executed 0.0131068 -> [Fafard:master_:(1) 2.000000] [msg_test/INFO] ### Put two tasks on a PM -> [Fafard:compute:(4) 2.026214] [msg_test/INFO] Fafard:compute task executed 0.0262137 -> [Fafard:compute:(3) 2.026214] [msg_test/INFO] Fafard:compute task executed 0.0262137 -> [Fafard:master_:(1) 4.000000] [msg_test/INFO] ### Put a task on each PM -> [Tremblay:compute:(6) 4.010194] [msg_test/INFO] Tremblay:compute task executed 0.0101942 -> [Fafard:compute:(5) 4.013107] [msg_test/INFO] Fafard:compute task executed 0.0131068 -> [Fafard:master_:(1) 6.000000] [msg_test/INFO] ## Test 1 (ended) -> [Fafard:master_:(1) 6.000000] [msg_test/INFO] ## Test 2 (started): check impact of running a task inside a VM (there is no degradation for the moment) -> [Fafard:master_:(1) 6.000000] [msg_test/INFO] ### Put a VM on a PM, and put a task to the VM -> [VM0:compute:(7) 6.013107] [msg_test/INFO] VM0:compute task executed 0.0131068 -> [Fafard:master_:(1) 8.000000] [msg_test/INFO] ## Test 2 (ended) -> [Fafard:master_:(1) 8.000000] [msg_test/INFO] ## Test 3 (started): check impact of running a task collocated with a VM (there is no VM noise for the moment) -> [Fafard:master_:(1) 8.000000] [msg_test/INFO] ### Put a VM on a PM, and put a task to the PM -> [Fafard:compute:(8) 8.013107] [msg_test/INFO] Fafard:compute task executed 0.0131068 -> [Fafard:master_:(1) 10.000000] [msg_test/INFO] ## Test 3 (ended) -> [Fafard:master_:(1) 10.000000] [msg_test/INFO] ## Test 4 (started): compare the cost of running two tasks inside two different VMs collocated or not (for the moment, there is no degradation for the VMs. Hence, the time should be equals to the time of test 1 -> [Fafard:master_:(1) 10.000000] [msg_test/INFO] ### Put two VMs on a PM, and put a task to each VM -> [VM0:compute:(9) 10.026214] [msg_test/INFO] VM0:compute task executed 0.0262137 -> [VM1:compute:(10) 10.026214] [msg_test/INFO] VM1:compute task executed 0.0262137 -> [Fafard:master_:(1) 12.000000] [msg_test/INFO] ### Put a VM on each PM, and put a task to each VM -> [VM1:compute:(12) 12.010194] [msg_test/INFO] VM1:compute task executed 0.0101942 -> [VM0:compute:(11) 12.013107] [msg_test/INFO] VM0:compute task executed 0.0131068 -> [Fafard:master_:(1) 14.000000] [msg_test/INFO] ## Test 4 (ended) -> [Fafard:master_:(1) 14.000000] [msg_test/INFO] ## Test 5 (started): Analyse network impact -> [Fafard:master_:(1) 14.000000] [msg_test/INFO] ### Make a connection between PM0 and PM1 -> [Tremblay:comm_rx:(14) 14.158397] [msg_test/INFO] Fafard:comm_tx to Tremblay:comm_rx => 0.158397 sec -> [Fafard:master_:(1) 19.000000] [msg_test/INFO] ### Make two connection between PM0 and PM1 -> [Tremblay:comm_rx:(18) 19.291085] [msg_test/INFO] Fafard:comm_tx to Tremblay:comm_rx => 0.291085 sec -> [Tremblay:comm_rx:(16) 19.291085] [msg_test/INFO] Fafard:comm_tx to Tremblay:comm_rx => 0.291085 sec -> [Fafard:master_:(1) 24.000000] [msg_test/INFO] ### Make a connection between PM0 and VM0@PM0 -> [VM0:comm_rx:(20) 24.002265] [msg_test/INFO] Fafard:comm_tx to VM0:comm_rx => 0.00226529 sec -> [Fafard:master_:(1) 29.000000] [msg_test/INFO] ### Make a connection between PM0 and VM0@PM1 -> [VM0:comm_rx:(22) 29.158397] [msg_test/INFO] Fafard:comm_tx to VM0:comm_rx => 0.158397 sec -> [Fafard:master_:(1) 34.000000] [msg_test/INFO] ### Make two connections between PM0 and VM0@PM1 -> [VM0:comm_rx:(26) 34.291085] [msg_test/INFO] Fafard:comm_tx to VM0:comm_rx => 0.291085 sec -> [VM0:comm_rx:(24) 34.291085] [msg_test/INFO] Fafard:comm_tx to VM0:comm_rx => 0.291085 sec -> [Fafard:master_:(1) 39.000000] [msg_test/INFO] ### Make a connection between PM0 and VM0@PM1, and also make a connection between PM0 and PM1 -> [Tremblay:comm_rx:(30) 39.291085] [msg_test/INFO] Fafard:comm_tx to Tremblay:comm_rx => 0.291085 sec -> [VM0:comm_rx:(28) 39.291085] [msg_test/INFO] Fafard:comm_tx to VM0:comm_rx => 0.291085 sec -> [Fafard:master_:(1) 44.000000] [msg_test/INFO] ### Make a connection between VM0@PM0 and PM1@PM1, and also make a connection between VM0@PM0 and VM1@PM1 -> [VM1:comm_rx:(34) 44.291085] [msg_test/INFO] VM0:comm_tx to VM1:comm_rx => 0.291085 sec -> [VM1:comm_rx:(32) 44.291085] [msg_test/INFO] VM0:comm_tx to VM1:comm_rx => 0.291085 sec -> [Fafard:master_:(1) 49.000000] [msg_test/INFO] ## Test 5 (ended) -> [Fafard:master_:(1) 49.000000] [msg_test/INFO] ## Test 6 (started): Check migration impact (not yet implemented neither on the CPU resource nor on the network one -> [Fafard:master_:(1) 49.000000] [msg_test/INFO] ### Relocate VM0 between PM0 and PM1 -> [Bourassa:comm_rx:(36) 49.204993] [msg_test/INFO] VM0:comm_tx to Bourassa:comm_rx => 0.204993 sec -> [Fafard:master_:(1) 339.199251] [msg_test/INFO] ## Test 6 (ended) -> [339.199251] [msg_test/INFO] Bye (simulation time 339.199) -- 2.20.1