examples/msg/dht-chord/dht-chord
examples/msg/dht-kademlia/dht-kademlia
examples/msg/dht-pastry/dht-pastry
-examples/msg/energy-consumption/energy-consumption
examples/msg/energy-onoff/energy-onoff
examples/msg/energy-vm/energy-vm
examples/msg/platform-failures/platform-failures
examples/s4u/dht-chord/s4u-dht-chord
examples/s4u/energy-link/s4u-energy-link
examples/s4u/energy-ptask/s4u-energy-ptask
-examples/s4u/energy-pstate/s4u-energy-pstate
examples/s4u/energy-vm/s4u-energy-vm
examples/s4u/exec-async/s4u-exec-async
examples/s4u/exec-basic/s4u-exec-basic
+examples/s4u/exec-dvfs/s4u-exec-dvfs
examples/s4u/exec-monitor/s4u-exec-monitor
examples/s4u/exec-remote/s4u-exec-remote
examples/s4u/io-file-system/s4u-io-file-system
teshsuite/msg/async-waitany/async-waitany
teshsuite/msg/cloud-sharing/cloud-sharing
teshsuite/msg/concurrent_rw/concurrent_rw
+teshsuite/msg/energy-consumption/energy-consumption
teshsuite/msg/energy-pstate/energy-pstate
teshsuite/msg/energy-ptask/energy-ptask
teshsuite/msg/get_sender/get_sender
# C examples
foreach(x app-masterworker app-token-ring
cloud-capping cloud-masterworker cloud-migration
- dht-pastry energy-consumption energy-onoff energy-vm platform-failures
+ dht-pastry energy-onoff energy-vm platform-failures
plugin-hostload
process-create
synchro-semaphore trace-categories
foreach(x app-chainsend app-masterworker app-token-ring
cloud-capping cloud-masterworker cloud-migration
dht-pastry dht-kademlia platform-failures
- energy-consumption energy-onoff energy-vm
+ energy-onoff energy-vm
plugin-hostload
process-create
synchro-semaphore)
app-chainsend app-masterworker app-pingpong app-token-ring
async-wait async-waitany async-waitall
cloud-simple
- energy-link energy-pstate energy-ptask energy-vm
+ energy-exec energy-link energy-pstate energy-ptask energy-vm
exec-async exec-basic exec-monitor exec-remote
io-file-system io-file-remote io-storage-raw
mutex
async-wait async-waitall async-waitany
cloud-simple
dht-chord
- energy-link energy-pstate energy-ptask energy-vm
+ energy-exec energy-link energy-pstate energy-ptask energy-vm
exec-async exec-basic exec-monitor exec-remote
platform-properties plugin-hostload mutex
io-file-system io-file-remote io-storage-raw
@section s4u_ex_energy Simulating the energy consumption
+ - <b>Consumption due to the CPU</b>
+ @ref examples/s4u/energy-exec/s4u-energy-exec.cpp \n
+ This example shows how to retrieve the amount of energy consumed
+ by the CPU during computations, and the impact of the pstate.
+
- <b>Using Pstates on a host</b>
@ref examples/s4u/energy-pstate/s4u-energy-pstate.cpp and
@ref examples/platforms/energy_platform.xml \n
@example examples/s4u/app-token-ring/s4u-app-token-ring.cpp
@example examples/s4u/app-masterworker/s4u-app-masterworker.cpp
@example examples/s4u/app-pingpong/s4u-app-pingpong.cpp
+@example examples/s4u/energy-exec/s4u-energy-exec.cpp
@example examples/s4u/energy-pstate/s4u-energy-pstate.cpp
@example examples/s4u/io-file-system/s4u-io-file-system.cpp
@example examples/s4u/io-file-remote/s4u-io-file-remote.cpp
--- /dev/null
+/* Copyright (c) 2007-2017. 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"
+#include "simgrid/plugins/energy.h"
+
+XBT_LOG_NEW_DEFAULT_CATEGORY(s4u_test, "Messages specific for this s4u example");
+
+static void dvfs()
+{
+ simgrid::s4u::Host* host1 = simgrid::s4u::Host::by_name("MyHost1");
+ simgrid::s4u::Host* host2 = simgrid::s4u::Host::by_name("MyHost2");
+
+ XBT_INFO("Energetic profile: %s", host1->getProperty("watt_per_state"));
+ XBT_INFO("Initial peak speed=%.0E flop/s; Energy dissipated =%.0E J", host1->getSpeed(),
+ sg_host_get_consumed_energy(host1));
+
+ double start = simgrid::s4u::Engine::getClock();
+ XBT_INFO("Sleep for 10 seconds");
+ simgrid::s4u::this_actor::sleep_for(10);
+ XBT_INFO("Done sleeping (duration: %.2f s). Current peak speed=%.0E; Energy dissipated=%.2f J",
+ simgrid::s4u::Engine::getClock() - start, host1->getSpeed(), sg_host_get_consumed_energy(host1));
+
+ // Execute something
+ start = simgrid::s4u::Engine::getClock();
+ double flopAmount = 100E6;
+ XBT_INFO("Run a task of %.0E flops", flopAmount);
+ simgrid::s4u::this_actor::execute(flopAmount);
+ XBT_INFO("Task done (duration: %.2f s). Current peak speed=%.0E flop/s; Current consumption: from %.0fW to %.0fW"
+ " depending on load; Energy dissipated=%.0f J",
+ simgrid::s4u::Engine::getClock() - start, host1->getSpeed(),
+ sg_host_get_wattmin_at(host1, host1->getPstate()), sg_host_get_wattmax_at(host1, host1->getPstate()),
+ sg_host_get_consumed_energy(host1));
+
+ // ========= Change power peak =========
+ int pstate = 2;
+ host1->setPstate(pstate);
+ XBT_INFO("========= Requesting pstate %d (speed should be of %.0E flop/s and is of %.0E flop/s)", pstate,
+ host1->getPstateSpeed(pstate), host1->getSpeed());
+
+ // Run another task
+ start = simgrid::s4u::Engine::getClock();
+ XBT_INFO("Run a task of %.0E flops", flopAmount);
+ simgrid::s4u::this_actor::execute(flopAmount);
+ XBT_INFO("Task done (duration: %.2f s). Current peak speed=%.0E flop/s; Energy dissipated=%.0f J",
+ simgrid::s4u::Engine::getClock() - start, host1->getSpeed(), sg_host_get_consumed_energy(host1));
+
+ start = simgrid::s4u::Engine::getClock();
+ XBT_INFO("Sleep for 4 seconds");
+ simgrid::s4u::this_actor::sleep_for(4);
+ XBT_INFO("Done sleeping (duration: %.2f s). Current peak speed=%.0E flop/s; Energy dissipated=%.0f J",
+ simgrid::s4u::Engine::getClock() - start, host1->getSpeed(), sg_host_get_consumed_energy(host1));
+
+ // =========== Turn the other host off ==========
+ XBT_INFO("Turning MyHost2 off, and sleeping another 10 seconds. MyHost2 dissipated %.0f J so far.",
+ sg_host_get_consumed_energy(host2));
+ host2->turnOff();
+ start = simgrid::s4u::Engine::getClock();
+ simgrid::s4u::this_actor::sleep_for(10);
+ XBT_INFO("Done sleeping (duration: %.2f s). Current peak speed=%.0E flop/s; Energy dissipated=%.0f J",
+ simgrid::s4u::Engine::getClock() - start, host1->getSpeed(), sg_host_get_consumed_energy(host1));
+}
+
+int main(int argc, char* argv[])
+{
+ sg_host_energy_plugin_init();
+ simgrid::s4u::Engine e(&argc, argv);
+
+ xbt_assert(argc == 2, "Usage: %s platform_file\n\tExample: %s msg_platform.xml\n", argv[0], argv[0]);
+
+ e.loadPlatform(argv[1]);
+ simgrid::s4u::Actor::createActor("dvfs_test", simgrid::s4u::Host::by_name("MyHost1"), dvfs);
+
+ e.run();
+
+ XBT_INFO("End of simulation.");
+
+ return 0;
+}
--- /dev/null
+#! ./tesh
+
+p Testing the mechanism for computing host energy consumption
+
+$ ${bindir:=.}/s4u-energy-exec$EXEEXT ${platfdir}/energy_platform.xml "--log=root.fmt:[%10.6r]%e(%i:%P@%h)%e%m%n"
+> [ 0.000000] (1:dvfs_test@MyHost1) Energetic profile: 100.0:120.0:200.0, 93.0:110.0:170.0, 90.0:105.0:150.0
+> [ 0.000000] (1:dvfs_test@MyHost1) Initial peak speed=1E+08 flop/s; Energy dissipated =0E+00 J
+> [ 0.000000] (1:dvfs_test@MyHost1) Sleep for 10 seconds
+> [ 10.000000] (1:dvfs_test@MyHost1) Done sleeping (duration: 10.00 s). Current peak speed=1E+08; Energy dissipated=1000.00 J
+> [ 10.000000] (1:dvfs_test@MyHost1) Run a task of 1E+08 flops
+> [ 11.000000] (1:dvfs_test@MyHost1) Task done (duration: 1.00 s). Current peak speed=1E+08 flop/s; Current consumption: from 120W to 200W depending on load; Energy dissipated=1120 J
+> [ 11.000000] (1:dvfs_test@MyHost1) ========= Requesting pstate 2 (speed should be of 2E+07 flop/s and is of 2E+07 flop/s)
+> [ 11.000000] (1:dvfs_test@MyHost1) Run a task of 1E+08 flops
+> [ 16.000000] (1:dvfs_test@MyHost1) Task done (duration: 5.00 s). Current peak speed=2E+07 flop/s; Energy dissipated=1645 J
+> [ 16.000000] (1:dvfs_test@MyHost1) Sleep for 4 seconds
+> [ 20.000000] (1:dvfs_test@MyHost1) Done sleeping (duration: 4.00 s). Current peak speed=2E+07 flop/s; Energy dissipated=2005 J
+> [ 20.000000] (1:dvfs_test@MyHost1) Turning MyHost2 off, and sleeping another 10 seconds. MyHost2 dissipated 2000 J so far.
+> [ 30.000000] (1:dvfs_test@MyHost1) Done sleeping (duration: 10.00 s). Current peak speed=2E+07 flop/s; Energy dissipated=2905 J
+> [ 30.000000] (0:maestro@) Total energy consumption: 8005.000000 Joules (used hosts: 5005.000000 Joules; unused/idle hosts: 3000.000000)
+> [ 30.000000] (0:maestro@) End of simulation.
+> [ 30.000000] (0:maestro@) Energy consumption of host MyHost1: 2905.000000 Joules
+> [ 30.000000] (0:maestro@) Energy consumption of host MyHost2: 2100.000000 Joules
+> [ 30.000000] (0:maestro@) Energy consumption of host MyHost3: 3000.000000 Joules
+
+$ ${bindir:=.}/s4u-energy-exec$EXEEXT ${platfdir}/energy_cluster.xml "--log=root.fmt:[%10.6r]%e(%i:%P@%h)%e%m%n" --cfg=host/model:ptask_L07
+> [ 0.000000] (0:maestro@) Configuration change: Set 'host/model' to 'ptask_L07'
+> [ 0.000000] (0:maestro@) Switching to the L07 model to handle parallel tasks.
+> [ 0.000000] (1:dvfs_test@MyHost1) Energetic profile: 100.0:120.0:200.0, 93.0:110.0:170.0, 90.0:105.0:150.0
+> [ 0.000000] (1:dvfs_test@MyHost1) Initial peak speed=1E+08 flop/s; Energy dissipated =0E+00 J
+> [ 0.000000] (1:dvfs_test@MyHost1) Sleep for 10 seconds
+> [ 10.000000] (1:dvfs_test@MyHost1) Done sleeping (duration: 10.00 s). Current peak speed=1E+08; Energy dissipated=1000.00 J
+> [ 10.000000] (1:dvfs_test@MyHost1) Run a task of 1E+08 flops
+> [ 11.000000] (1:dvfs_test@MyHost1) Task done (duration: 1.00 s). Current peak speed=1E+08 flop/s; Current consumption: from 120W to 200W depending on load; Energy dissipated=1120 J
+> [ 11.000000] (1:dvfs_test@MyHost1) ========= Requesting pstate 2 (speed should be of 2E+07 flop/s and is of 2E+07 flop/s)
+> [ 11.000000] (1:dvfs_test@MyHost1) Run a task of 1E+08 flops
+> [ 16.000000] (1:dvfs_test@MyHost1) Task done (duration: 5.00 s). Current peak speed=2E+07 flop/s; Energy dissipated=1645 J
+> [ 16.000000] (1:dvfs_test@MyHost1) Sleep for 4 seconds
+> [ 20.000000] (1:dvfs_test@MyHost1) Done sleeping (duration: 4.00 s). Current peak speed=2E+07 flop/s; Energy dissipated=2005 J
+> [ 20.000000] (1:dvfs_test@MyHost1) Turning MyHost2 off, and sleeping another 10 seconds. MyHost2 dissipated 2000 J so far.
+> [ 30.000000] (1:dvfs_test@MyHost1) Done sleeping (duration: 10.00 s). Current peak speed=2E+07 flop/s; Energy dissipated=2905 J
+> [ 30.000000] (0:maestro@) Total energy consumption: 5005.000000 Joules (used hosts: 5005.000000 Joules; unused/idle hosts: 0.000000)
+> [ 30.000000] (0:maestro@) End of simulation.
+> [ 30.000000] (0:maestro@) Energy consumption of host MyHost1: 2905.000000 Joules
+> [ 30.000000] (0:maestro@) Energy consumption of host MyHost2: 2100.000000 Joules
cloud-sharing cloud-two-tasks cloud-simple
get_sender host_on_off host_on_off_recv host_on_off_processes
process-daemon process-kill process-join process-lifetime process-migration process-suspend process-yield
- energy-ptask energy-pstate platform-properties
+ energy-consumption energy-ptask energy-pstate platform-properties
io-file io-raw-storage io-file-remote
task-priority
trace_integration)
get_sender
task_destroy_cancel task_listen_from task_progress
process-daemon process-kill process-join process-lifetime process-migration process-suspend process-yield
- energy-ptask
+ energy-consumption energy-ptask
io-file io-raw-storage io-file-remote
platform-properties
trace_integration)
/* 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/energy.h"
+#include "simgrid/msg.h"
XBT_LOG_NEW_DEFAULT_CATEGORY(msg_test, "Messages specific for this msg example");
-static int dvfs(int argc, char *argv[])
+static int dvfs(int argc, char* argv[])
{
msg_host_t host = MSG_host_by_name("MyHost1");
- XBT_INFO("Energetic profile: %s",MSG_host_get_property_value(host,"watt_per_state"));
+ XBT_INFO("Energetic profile: %s", MSG_host_get_property_value(host, "watt_per_state"));
XBT_INFO("Initial peak speed=%.0E flop/s; Energy dissipated =%.0E J", MSG_host_get_speed(host),
sg_host_get_consumed_energy(host));
MSG_get_clock() - start, MSG_host_get_speed(host), sg_host_get_consumed_energy(host));
// Run a task
- start = MSG_get_clock();
- msg_task_t task1 = MSG_task_create ("t1", 100E6, 0, NULL);
+ start = MSG_get_clock();
+ msg_task_t task1 = MSG_task_create("t1", 100E6, 0, NULL);
XBT_INFO("Run a task of %.0E flops", MSG_task_get_flops_amount(task1));
- MSG_task_execute (task1);
+ MSG_task_execute(task1);
MSG_task_destroy(task1);
XBT_INFO("Task done (duration: %.2f s). Current peak speed=%.0E flop/s; Current consumption: from %.0fW to %.0fW"
" depending on load; Energy dissipated=%.0f J",
sg_host_get_wattmax_at(host, MSG_host_get_pstate(host)), sg_host_get_consumed_energy(host));
// ========= Change power peak =========
- int pstate=2;
+ int pstate = 2;
MSG_host_set_pstate(host, pstate);
XBT_INFO("========= Requesting pstate %d (speed should be of %.0E flop/s and is of %.0E flop/s)", pstate,
MSG_host_get_power_peak_at(host, pstate), MSG_host_get_speed(host));
// Run a second task
start = MSG_get_clock();
- task1 = MSG_task_create ("t2", 100E6, 0, NULL);
+ task1 = MSG_task_create("t2", 100E6, 0, NULL);
XBT_INFO("Run a task of %.0E flops", MSG_task_get_flops_amount(task1));
- MSG_task_execute (task1);
+ MSG_task_execute(task1);
MSG_task_destroy(task1);
XBT_INFO("Task done (duration: %.2f s). Current peak speed=%.0E flop/s; Energy dissipated=%.0f J",
MSG_get_clock() - start, MSG_host_get_speed(host), sg_host_get_consumed_energy(host));
// =========== Turn the other host off ==========
XBT_INFO("Turning MyHost2 off, and sleeping another 10 seconds. MyHost2 dissipated %.0f J so far.",
- sg_host_get_consumed_energy(MSG_host_by_name("MyHost2")) );
+ sg_host_get_consumed_energy(MSG_host_by_name("MyHost2")));
MSG_host_off(MSG_host_by_name("MyHost2"));
start = MSG_get_clock();
MSG_process_sleep(10);
return 0;
}
-int main(int argc, char *argv[])
+int main(int argc, char* argv[])
{
sg_host_energy_plugin_init();
MSG_init(&argc, argv);