Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Merge branch 'Takishipp-energy-pstate'
authorMartin Quinson <martin.quinson@loria.fr>
Sat, 2 Dec 2017 21:10:42 +0000 (22:10 +0100)
committerMartin Quinson <martin.quinson@loria.fr>
Sat, 2 Dec 2017 21:10:42 +0000 (22:10 +0100)
examples/msg/README.doc
examples/s4u/CMakeLists.txt
examples/s4u/README.doc
examples/s4u/energy-pstate/s4u-energy-pstate.cpp [new file with mode: 0644]
examples/s4u/energy-pstate/s4u-energy-pstate.tesh [new file with mode: 0644]
teshsuite/msg/actions-comm/actions-comm.tesh
teshsuite/msg/actions-storage/actions-storage.tesh
teshsuite/msg/app-bittorrent/app-bittorrent.tesh

index 47f3e9d..00c8f32 100644 (file)
@@ -50,6 +50,12 @@ documentation, but it should remain readable directly.
     You can specify a start time and a kill time in the deployment
     file. See all *_d.xml files in this directory.
 
+  - <b>Using Pstates on a host</b>
+    @ref examples/msg/energy-pstate/energy-pstate.c\n
+    Show how define a set of pstates for a host and how the current
+    pstate can be accessed/changed with @ref MSG_get_host_current_power_peak and @ref  MSG_set_host_pstate.
+    See also the platform XML file for have a details on how to declare the CPU capacity for each pstate.
+
 @section msg_ex_tracing Tracing and visualization features
 
 Tracing can be activated by various configuration options which
@@ -90,8 +96,8 @@ options to see the task executions:
     displayed as arrows in a Gantt-chart visualization. Recommanded
     options to that extend:
     @verbatim -cfg=tracing:yes --cfg=tracing/msg/process:yes
-    @endverbatim     
-
+    @endverbatim 
+    
 TODO: These tracing examples should be integrated in the examples to
 not duplicate the C files. A full command line to see the result in
 the right tool (vite/FrameSoc) should be given along with some
index 1a699a2..1a15301 100644 (file)
@@ -2,7 +2,7 @@ foreach (example actions-comm actions-storage
                  actor-create actor-daemon actor-execute actor-kill actor-lifetime actor-migration actor-suspend actor-priority actor-yield
                  app-masterworker app-pingpong app-token-ring
                  async-wait async-waitany async-waitall
-                 energy-link energy-ptask
+                 energy-link energy-pstate energy-ptask
                  io io-file-remote io-storage-raw
                  platform-properties plugin-hostload mutex)
   add_executable       (s4u-${example}  ${example}/s4u-${example}.cpp)
@@ -34,6 +34,8 @@ endforeach()
 set(examples_src  ${examples_src}                                                                          PARENT_SCOPE)
 set(tesh_files    ${tesh_files}   ${CMAKE_CURRENT_SOURCE_DIR}/app-bittorrent/s4u-app-bittorrent.tesh
                                   ${CMAKE_CURRENT_SOURCE_DIR}/dht-chord/s4u-dht-chord.tesh
+                                  ${CMAKE_CURRENT_SOURCE_DIR}/energy-pstate/s4u-energy-pstate.tesh
+                                  ${CMAKE_CURRENT_SOURCE_DIR}/actor-priority/s4u-actor-priority.tesh
                                   ${CMAKE_CURRENT_SOURCE_DIR}/actor-lifetime/s4u-actor-lifetime.tesh
                                   ${CMAKE_CURRENT_SOURCE_DIR}/actor-priority/s4u-actor-priority.tesh
                                   ${CMAKE_CURRENT_SOURCE_DIR}/actor-yield/s4u-actor-yield.tesh
@@ -69,7 +71,7 @@ foreach(example actions-comm actions-storage
                 app-bittorrent app-masterworker app-pingpong app-token-ring 
                 async-wait async-waitall async-waitany
                 dht-chord 
-                energy-link energy-ptask
+                energy-link energy-pstate energy-ptask
                 platform-properties plugin-hostload mutex
                 io io-file-remote io-storage-raw)
   ADD_TESH_FACTORIES(s4u-${example} "thread;ucontext;raw;boost" 
index 11d4e65..5583e38 100644 (file)
@@ -101,6 +101,12 @@ documentation, but it should remain readable directly.
     @ref examples/s4u/actor-migration/s4u-actor-migration.cpp \n
     Actors can move or be moved from a host to another with the @ref migrate method.
 
+  - <b>Using Pstates on a host</b>
+    @ref examples/s4u/energy-pstate/s4u-energy-pstate.c\n
+    Show how define a set of pstates for a host and how the current
+    pstate can be accessed/changed with @ref getPstateSpeed and @ref  sg_host_set_pstate.
+    See also the platform XML file for have a details on how to declare the CPU capacity for each pstate.
+
   - <b>Yielding to other actor</b>.
     @ref examples/s4u/actor-yield/s4u-actor-yield.c\n
     The simgrid::s4u::this_actor::yield() function interrupts the
diff --git a/examples/s4u/energy-pstate/s4u-energy-pstate.cpp b/examples/s4u/energy-pstate/s4u-energy-pstate.cpp
new file mode 100644 (file)
index 0000000..6f82f4e
--- /dev/null
@@ -0,0 +1,67 @@
+/* Copyright (c) 2007-2010, 2013-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/s4u.hpp"
+
+XBT_LOG_NEW_DEFAULT_CATEGORY(test, "Pstate properties test");
+
+static int dvfs(std::vector<std::string> args)
+{
+  double workload = 100E6;
+  sg_host_t host = simgrid::s4u::this_actor::getHost();
+
+  int nb = sg_host_get_nb_pstates(host);
+  XBT_INFO("Count of Processor states=%d", nb);
+
+  XBT_INFO("Current power peak=%f", host->getSpeed());
+
+  // Run a task
+  simgrid::s4u::this_actor::execute(workload);
+
+  double task_time = simgrid::s4u::Engine::getClock();
+  XBT_INFO("Task1 simulation time: %e", task_time);
+
+  // Change power peak
+  int new_pstate = 2;
+
+  XBT_INFO("Changing power peak value to %f (at index %d)", host->getPstateSpeed(new_pstate), new_pstate);
+
+  sg_host_set_pstate(host, new_pstate);
+
+  XBT_INFO("Current power peak=%f", host->getSpeed());
+
+  // Run a second task
+  simgrid::s4u::this_actor::execute(workload);
+
+  task_time = simgrid::s4u::Engine::getClock() - task_time;
+  XBT_INFO("Task2 simulation time: %e", task_time);
+
+  // Verify the default pstate is set to 0
+  host = simgrid::s4u::Host::by_name_or_null("MyHost2");
+  XBT_INFO("Count of Processor states=%d", sg_host_get_nb_pstates(host));
+
+  XBT_INFO("Current power peak=%f", host->getSpeed());
+  return 0;
+}
+
+int main(int argc, char *argv[])
+{
+  simgrid::s4u::Engine e(&argc, argv);
+  std::vector<std::string> args;
+
+  xbt_assert(argc == 2, "Usage: %s platform_file\n\tExample: %s msg_platform.xml\n", argv[0], argv[0]);
+
+   e.loadPlatform(argv[1]); /* - Load the platform description */
+
+   simgrid::s4u::Actor::createActor("dvfs_test", simgrid::s4u::Host::by_name("MyHost1"), dvfs, args);
+   simgrid::s4u::Actor::createActor("dvfs_test", simgrid::s4u::Host::by_name("MyHost2"), dvfs, args);
+
+   e.run();
+
+  XBT_INFO("Total simulation time: %e", e.getClock());
+
+  return 0;
+}
diff --git a/examples/s4u/energy-pstate/s4u-energy-pstate.tesh b/examples/s4u/energy-pstate/s4u-energy-pstate.tesh
new file mode 100644 (file)
index 0000000..75de0f9
--- /dev/null
@@ -0,0 +1,41 @@
+#! ./tesh
+
+p Testing the DVFS-related functions
+
+$ ${bindir:=.}/s4u-energy-pstate$EXEEXT ${platfdir}/energy_platform.xml "--log=root.fmt:[%10.6r]%e(%i:%P@%h)%e%m%n"
+> [  0.000000] (1:dvfs_test@MyHost1) Count of Processor states=3
+> [  0.000000] (1:dvfs_test@MyHost1) Current power peak=100000000.000000
+> [  0.000000] (2:dvfs_test@MyHost2) Count of Processor states=3
+> [  0.000000] (2:dvfs_test@MyHost2) Current power peak=100000000.000000
+> [  1.000000] (1:dvfs_test@MyHost1) Task1 simulation time: 1.000000e+00
+> [  1.000000] (2:dvfs_test@MyHost2) Task1 simulation time: 1.000000e+00
+> [  1.000000] (1:dvfs_test@MyHost1) Changing power peak value to 20000000.000000 (at index 2)
+> [  1.000000] (2:dvfs_test@MyHost2) Changing power peak value to 20000000.000000 (at index 2)
+> [  1.000000] (1:dvfs_test@MyHost1) Current power peak=20000000.000000
+> [  1.000000] (2:dvfs_test@MyHost2) Current power peak=20000000.000000
+> [  6.000000] (1:dvfs_test@MyHost1) Task2 simulation time: 5.000000e+00
+> [  6.000000] (1:dvfs_test@MyHost1) Count of Processor states=3
+> [  6.000000] (1:dvfs_test@MyHost1) Current power peak=20000000.000000
+> [  6.000000] (2:dvfs_test@MyHost2) Task2 simulation time: 5.000000e+00
+> [  6.000000] (2:dvfs_test@MyHost2) Count of Processor states=3
+> [  6.000000] (2:dvfs_test@MyHost2) Current power peak=20000000.000000
+> [  6.000000] (0:maestro@) Total simulation time: 6.000000e+00
+
+$ ${bindir:=.}/s4u-energy-pstate$EXEEXT ${platfdir}/energy_cluster.xml "--log=root.fmt:[%10.6r]%e(%i:%P@%h)%e%m%n"
+> [  0.000000] (1:dvfs_test@MyHost1) Count of Processor states=3
+> [  0.000000] (1:dvfs_test@MyHost1) Current power peak=100000000.000000
+> [  0.000000] (2:dvfs_test@MyHost2) Count of Processor states=3
+> [  0.000000] (2:dvfs_test@MyHost2) Current power peak=100000000.000000
+> [  1.000000] (1:dvfs_test@MyHost1) Task1 simulation time: 1.000000e+00
+> [  1.000000] (2:dvfs_test@MyHost2) Task1 simulation time: 1.000000e+00
+> [  1.000000] (1:dvfs_test@MyHost1) Changing power peak value to 20000000.000000 (at index 2)
+> [  1.000000] (2:dvfs_test@MyHost2) Changing power peak value to 20000000.000000 (at index 2)
+> [  1.000000] (1:dvfs_test@MyHost1) Current power peak=20000000.000000
+> [  1.000000] (2:dvfs_test@MyHost2) Current power peak=20000000.000000
+> [  6.000000] (1:dvfs_test@MyHost1) Task2 simulation time: 5.000000e+00
+> [  6.000000] (1:dvfs_test@MyHost1) Count of Processor states=3
+> [  6.000000] (1:dvfs_test@MyHost1) Current power peak=20000000.000000
+> [  6.000000] (2:dvfs_test@MyHost2) Task2 simulation time: 5.000000e+00
+> [  6.000000] (2:dvfs_test@MyHost2) Count of Processor states=3
+> [  6.000000] (2:dvfs_test@MyHost2) Current power peak=20000000.000000
+> [  6.000000] (0:maestro@) Total simulation time: 6.000000e+00
index d2833bb..22108dc 100644 (file)
@@ -1,5 +1,5 @@
 ! output sort 19
-$ ${bindir:=.}/actions-comm --log=actions.thres=verbose ${srcdir:=.}/small_platform_fatpipe.xml actions-comm_split_d.xml "--log=root.fmt:[%10.6r]%e(%i:%P@%h)%e%m%n"
+$ ${bindir:=.}/actions-comm --log=actions.thres=verbose ${platfdir}/small_platform_fatpipe.xml actions-comm_split_d.xml "--log=root.fmt:[%10.6r]%e(%i:%P@%h)%e%m%n"
 > [ 20.703314] (1:p0@Tremblay) p0 recv p1 20.703314
 > [ 20.703314] (2:p1@Ruby) p1 send p0 1e10 20.703314
 > [ 30.897513] (0:maestro@) Simulation time 30.8975
@@ -7,7 +7,7 @@ $ ${bindir:=.}/actions-comm --log=actions.thres=verbose ${srcdir:=.}/small_platf
 > [ 30.897513] (2:p1@Ruby) p1 compute 1e9 10.194200
 
 ! output sort 19
-$ ${bindir:=.}/actions-comm --log=actions.thres=verbose ${srcdir:=.}/small_platform_fatpipe.xml actions-comm_d.xml actions-comm.txt "--log=root.fmt:[%10.6r]%e(%i:%P@%h)%e%m%n"
+$ ${bindir:=.}/actions-comm --log=actions.thres=verbose ${platfdir}/small_platform_fatpipe.xml actions-comm_d.xml actions-comm.txt "--log=root.fmt:[%10.6r]%e(%i:%P@%h)%e%m%n"
 > [  0.000000] (1:p0@Tremblay) p0 comm_size 3 0.000000
 > [  1.037020] (1:p0@Tremblay) p0 bcast 5e8 1.037020
 > [  1.037020] (2:p1@Ruby) p1 bcast 5e8 1.037020
index e8219a1..d9a69ee 100644 (file)
@@ -1,5 +1,5 @@
 ! output sort 19
-$ ${bindir:=.}/actions-storage --log=storage_actions.thres=verbose ${srcdir:=.}/storage/storage.xml actions-storage_d.xml actions-storage.txt "--log=root.fmt:[%10.6r]%e(%i:%P@%h)%e%m%n"
+$ ${bindir:=.}/actions-storage --log=storage_actions.thres=verbose ${platfdir}/storage/storage.xml actions-storage_d.xml actions-storage.txt "--log=root.fmt:[%10.6r]%e(%i:%P@%h)%e%m%n"
 > [  0.000000] (1:p0@denise) p0 open /home/lib/libsimgrid.so.3.6.2 0.000000
 > [  0.063552] (1:p0@denise) p0 read /home/lib/libsimgrid.so.3.6.2 12710497 0.063552
 > [  0.063552] (1:p0@denise) p0 close /home/lib/libsimgrid.so.3.6.2 0.000000
index 262fce3..0908021 100644 (file)
@@ -4,7 +4,7 @@ p Testing the Bittorrent implementation with MSG
 
 ! timeout 10
 ! output sort 19
-$ ${bindir:=.}/bittorrent ${srcdir:=.}/cluster.xml app-bittorrent_d.xml "--log=root.fmt:[%12.6r]%e(%i:%P@%h)%e%m%n"
+$ ${bindir:=.}/bittorrent ${platfdir}/cluster.xml app-bittorrent_d.xml "--log=root.fmt:[%12.6r]%e(%i:%P@%h)%e%m%n"
 > [    0.000000] (1:tracker@node-0.acme.org) Tracker launched.
 > [    0.000000] (2:peer@node-1.acme.org) Hi, I'm joining the network with id 2
 > [    0.000000] (3:peer@node-2.acme.org) Hi, I'm joining the network with id 3