teshsuite/msg/cloud-migration/cloud-migration
teshsuite/msg/cloud-simple/cloud-simple
teshsuite/msg/cloud-two-tasks/cloud-two-tasks
-teshsuite/msg/energy-consumption/energy-consumption
teshsuite/msg/energy-pstate/energy-pstate
teshsuite/msg/energy-ptask/energy-ptask
teshsuite/msg/get_sender/get_sender
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/energy-exec/energy-exec.c
+include examples/c/energy-exec/energy-exec.tesh
include examples/c/io-disk-raw/io-disk-raw.c
include examples/c/io-disk-raw/io-disk-raw.tesh
include examples/deprecated/java/app/bittorrent/Common.java
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-consumption/energy-consumption.c
-include teshsuite/msg/energy-consumption/energy-consumption.tesh
include teshsuite/msg/energy-pstate/energy-pstate.c
include teshsuite/msg/energy-pstate/energy-pstate.tesh
include teshsuite/msg/energy-ptask/energy-ptask.c
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
+ energy-exec
io-disk-raw)
add_executable (${x}-c EXCLUDE_FROM_ALL ${x}/${x}.c)
target_link_libraries(${x}-c simgrid)
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
+ app-pingpong app-token-ring
+ async-waitall async-waitany
+ energy-exec
io-disk-raw)
ADD_TESH(c-${x} --setenv platfdir=${CMAKE_HOME_DIRECTORY}/examples/platforms
--setenv bindir=${CMAKE_BINARY_DIR}/examples/c/${x}
--- /dev/null
+/* 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/plugins/energy.h"
+#include "xbt/asserts.h"
+#include "xbt/config.h"
+#include "xbt/log.h"
+
+XBT_LOG_NEW_DEFAULT_CATEGORY(energy_exec, "Messages specific for this example");
+
+static void dvfs(XBT_ATTRIB_UNUSED int argc, XBT_ATTRIB_UNUSED char* argv[])
+{
+ sg_host_t host = sg_host_by_name("MyHost1");
+
+ XBT_INFO("Energetic profile: %s", sg_host_get_property_value(host, "wattage_per_state"));
+ XBT_INFO("Initial peak speed=%.0E flop/s; Energy dissipated =%.0E J", sg_host_speed(host),
+ sg_host_get_consumed_energy(host));
+
+ double start = simgrid_get_clock();
+ XBT_INFO("Sleep for 10 seconds");
+ sg_actor_sleep_for(10);
+ XBT_INFO("Done sleeping (duration: %.2f s). Current peak speed=%.0E; Energy dissipated=%.2f J",
+ simgrid_get_clock() - start, sg_host_speed(host), sg_host_get_consumed_energy(host));
+
+ // Run a task
+ start = simgrid_get_clock();
+ XBT_INFO("Run a task of %.0E flops", 100E6);
+ sg_actor_self_execute(100E6);
+ 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_get_clock() - start, sg_host_speed(host), sg_host_get_wattmin_at(host, sg_host_get_pstate(host)),
+ sg_host_get_wattmax_at(host, sg_host_get_pstate(host)), sg_host_get_consumed_energy(host));
+
+ // ========= Change power peak =========
+ int pstate = 2;
+ sg_host_set_pstate(host, pstate);
+ XBT_INFO("========= Requesting pstate %d (speed should be of %.0E flop/s and is of %.0E flop/s)", pstate,
+ sg_host_get_pstate_speed(host, pstate), sg_host_speed(host));
+
+ // Run a second task
+ start = simgrid_get_clock();
+ XBT_INFO("Run a task of %.0E flops", 100E6);
+ sg_actor_self_execute(100E6);
+ XBT_INFO("Task done (duration: %.2f s). Current peak speed=%.0E flop/s; Energy dissipated=%.0f J",
+ simgrid_get_clock() - start, sg_host_speed(host), sg_host_get_consumed_energy(host));
+
+ start = simgrid_get_clock();
+ XBT_INFO("Sleep for 4 seconds");
+ sg_actor_sleep_for(4);
+ XBT_INFO("Done sleeping (duration: %.2f s). Current peak speed=%.0E flop/s; Energy dissipated=%.0f J",
+ simgrid_get_clock() - start, sg_host_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(sg_host_by_name("MyHost2")));
+ sg_host_turn_off(sg_host_by_name("MyHost2"));
+ start = simgrid_get_clock();
+ sg_actor_sleep_for(10);
+ XBT_INFO("Done sleeping (duration: %.2f s). Current peak speed=%.0E flop/s; Energy dissipated=%.0f J",
+ simgrid_get_clock() - start, sg_host_speed(host), sg_host_get_consumed_energy(host));
+}
+
+int main(int argc, char* argv[])
+{
+ simgrid_init(&argc, argv);
+ sg_cfg_set_string("plugin", "host_energy");
+
+ xbt_assert(argc == 2, "Usage: %s platform_file\n\tExample: %s msg_platform.xml\n", argv[0], argv[0]);
+
+ simgrid_load_platform(argv[1]);
+ sg_actor_t actor = sg_actor_init("dvfs_test", sg_host_by_name("MyHost1"));
+ sg_actor_start(actor, dvfs, 0, NULL);
+
+ simgrid_run();
+
+ XBT_INFO("End of simulation");
+
+ return 0;
+}
p Testing the mechanism for computing host energy consumption
-$ ${bindir:=.}/energy-consumption ${platfdir}/energy_platform.xml "--log=root.fmt:[%10.6r]%e(%i:%P@%h)%e%m%n"
+$ ${bindir:=.}/energy-exec-c ${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:93.33333333333333:200.0, 93.0:90.0:170.0, 90.0:90.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
> [ 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: 2905.000000 Joules; unused/idle hosts: 5100.000000)
-> [ 30.000000] (0:maestro@) Total simulation time: 30.00
+> [ 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:=.}/energy-consumption ${platfdir}/energy_cluster.xml "--log=root.fmt:[%10.6r]%e(%i:%P@%h)%e%m%n" --cfg=host/model:ptask_L07
+$ ${bindir:=.}/energy-exec-c ${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:93.33333333333333:200.0, 93.0:90.0:170.0, 90.0:90.0:150.0
> [ 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: 2905.000000 Joules; unused/idle hosts: 2100.000000)
-> [ 30.000000] (0:maestro@) Total simulation time: 30.00
+> [ 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-capping cloud-migration cloud-two-tasks cloud-simple
get_sender host_on_off host_on_off_recv
process-lifetime
- energy-consumption energy-ptask energy-pstate platform-properties
+ energy-ptask energy-pstate platform-properties
io-file io-file-remote
task-priority
plugin-hostload
get_sender
task_destroy_cancel task_listen_from task_progress
process-lifetime
- energy-consumption energy-ptask
+ energy-ptask
io-file io-file-remote
platform-properties
task-priority
+++ /dev/null
-/* 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/plugins/energy.h"
-#include "simgrid/msg.h"
-
-XBT_LOG_NEW_DEFAULT_CATEGORY(msg_test, "Messages specific for this msg example");
-
-static int dvfs(XBT_ATTRIB_UNUSED int argc, XBT_ATTRIB_UNUSED char* argv[])
-{
- msg_host_t host = MSG_host_by_name("MyHost1");
-
- XBT_INFO("Energetic profile: %s", MSG_host_get_property_value(host, "wattage_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));
-
- double start = MSG_get_clock();
- XBT_INFO("Sleep for 10 seconds");
- MSG_process_sleep(10);
- XBT_INFO("Done sleeping (duration: %.2f s). Current peak speed=%.0E; Energy dissipated=%.2f J",
- 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);
- XBT_INFO("Run a task of %.0E flops", MSG_task_get_flops_amount(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",
- MSG_get_clock() - start, MSG_host_get_speed(host), sg_host_get_wattmin_at(host, MSG_host_get_pstate(host)),
- sg_host_get_wattmax_at(host, MSG_host_get_pstate(host)), sg_host_get_consumed_energy(host));
-
- // ========= Change power peak =========
- 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);
- XBT_INFO("Run a task of %.0E flops", MSG_task_get_flops_amount(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));
-
- start = MSG_get_clock();
- XBT_INFO("Sleep for 4 seconds");
- MSG_process_sleep(4);
- XBT_INFO("Done sleeping (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")));
- MSG_host_off(MSG_host_by_name("MyHost2"));
- start = MSG_get_clock();
- MSG_process_sleep(10);
- XBT_INFO("Done sleeping (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));
- return 0;
-}
-
-int main(int argc, char* argv[])
-{
- MSG_init(&argc, argv);
- MSG_config("plugin", "host_energy");
-
- 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_process_create("dvfs_test", dvfs, NULL, MSG_get_host_by_name("MyHost1"));
-
- msg_error_t res = MSG_main();
-
- XBT_INFO("Total simulation time: %.2f", MSG_get_clock());
-
- return res != MSG_OK;
-}