Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
wanna be exhaustive test for the VM sharing
authorMartin Quinson <martin.quinson@loria.fr>
Thu, 1 Jun 2017 03:27:02 +0000 (05:27 +0200)
committerMartin Quinson <martin.quinson@loria.fr>
Thu, 1 Jun 2017 03:27:02 +0000 (05:27 +0200)
.gitignore
teshsuite/msg/CMakeLists.txt
teshsuite/msg/cloud-sharing/cloud-sharing.c [new file with mode: 0644]
teshsuite/msg/cloud-sharing/cloud-sharing.tesh [new file with mode: 0644]

index e00a0d0..f1b3b52 100644 (file)
@@ -248,6 +248,7 @@ teshsuite/mc/dwarf-expression/dwarf-expression
 teshsuite/mc/random-bug/random-bug
 teshsuite/mc/mutex-handling/mutex-handling
 teshsuite/mc/mutex-handling/without-mutex-handling
+teshsuite/msg/cloud-sharing/cloud-sharing
 teshsuite/msg/concurrent_rw/concurrent_rw
 teshsuite/msg/get_sender/get_sender
 teshsuite/msg/host_on_off/host_on_off
index f3d64d7..4b5ec93 100644 (file)
@@ -1,5 +1,5 @@
 # C examples
-foreach(x get_sender host_on_off host_on_off_recv host_on_off_processes trace_integration)
+foreach(x cloud-sharing get_sender host_on_off host_on_off_recv host_on_off_processes trace_integration)
   add_executable       (${x}  ${x}/${x}.c)
   target_link_libraries(${x}  simgrid)
   set_target_properties(${x}  PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/${x})
@@ -33,6 +33,6 @@ set(xml_files     ${xml_files}     ${CMAKE_CURRENT_SOURCE_DIR}/trace_integration
                                    ${CMAKE_CURRENT_SOURCE_DIR}/trace_integration/test-hbp1-c1s1-c3s2.xml
                                    ${CMAKE_CURRENT_SOURCE_DIR}/trace_integration/test-hbp2.5-hbp1.5.xml    PARENT_SCOPE)
 
-foreach(x get_sender host_on_off host_on_off_processes host_on_off_recv task_destroy_cancel task_listen_from trace_integration)
+foreach(x cloud-sharing get_sender host_on_off host_on_off_processes host_on_off_recv task_destroy_cancel task_listen_from trace_integration)
   ADD_TESH_FACTORIES(tesh-msg-${x} "thread;boost;ucontext;raw" --setenv srcdir=${CMAKE_HOME_DIRECTORY}/teshsuite/msg/${x} --cd ${CMAKE_BINARY_DIR}/teshsuite/msg/${x} ${CMAKE_HOME_DIRECTORY}/teshsuite/msg/${x}/${x}.tesh)
 endforeach()
diff --git a/teshsuite/msg/cloud-sharing/cloud-sharing.c b/teshsuite/msg/cloud-sharing/cloud-sharing.c
new file mode 100644 (file)
index 0000000..da63459
--- /dev/null
@@ -0,0 +1,117 @@
+/* Copyright (c) 2007-2015. 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"
+XBT_LOG_NEW_DEFAULT_CATEGORY(msg_test, "Messages specific for this msg example");
+
+static int computation_fun(int argc, char* argv[])
+{
+  msg_task_t task = MSG_task_create("Task", 100000000, 0, NULL);
+
+  double clock_sta = MSG_get_clock();
+  MSG_task_execute(task);
+  double clock_end = MSG_get_clock();
+
+  XBT_INFO("Task took %gs to execute", clock_end - clock_sta);
+
+  MSG_task_destroy(task);
+
+  return 0;
+}
+
+static int master_main(int argc, char* argv[])
+{
+  msg_host_t pm0 = MSG_host_by_name("node-0.acme.org");
+  msg_host_t pm1 = MSG_host_by_name("node-1.acme.org");
+  xbt_assert(pm0, "Host node-0.acme.org does not seem to exist");
+
+  XBT_INFO("## Test 1 (started): check computation on normal PMs");
+
+  XBT_INFO("### Put a task on a PM");
+  MSG_process_create("compute", computation_fun, NULL, pm0);
+  MSG_process_sleep(2);
+
+  XBT_INFO("### Put two tasks on a PM");
+  MSG_process_create("compute", computation_fun, NULL, pm0);
+  MSG_process_create("compute", computation_fun, NULL, pm0);
+  MSG_process_sleep(2);
+
+  XBT_INFO("### Put a task on each PM");
+  MSG_process_create("compute", computation_fun, NULL, pm0);
+  MSG_process_create("compute", computation_fun, NULL, 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);
+  MSG_process_create("compute", computation_fun, NULL, 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);
+  MSG_process_create("compute", computation_fun, NULL, 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);
+  MSG_process_create("compute", computation_fun, NULL, vm0);
+  MSG_process_create("compute", computation_fun, NULL, 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);
+  MSG_process_create("compute", computation_fun, NULL, vm0);
+  MSG_process_create("compute", computation_fun, NULL, vm1);
+  MSG_process_sleep(2);
+  MSG_vm_destroy(vm0);
+  MSG_vm_destroy(vm1);
+  XBT_INFO("## Test 4 (ended)");
+
+  return 0;
+}
+
+int main(int argc, char* argv[])
+{
+  /* Get the arguments */
+  MSG_init(&argc, argv);
+
+  /* load the platform file */
+  const char* platform = "../../platforms/cluster.xml";
+  if (argc == 2)
+    platform = argv[1];
+  MSG_create_environment(platform);
+
+  msg_host_t pm0 = MSG_host_by_name("node-0.acme.org");
+  xbt_assert(pm0, "Host 'node-0.acme.org' not found");
+  MSG_process_create("master", master_main, NULL, pm0);
+
+  return MSG_main() != MSG_OK;
+}
diff --git a/teshsuite/msg/cloud-sharing/cloud-sharing.tesh b/teshsuite/msg/cloud-sharing/cloud-sharing.tesh
new file mode 100644 (file)
index 0000000..beb39ac
--- /dev/null
@@ -0,0 +1,29 @@
+#! ./tesh
+
+$ $SG_TEST_EXENV ${bindir:=.}/cloud-sharing$EXEEXT --log=no_loc ${srcdir:=.}/../../../examples/platforms/cluster.xml
+> [node-0.acme.org:master:(1) 0.000000] [msg_test/INFO] ## Test 1 (started): check computation on normal PMs
+> [node-0.acme.org:master:(1) 0.000000] [msg_test/INFO] ### Put a task on a PM
+> [node-0.acme.org:compute:(2) 0.100000] [msg_test/INFO] Task took 0.1s to execute
+> [node-0.acme.org:master:(1) 2.000000] [msg_test/INFO] ### Put two tasks on a PM
+> [node-0.acme.org:compute:(4) 2.200000] [msg_test/INFO] Task took 0.2s to execute
+> [node-0.acme.org:compute:(3) 2.200000] [msg_test/INFO] Task took 0.2s to execute
+> [node-0.acme.org:master:(1) 4.000000] [msg_test/INFO] ### Put a task on each PM
+> [node-0.acme.org:compute:(5) 4.100000] [msg_test/INFO] Task took 0.1s to execute
+> [node-1.acme.org:compute:(6) 4.100000] [msg_test/INFO] Task took 0.1s to execute
+> [node-0.acme.org:master:(1) 6.000000] [msg_test/INFO] ## Test 1 (ended)
+> [node-0.acme.org: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)
+> [node-0.acme.org:master:(1) 6.000000] [msg_test/INFO] ### Put a VM on a PM, and put a task to the VM
+> [VM0:compute:(7) 6.100000] [msg_test/INFO] Task took 0.1s to execute
+> [node-0.acme.org:master:(1) 8.000000] [msg_test/INFO] ## Test 2 (ended)
+> [node-0.acme.org: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)
+> [node-0.acme.org:master:(1) 8.000000] [msg_test/INFO] ### Put a VM on a PM, and put a task to the PM
+> [node-0.acme.org:compute:(8) 8.100000] [msg_test/INFO] Task took 0.1s to execute
+> [node-0.acme.org:master:(1) 10.000000] [msg_test/INFO] ## Test 3 (ended)
+> [node-0.acme.org: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
+> [node-0.acme.org:master:(1) 10.000000] [msg_test/INFO] ### Put two VMs on a PM, and put a task to each VM
+> [VM0:compute:(9) 10.200000] [msg_test/INFO] Task took 0.2s to execute
+> [VM1:compute:(10) 10.200000] [msg_test/INFO] Task took 0.2s to execute
+> [node-0.acme.org:master:(1) 12.000000] [msg_test/INFO] ### Put a VM on each PM, and put a task to each VM
+> [VM0:compute:(11) 12.100000] [msg_test/INFO] Task took 0.1s to execute
+> [VM1:compute:(12) 12.100000] [msg_test/INFO] Task took 0.1s to execute
+> [node-0.acme.org:master:(1) 14.000000] [msg_test/INFO] ## Test 4 (ended)