examples/msg/cloud/scale
examples/msg/cloud/simple_vm
examples/msg/cloud/two_tasks_vm
-examples/msg/energy/pstate/pstate
+examples/msg/energy/consumption/energy_consumption
examples/msg/energy/onoff/onoff
-examples/msg/energy/e2/e2
+examples/msg/energy/pstate/pstate
examples/msg/energy/e3/e3
examples/msg/pastry/pastry
examples/msg/semaphores/synchro
* Improvement of the Energy plugin.
- Always update the consumption before returning that value
- New property: watt_off to denote the disipation when the host is off
+ - New functions getWattMinAt and getWattMaxAt to retrieve the
+ dissipation of pstates that we are not currently at.
XBT
* New functions
- Add a xbt_heap_update function, to avoid costly xbt_heap_remove+xbt_heap_insert use
ADD_TESH_FACTORIES(msg-cloud-two-tasks-vm "thread;ucontext;raw;boost" --setenv bindir=${CMAKE_BINARY_DIR}/examples/msg/cloud/ --setenv srcdir=${CMAKE_HOME_DIRECTORY}/examples/msg/cloud/ --cd ${CMAKE_BINARY_DIR}/examples/msg/cloud/ ${CMAKE_HOME_DIRECTORY}/examples/msg/cloud/two_tasks_vm.tesh)
ADD_TESH_FACTORIES(msg-cloud-simple-vm "thread;ucontext;raw;boost" --setenv bindir=${CMAKE_BINARY_DIR}/examples/msg/cloud/ --setenv srcdir=${CMAKE_HOME_DIRECTORY}/examples/msg/cloud/ --cd ${CMAKE_BINARY_DIR}/examples/msg/cloud/ ${CMAKE_HOME_DIRECTORY}/examples/msg/cloud/simple_vm.tesh)
ADD_TESH_FACTORIES(msg-energy-pstates "thread;boost" --setenv srcdir=${CMAKE_HOME_DIRECTORY}/examples/msg --cd ${CMAKE_BINARY_DIR}/examples/msg ${CMAKE_HOME_DIRECTORY}/examples/msg/energy/pstate/pstate.tesh)
- ADD_TESH_FACTORIES(msg-energy-consumption "thread;ucontext;raw;boost" --setenv srcdir=${CMAKE_HOME_DIRECTORY}/examples/msg --cd ${CMAKE_BINARY_DIR}/examples/msg ${CMAKE_HOME_DIRECTORY}/examples/msg/energy/e2/energy_consumption.tesh)
+ ADD_TESH_FACTORIES(msg-energy-consumption "thread;ucontext;raw;boost" --setenv srcdir=${CMAKE_HOME_DIRECTORY}/examples/msg --cd ${CMAKE_BINARY_DIR}/examples/msg ${CMAKE_HOME_DIRECTORY}/examples/msg/energy/consumption/energy_consumption.tesh)
ADD_TESH_FACTORIES(msg-energy-onoff "thread;ucontext;raw;boost" --setenv srcdir=${CMAKE_HOME_DIRECTORY}/examples/msg --cd ${CMAKE_BINARY_DIR}/examples/msg ${CMAKE_HOME_DIRECTORY}/examples/msg/energy/onoff/onoff.tesh)
- ADD_TESH_FACTORIES(msg-energy-concurrent-tasks "thread;ucontext;raw;boost" --setenv srcdir=${CMAKE_HOME_DIRECTORY}/examples/msg --cd ${CMAKE_BINARY_DIR}/examples/msg ${CMAKE_HOME_DIRECTORY}/examples/msg/energy/e3/concurrent_tasks.tesh)
ADD_TESH_FACTORIES(msg-token-ring "thread;ucontext;raw;boost" --setenv srcdir=${CMAKE_HOME_DIRECTORY} --cd ${CMAKE_BINARY_DIR}/examples/msg/token_ring ${CMAKE_HOME_DIRECTORY}/examples/msg/token_ring/token_ring.tesh)
ADD_TESH_FACTORIES(msg-migration "thread;ucontext;raw;boost" --setenv srcdir=${CMAKE_HOME_DIRECTORY}/examples/msg --cd ${CMAKE_BINARY_DIR}/examples/msg ${CMAKE_HOME_DIRECTORY}/examples/msg/migration/migration.tesh)
ADD_TESH_FACTORIES(msg-ptask "thread;ucontext;raw" --setenv srcdir=${CMAKE_HOME_DIRECTORY}/examples/msg --cd ${CMAKE_BINARY_DIR}/examples/msg ${CMAKE_HOME_DIRECTORY}/examples/msg/parallel_task/parallel_task.tesh)
examples/msg/chainsend/CMakeLists.txt
examples/msg/chord/CMakeLists.txt
examples/msg/cloud/CMakeLists.txt
- examples/msg/energy/pstate/CMakeLists.txt
- examples/msg/energy/e2/CMakeLists.txt
- examples/msg/energy/e3/CMakeLists.txt
+ examples/msg/energy/consumption/CMakeLists.txt
examples/msg/energy/onoff/CMakeLists.txt
+ examples/msg/energy/pstate/CMakeLists.txt
examples/msg/exception/CMakeLists.txt
examples/msg/gpu/CMakeLists.txt
examples/msg/gtnets/CMakeLists.txt
add_subdirectory(${CMAKE_HOME_DIRECTORY}/examples/msg/chainsend)
add_subdirectory(${CMAKE_HOME_DIRECTORY}/examples/msg/chord)
add_subdirectory(${CMAKE_HOME_DIRECTORY}/examples/msg/cloud)
-add_subdirectory(${CMAKE_HOME_DIRECTORY}/examples/msg/energy/pstate)
-add_subdirectory(${CMAKE_HOME_DIRECTORY}/examples/msg/energy/e2)
-add_subdirectory(${CMAKE_HOME_DIRECTORY}/examples/msg/energy/e3)
+add_subdirectory(${CMAKE_HOME_DIRECTORY}/examples/msg/energy/consumption)
add_subdirectory(${CMAKE_HOME_DIRECTORY}/examples/msg/energy/onoff)
+add_subdirectory(${CMAKE_HOME_DIRECTORY}/examples/msg/energy/pstate)
add_subdirectory(${CMAKE_HOME_DIRECTORY}/examples/msg/exception)
add_subdirectory(${CMAKE_HOME_DIRECTORY}/examples/msg/gpu)
add_subdirectory(${CMAKE_HOME_DIRECTORY}/examples/msg/gtnets)
import org.simgrid.msg.Process;
public class Node extends Process {
- private static String FILENAME1 = "/home/user/Install/simgrid/doc/simgrid/examples/platforms/g5k.xml";
- private static String FILENAME2 = "/home/user/Install/simgrid/doc/simgrid/examples/platforms/One_cluster_no_backbone.xml";
- private static String FILENAME3 = "/home/user/Install/simgrid/doc/simgrid/examples/platforms/g5k_cabinets.xml";
- private static String FILENAME4 = "/home/user/Install/simgrid/doc/simgrid/examples/platforms/nancy.xml";
+ private static String FILENAME1 = "/doc/simgrid/examples/platforms/g5k.xml";
+ private static String FILENAME2 = "\\Windows\\setupact.log";
+ private static String FILENAME3 = "/doc/simgrid/examples/platforms/g5k_cabinets.xml";
+ private static String FILENAME4 = "/doc/simgrid/examples/platforms/nancy.xml";
protected int number;
this.number = number;
}
public void main(String[] args) throws MsgException {
- String mount = "c:";
+ String mount = "";
String filename;
switch (number) {
case 0:
+ mount = "/home";
filename = mount + FILENAME1;
break;
case 1:
+ mount = "c:";
filename = mount + FILENAME2;
break;
case 2:
+ mount = "/home";
filename = mount + FILENAME3;
break;
case 3:
+ mount = "/home";
filename = mount + FILENAME4;
break;
default:
+ mount = "/home";
filename = mount + FILENAME1;
}
Msg.info("Open file " + filename);
> [iRMX:node:(3) 1000.897985] [lua/INFO] Leaving the ring
> [McGee:node:(2) 1001.335646] [lua/INFO] Received another request of type get predecessor
> [Jean_Yves:node:(6) 1003.128801] [lua/INFO] Leaving the ring
+> [McGee:node:(2) 1003.128801] [lua/INFO] Failed to receive the answer to my 'find successor' request
+> [McGee:node:(2) 1003.128801] [lua/INFO] Leaving the ring
> [TeX:node:(5) 1004.090491] [lua/INFO] Leaving the ring
-> [McGee:node:(2) 1004.090491] [lua/INFO] Failed to receive the answer to my 'find successor' request
-> [McGee:node:(2) 1004.090491] [lua/INFO] Leaving the ring
> [Geoff:node:(4) 1044.580654] [lua/INFO] Failed to send the 'find successor' request to 38 for id 1337
> [Geoff:node:(4) 1044.580654] [lua/INFO] Leaving the ring
> [Gatien:node:(1) 1045.273210] [lua/INFO] Failed to send the 'find successor' request to 32 for id 1337
set(EXECUTABLE_OUTPUT_PATH "${CMAKE_CURRENT_BINARY_DIR}")
-add_executable(e2 e2.c)
+add_executable(energy_consumption energy_consumption.c)
### Add definitions for compile
-target_link_libraries(e2 simgrid )
+target_link_libraries(energy_consumption simgrid)
set(tesh_files
${tesh_files}
set(xml_files
${xml_files}
- ${CMAKE_CURRENT_SOURCE_DIR}/deployment_e2.xml
+ ${CMAKE_CURRENT_SOURCE_DIR}/deployment_consumption.xml
PARENT_SCOPE
)
set(examples_src
${examples_src}
- ${CMAKE_CURRENT_SOURCE_DIR}/e2.c
+ ${CMAKE_CURRENT_SOURCE_DIR}/energy_consumption.c
PARENT_SCOPE
)
task1 = MSG_task_create ("t1", 100E6, 0, NULL);
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",
+ 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_current_power_peak(host), MSG_host_get_consumed_energy(host));
+ MSG_host_get_current_power_peak(host), MSG_host_get_wattmin_at(host,MSG_host_get_pstate(host)),
+ MSG_host_get_wattmax_at(host,MSG_host_get_pstate(host)),
+ MSG_host_get_consumed_energy(host));
// ========= Change power peak =========
int pstate=2;
p Testing the mechanism for computing host energy consumption
! output sort
-$ $SG_TEST_EXENV energy/e2/e2$EXEEXT ${srcdir:=.}/../platforms/energy_platform.xml ${srcdir:=.}/energy/e2/deployment_e2.xml "--log=root.fmt:[%10.6r]%e(%i:%P@%h)%e%m%n"
+$ $SG_TEST_EXENV energy/consumption/energy_consumption$EXEEXT ${srcdir:=.}/../platforms/energy_platform.xml ${srcdir:=.}/energy/consumption/deployment_consumption.xml "--log=root.fmt:[%10.6r]%e(%i:%P@%h)%e%m%n"
> [ 0.000000] (1:dvfs_test@MyHost1) Energetic profile: 95.0:200.0, 93.0:170.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
> [ 10.000000] (1:dvfs_test@MyHost1) Done sleeping (duration: 10.00 s). Current peak speed=1E+08; Energy dissipated=950.00 J
> [ 10.000000] (1:dvfs_test@MyHost1) Run a task for 100E6 flops
-> [ 11.000000] (1:dvfs_test@MyHost1) Task done (duration: 1.00 s). Current peak speed=1E+08 flop/s; Energy dissipated=1150 J
+> [ 11.000000] (1:dvfs_test@MyHost1) Task done (duration: 1.00 s). Current peak speed=1E+08 flop/s; Current consumption: from 95W to 200W depending on load; Energy dissipated=1150 J
> [ 11.000000] (1:dvfs_test@MyHost1) ========= Requesting pstate 2 (speed should be of 20000000.00 flop/s and is of 20000000.00 flop/s)
> [ 11.000000] (1:dvfs_test@MyHost1) Run a task for 100E6 flops
> [ 16.000000] (1:dvfs_test@MyHost1) Task done (duration: 5.00 s). Current peak speed=2E+07 flop/s; Energy dissipated=1900 J
+++ /dev/null
-cmake_minimum_required(VERSION 2.6)
-
-set(EXECUTABLE_OUTPUT_PATH "${CMAKE_CURRENT_BINARY_DIR}")
-
-add_executable(e3 e3.c)
-
-### Add definitions for compile
-target_link_libraries(e3 simgrid )
-
-set(tesh_files
- ${tesh_files}
- ${CMAKE_CURRENT_SOURCE_DIR}/concurrent_tasks.tesh
- PARENT_SCOPE
- )
-
-set(xml_files
- ${xml_files}
- ${CMAKE_CURRENT_SOURCE_DIR}/deployment_e3.xml
- PARENT_SCOPE
- )
-
-set(examples_src
- ${examples_src}
- ${CMAKE_CURRENT_SOURCE_DIR}/e3.c
- PARENT_SCOPE
- )
-
-set(bin_files
- ${bin_files}
- PARENT_SCOPE
- )
+++ /dev/null
-#! ./tesh
-
-p Testing the mechanism for computing host energy consumption for concurrent tasks
-
-! output sort
-$ $SG_TEST_EXENV energy/e3/e3$EXEEXT ${srcdir:=.}/../platforms/energy_platform.xml ${srcdir:=.}/energy/e3/deployment_e3.xml "--log=root.fmt:[%10.6r]%e(%i:%P@%h)%e%m%n"
-> [ 0.000000] (1:dvfs_test@MyHost1) Current power peak=100000000.000000
-> [ 0.000000] (1:dvfs_test@MyHost1) Total energy (Joules): 0.000000
-> [ 2.000000] (4:proc3@MyHost1) Process proc3 executed task sleep cpu=0.000000, duration = 2.000000
-> [ 2.000000] (4:proc3@MyHost1) ==================================================
-> [ 2.000000] (3:proc2@MyHost1) Process proc2 executed task sleep cpu=0.000000, duration = 2.000000
-> [ 2.000000] (3:proc2@MyHost1) ==================================================
-> [ 5.000000] (4:proc3@MyHost1) Process proc3 executed task cpu=100000000.000000, duration = 3.000000
-> [ 5.000000] (4:proc3@MyHost1) ==================================================
-> [ 5.000000] (3:proc2@MyHost1) Process proc2 executed task cpu=100000000.000000, duration = 3.000000
-> [ 5.000000] (3:proc2@MyHost1) ==================================================
-> [ 6.000000] (2:proc1@MyHost1) Process proc1 executed task cpu=400000000.000000, duration = 6.000000
-> [ 6.000000] (2:proc1@MyHost1) ==================================================
-> [ 8.000000] (1:dvfs_test@MyHost1) Task simulation time: 8.000000e+00
-> [ 8.000000] (1:dvfs_test@MyHost1) Total energy (Joules): 1390.000000
-> [ 8.000000] (0:@) Total simulation time: 8.000000e+00
-> [ 8.000000] (0:@) Total energy of host MyHost1: 1390.000000 Joules
-> [ 8.000000] (0:@) Total energy of host MyHost2: 800.000000 Joules
+++ /dev/null
-<?xml version='1.0'?>
-<!DOCTYPE platform SYSTEM "http://simgrid.gforge.inria.fr/simgrid.dtd">
-<platform version="3">
-
- <process host="MyHost1" function="dvfs_test" />
-
-</platform>
+++ /dev/null
-/* Copyright (c) 2007-2010, 2013-2014. 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<stdio.h>
-
-#include "simgrid/msg.h"
-#include "xbt/sysdep.h" /* calloc */
-#include "simgrid/plugins.h"
-
-/* Create a log channel to have nice outputs. */
-#include "xbt/log.h"
-#include "xbt/asserts.h"
-
-XBT_LOG_NEW_DEFAULT_CATEGORY(msg_test,
- "Messages specific for this msg example");
-
-static int dvfs(int argc, char *argv[]);
-static int process_code(int argc, char *argv[]);
-
-static int process_code(int argc, char *argv[])
-{
- msg_task_t task1 = NULL;
- double cpu_task = 0;
- double task_time = MSG_get_clock();
-
- if (argc == 2)
- {
- /* Run a sleep task */
- double sleep_task = atof(argv[1]);
-
- MSG_process_sleep(sleep_task);
- task_time = MSG_get_clock() - task_time;
- XBT_INFO("Process %s executed task sleep cpu=%f, duration = %f",
- MSG_process_get_name(MSG_process_self()), 0.0, task_time);
- XBT_INFO("==================================================");
- }
-
-
- // Run a task
- cpu_task = atof(argv[0]);
- task1 = MSG_task_create ("task", cpu_task, 0, NULL);
- MSG_task_execute (task1);
- MSG_task_destroy(task1);
-
- task_time = MSG_get_clock() - task_time;
- XBT_INFO("Process %s executed task cpu=%f, duration = %f",
- MSG_process_get_name(MSG_process_self()), cpu_task, task_time);
- XBT_INFO("==================================================");
- return 0;
-}
-
-
-static int dvfs(int argc, char *argv[])
-{
- msg_host_t host = NULL;
- double task_time = 0;
- host = MSG_host_self();
-
- double current_peak = MSG_host_get_current_power_peak(host);
-
- XBT_INFO("Current power peak=%f", current_peak);
- double consumed_energy = MSG_host_get_consumed_energy(host);
- XBT_INFO("Total energy (Joules): %f", consumed_energy);
-
- // Process 1 - long CPU task
- int argc1 = 1;
- char** params1 = xbt_malloc0(sizeof(char *) * argc1);
- params1[0] = xbt_strdup("400.0E6");
- MSG_process_create_with_arguments("proc1", process_code, NULL, host, argc1, params1);
-
- // Process 2 - sleep 2 sec + CPU task
- int argc2 = 2;
- char** params2 = xbt_malloc0(sizeof(char *) * argc2);
- params2[0] = xbt_strdup("100.0E6");
- params2[1] = xbt_strdup("2");
- MSG_process_create_with_arguments("proc2", process_code, NULL, host, argc2, params2);
-
- // Process 3 - sleep 2 sec + CPU task
- int argc3 = 2;
- char** params3 = xbt_malloc0(sizeof(char *) * argc3);
- params3[0] = xbt_strdup("100.0E6");
- params3[1] = xbt_strdup("2");
- MSG_process_create_with_arguments("proc3", process_code, NULL, host, argc3, params3);
-
-
- // Main process
- MSG_process_sleep(8);
-
- task_time = MSG_get_clock() - task_time;
- XBT_INFO("Task simulation time: %e", task_time);
- consumed_energy = MSG_host_get_consumed_energy(host);
- XBT_INFO("Total energy (Joules): %f", consumed_energy);
-
- return 0;
-}
-
-int main(int argc, char *argv[])
-{
- msg_error_t res = MSG_OK;
- sg_energy_plugin_init();
- MSG_init(&argc, argv);
-
- if (argc != 3) {
- XBT_CRITICAL("Usage: %s platform_file deployment_file\n",
- argv[0]);
- XBT_CRITICAL
- ("example: %s msg_platform.xml msg_deployment.xml\n",
- argv[0]);
- exit(1);
- }
-
- MSG_create_environment(argv[1]);
-
- /* Application deployment */
- MSG_function_register("dvfs_test", dvfs);
-
- MSG_launch_application(argv[2]);
-
- res = MSG_main();
-
- XBT_INFO("Total simulation time: %e", MSG_get_clock());
-
- if (res == MSG_OK)
- return 0;
- else
- return 1;
-}
-
! output sort
$ $SG_TEST_EXENV energy/pstate/pstate$EXEEXT ${srcdir:=.}/../platforms/energy_platform.xml ${srcdir:=.}/energy/pstate/deployment_pstate.xml "--log=root.fmt:[%10.6r]%e(%i:%P@%h)%e%m%n"
-> [ 0.000000] (1:dvfs_test@MyHost1) Number of Processor states=3
-> [ 0.000000] (2:dvfs_test@MyHost2) Number of Processor states=1
+> [ 0.000000] (1:dvfs_test@MyHost1) Count of Processor states=3
+> [ 0.000000] (2:dvfs_test@MyHost2) Count of Processor states=1
> [ 0.000000] (1:dvfs_test@MyHost1) Current power peak=100000000.000000
> [ 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] (1:dvfs_test@MyHost1) Changing power peak value to 20000000.000000 (at index 2)
> [ 1.000000] (1:dvfs_test@MyHost1) Current power peak=20000000.000000
> [ 6.000000] (1:dvfs_test@MyHost1) Task2 simulation time: 5.000000e+00
-> [ 6.000000] (1:dvfs_test@MyHost1) Number of Processor states=1
+> [ 6.000000] (1:dvfs_test@MyHost1) Count of Processor states=1
> [ 6.000000] (1:dvfs_test@MyHost1) Current power peak=100000000.000000
> [ 6.000000] (0:@) Total simulation time: 6.000000e+00
XBT_PUBLIC(xbt_swag_t) MSG_host_get_process_list(msg_host_t h);
XBT_PUBLIC(int) MSG_host_is_on(msg_host_t h);
XBT_PUBLIC(int) MSG_host_is_off(msg_host_t h);
+XBT_PUBLIC(double) MSG_host_get_wattmin_at(msg_host_t host, int pstate);
+XBT_PUBLIC(double) MSG_host_get_wattmax_at(msg_host_t host, int pstate);
+
XBT_PUBLIC(void) __MSG_host_priv_free(msg_host_priv_t priv);
XBT_PUBLIC(void) __MSG_host_destroy(msg_host_t host);
XBT_PUBLIC(void) simcall_host_set_pstate(smx_host_t host, int pstate_index);
XBT_PUBLIC(int) simcall_host_get_pstate(smx_host_t host);
XBT_PUBLIC(double) simcall_host_get_consumed_energy(smx_host_t host);
+XBT_PUBLIC(double) simcall_host_get_wattmin_at(smx_host_t host, int pstate);
+XBT_PUBLIC(double) simcall_host_get_wattmax_at(smx_host_t host, int pstate);
XBT_PUBLIC(smx_synchro_t) simcall_host_execute(const char *name, smx_host_t host,
double flops_amount,
* XBT_LOG_NEW_CATEGORY */
#define XBT_LOG_NEW_SUBCATEGORY_helper(catName, parent, desc) \
SG_BEGIN_DECL() \
- XBT_PUBLIC(void) _XBT_LOGV_CTOR(catName)(void) _XBT_LOGV_CTOR_ATTRIBUTE; \
+ extern void _XBT_LOGV_CTOR(catName)(void) _XBT_LOGV_CTOR_ATTRIBUTE; \
void _XBT_LOGV_CTOR(catName)(void) \
{ \
XBT_LOG_EXTERNAL_CATEGORY(catName); \
e_xbt_log_priority_t priority);
+#ifdef DLL_EXPORT
XBT_PUBLIC_DATA(s_xbt_log_category_t) _XBT_LOGV(XBT_LOG_ROOT_CAT);
-
+#else
+// If we `dllexport` the root log category, MinGW does not want us to
+// take its address with the error:
+// > initializer element is not constant
+// When using auto-import, MinGW is happy.
+// We should handle this for non-root log categories as well.
+extern s_xbt_log_category_t _XBT_LOGV(XBT_LOG_ROOT_CAT);
+#endif
extern xbt_log_appender_t xbt_log_default_appender;
extern xbt_log_layout_t xbt_log_default_layout;
XBT_PUBLIC(void) surf_workstation_set_pstate(surf_resource_t host, int pstate_index);
XBT_PUBLIC(int) surf_workstation_get_pstate(surf_resource_t host);
+XBT_PUBLIC(double) surf_workstation_get_wattmin_at(surf_resource_t resource, int pstate);
+XBT_PUBLIC(double) surf_workstation_get_wattmax_at(surf_resource_t resource, int pstate);
/**
* @brief Get the consumed energy (in joules) of a workstation
xbt_assert((host != NULL), "Invalid parameters (host is NULL)");
return simcall_host_get_consumed_energy(host);
}
+/** \ingroup m_host_management
+ * \brief Returns the amount of watt dissipated at the given pstate when the host is idling
+ *
+ */
+double MSG_host_get_wattmin_at(msg_host_t host, int pstate){
+ return simcall_host_get_wattmin_at(host, pstate);
+}
+/** \ingroup m_host_management
+ * \brief Returns the amount of watt dissipated at the given pstate when the host burns CPU at 100%
+ *
+ */
+double MSG_host_get_wattmax_at(msg_host_t host, int pstate){
+ return simcall_host_get_wattmax_at(host, pstate);
+}
+/** \ingroup m_host_management
+ * \brief Set the parameters of a given host
+ *
+ * \param host a host
+ * \param params a prameter object
+ */
/** \ingroup m_host_management
* \brief Return the list of mount point names on an host.
/* prototype of GNU functions */
#if (defined(__GNUC__) && !defined(__cplusplus))
-extern int asprintf(char **ptr, const char *fmt, /*args */ ...);
-extern int vasprintf(char **ptr, const char *fmt, va_list ap);
+XBT_PUBLIC(int) asprintf(char **ptr, const char *fmt, /*args */ ...);
+XBT_PUBLIC(int) vasprintf(char **ptr, const char *fmt, va_list ap);
#endif
extern int asnprintf(char **ptr, size_t str_m, const char *fmt, /*args */
{
return simcall_BODY_host_get_consumed_energy(host);
}
+/** \ingroup simix_host_management
+ * \brief Returns the amount of watt dissipated at the given pstate when the host is idling
+ */
+double simcall_host_get_wattmin_at(msg_host_t host, int pstate){
+ return simcall_BODY_host_get_wattmin_at(host, pstate);
+}
+/** \ingroup simix_host_management
+ * \brief Returns the amount of watt dissipated at the given pstate when the host burns CPU at 100%
+ */
+double simcall_host_get_wattmax_at(msg_host_t host, int pstate){
+ return simcall_BODY_host_get_wattmax_at(host, pstate);
+}
+
/**
simcall->result.i = result;
}
+static inline smx_host_t simcall_host_get_wattmin_at__get__host(smx_simcall_t simcall) {
+ return (smx_host_t) simcall->args[0].dp;
+}
+static inline void simcall_host_get_wattmin_at__set__host(smx_simcall_t simcall, void* arg) {
+ simcall->args[0].dp = arg;
+}
+static inline int simcall_host_get_wattmin_at__get__pstate_index(smx_simcall_t simcall) {
+ return simcall->args[1].i;
+}
+static inline void simcall_host_get_wattmin_at__set__pstate_index(smx_simcall_t simcall, int arg) {
+ simcall->args[1].i = arg;
+}
+static inline double simcall_host_get_wattmin_at__get__result(smx_simcall_t simcall){
+ return simcall->result.d;
+}
+static inline void simcall_host_get_wattmin_at__set__result(smx_simcall_t simcall, double result){
+ simcall->result.d = result;
+}
+
+static inline smx_host_t simcall_host_get_wattmax_at__get__host(smx_simcall_t simcall) {
+ return (smx_host_t) simcall->args[0].dp;
+}
+static inline void simcall_host_get_wattmax_at__set__host(smx_simcall_t simcall, void* arg) {
+ simcall->args[0].dp = arg;
+}
+static inline int simcall_host_get_wattmax_at__get__pstate_index(smx_simcall_t simcall) {
+ return simcall->args[1].i;
+}
+static inline void simcall_host_get_wattmax_at__set__pstate_index(smx_simcall_t simcall, int arg) {
+ simcall->args[1].i = arg;
+}
+static inline double simcall_host_get_wattmax_at__get__result(smx_simcall_t simcall){
+ return simcall->result.d;
+}
+static inline void simcall_host_get_wattmax_at__set__result(smx_simcall_t simcall, double result){
+ simcall->result.d = result;
+}
+
static inline smx_host_t simcall_host_set_pstate__get__host(smx_simcall_t simcall) {
return (smx_host_t) simcall->args[0].dp;
}
return self->simcall.result.i;
}
+inline static double simcall_BODY_host_get_wattmin_at(smx_host_t host, int pstate_index) {
+ smx_process_t self = SIMIX_process_self();
+
+ /* Go to that function to follow the code flow through the simcall barrier */
+ if (0) SIMIX_host_get_wattmin_at(host, pstate_index);
+ /* end of the guide intended to the poor programmer wanting to go from MSG to Surf */
+
+ self->simcall.call = SIMCALL_HOST_GET_WATTMIN_AT;
+ memset(&self->simcall.result, 0, sizeof(self->simcall.result));
+ memset(self->simcall.args, 0, sizeof(self->simcall.args));
+ self->simcall.args[0].dp = (void*) host;
+ self->simcall.args[1].i = (int) pstate_index;
+ if (self != simix_global->maestro_process) {
+ XBT_DEBUG("Yield process '%s' on simcall %s (%d)", self->name,
+ SIMIX_simcall_name(self->simcall.call), (int)self->simcall.call);
+ SIMIX_process_yield(self);
+ } else {
+ SIMIX_simcall_handle(&self->simcall, 0);
+ }
+ return self->simcall.result.d;
+ }
+
+inline static double simcall_BODY_host_get_wattmax_at(smx_host_t host, int pstate_index) {
+ smx_process_t self = SIMIX_process_self();
+
+ /* Go to that function to follow the code flow through the simcall barrier */
+ if (0) SIMIX_host_get_wattmax_at(host, pstate_index);
+ /* end of the guide intended to the poor programmer wanting to go from MSG to Surf */
+
+ self->simcall.call = SIMCALL_HOST_GET_WATTMAX_AT;
+ memset(&self->simcall.result, 0, sizeof(self->simcall.result));
+ memset(self->simcall.args, 0, sizeof(self->simcall.args));
+ self->simcall.args[0].dp = (void*) host;
+ self->simcall.args[1].i = (int) pstate_index;
+ if (self != simix_global->maestro_process) {
+ XBT_DEBUG("Yield process '%s' on simcall %s (%d)", self->name,
+ SIMIX_simcall_name(self->simcall.call), (int)self->simcall.call);
+ SIMIX_process_yield(self);
+ } else {
+ SIMIX_simcall_handle(&self->simcall, 0);
+ }
+ return self->simcall.result.d;
+ }
+
inline static void simcall_BODY_host_set_pstate(smx_host_t host, int pstate_index) {
smx_process_t self = SIMIX_process_self();
SIMCALL_HOST_GET_CURRENT_POWER_PEAK,
SIMCALL_HOST_GET_POWER_PEAK_AT,
SIMCALL_HOST_GET_NB_PSTATES,
+ SIMCALL_HOST_GET_WATTMIN_AT,
+ SIMCALL_HOST_GET_WATTMAX_AT,
SIMCALL_HOST_SET_PSTATE,
SIMCALL_HOST_GET_PSTATE,
SIMCALL_HOST_GET_CONSUMED_ENERGY,
[SIMCALL_HOST_GET_CURRENT_POWER_PEAK] = "SIMCALL_HOST_GET_CURRENT_POWER_PEAK",
[SIMCALL_HOST_GET_POWER_PEAK_AT] = "SIMCALL_HOST_GET_POWER_PEAK_AT",
[SIMCALL_HOST_GET_NB_PSTATES] = "SIMCALL_HOST_GET_NB_PSTATES",
+ [SIMCALL_HOST_GET_WATTMIN_AT] = "SIMCALL_HOST_GET_WATTMIN_AT",
+ [SIMCALL_HOST_GET_WATTMAX_AT] = "SIMCALL_HOST_GET_WATTMAX_AT",
[SIMCALL_HOST_SET_PSTATE] = "SIMCALL_HOST_SET_PSTATE",
[SIMCALL_HOST_GET_PSTATE] = "SIMCALL_HOST_GET_PSTATE",
[SIMCALL_HOST_GET_CONSUMED_ENERGY] = "SIMCALL_HOST_GET_CONSUMED_ENERGY",
SIMIX_simcall_answer(simcall);
break;
+case SIMCALL_HOST_GET_WATTMIN_AT:
+ simcall->result.d = SIMIX_host_get_wattmin_at((smx_host_t) simcall->args[0].dp, simcall->args[1].i);
+ SIMIX_simcall_answer(simcall);
+ break;
+
+case SIMCALL_HOST_GET_WATTMAX_AT:
+ simcall->result.d = SIMIX_host_get_wattmax_at((smx_host_t) simcall->args[0].dp, simcall->args[1].i);
+ SIMIX_simcall_answer(simcall);
+ break;
+
case SIMCALL_HOST_SET_PSTATE:
SIMIX_host_set_pstate((smx_host_t) simcall->args[0].dp, simcall->args[1].i);
SIMIX_simcall_answer(simcall);
Func - host_get_current_power_peak (double) (host, void*, smx_host_t)
Func - host_get_power_peak_at (double) (host, void*, smx_host_t) (pstate_index, int)
Func - host_get_nb_pstates (int) (host, void*, smx_host_t)
+Func - host_get_wattmin_at (double) (host, void*, smx_host_t) (pstate_index, int)
+Func - host_get_wattmax_at (double) (host, void*, smx_host_t) (pstate_index, int)
Proc - host_set_pstate (void) (host, void*, smx_host_t) (pstate_index, int)
Func - host_get_pstate (int) (host, void*, smx_host_t)
Func - host_get_consumed_energy (double) (host, void*, smx_host_t)
xbt_assert((host != NULL), "Invalid parameters (simix host is NULL)");
return surf_workstation_get_consumed_energy(host);
}
+double SIMIX_host_get_wattmin_at(smx_host_t host,int pstate) {
+ return surf_workstation_get_wattmin_at(host,pstate);
+}
+double SIMIX_host_get_wattmax_at(smx_host_t host,int pstate) {
+ return surf_workstation_get_wattmax_at(host,pstate);
+}
int SIMIX_host_get_state(smx_host_t host){
xbt_assert((host != NULL), "Invalid parameters (simix host is NULL)");
double SIMIX_host_get_power_peak_at(smx_host_t host, int pstate_index);
int SIMIX_host_get_nb_pstates(smx_host_t host);
double SIMIX_host_get_consumed_energy(smx_host_t host);
+double SIMIX_host_get_wattmin_at(smx_host_t host,int pstate);
+double SIMIX_host_get_wattmax_at(smx_host_t host,int pstate);
void SIMIX_host_set_pstate(smx_host_t host, int pstate_index);
int SIMIX_host_get_pstate(smx_host_t host);
smx_synchro_t SIMIX_host_execute(const char *name,
xbt_dynar_free(&power_range_watts_list);
}
+
+double CpuEnergy::getWattMinAt(int pstate) {
+ xbt_dynar_t power_range_list = power_range_watts_list;
+ xbt_assert(power_range_watts_list, "No power range properties specified for host %s", cpu->getName());
+ xbt_dynar_t current_power_values = xbt_dynar_get_as(power_range_list, static_cast<CpuCas01Ptr>(cpu)->getPState(), xbt_dynar_t);
+ double min_power = xbt_dynar_get_as(current_power_values, 0, double);
+ return min_power;
+}
+double CpuEnergy::getWattMaxAt(int pstate) {
+ xbt_dynar_t power_range_list = power_range_watts_list;
+ xbt_assert(power_range_watts_list, "No power range properties specified for host %s", cpu->getName());
+ xbt_dynar_t current_power_values = xbt_dynar_get_as(power_range_list, static_cast<CpuCas01Ptr>(cpu)->getPState(), xbt_dynar_t);
+ double max_power = xbt_dynar_get_as(current_power_values, 1, double);
+ return max_power;
+}
+
/**
* Computes the power consumed by the host according to the current pstate and processor load
*
double CpuEnergy::getCurrentWattsValue(double cpu_load)
{
xbt_dynar_t power_range_list = power_range_watts_list;
-
- if (power_range_list == NULL)
- {
- XBT_DEBUG("No power range properties specified for host %s", cpu->getName());
- return 0;
- }
- /*xbt_assert(xbt_dynar_length(power_range_list) == xbt_dynar_length(cpu->p_powerPeakList),
- "The number of power ranges in the properties does not match the number of pstates for host %s",
- cpu->getName());*/
+ xbt_assert(power_range_watts_list, "No power range properties specified for host %s", cpu->getName());
/* retrieve the power values associated with the current pstate */
xbt_dynar_t current_power_values = xbt_dynar_get_as(power_range_list, static_cast<CpuCas01Ptr>(cpu)->getPState(), xbt_dynar_t);
double getCurrentWattsValue(double cpu_load);
double getConsumedEnergy();
+ double getWattMinAt(int pstate);
+ double getWattMaxAt(int pstate);
xbt_dynar_t getWattsRangeList();
xbt_dynar_t power_range_watts_list; /*< List of (min_power,max_power) pairs corresponding to each cpu pstate */
int surf_workstation_get_pstate(surf_resource_t resource){
return get_casted_workstation(resource)->getPstate();
}
+double surf_workstation_get_wattmin_at(surf_resource_t resource, int pstate){
+ xbt_assert(surf_energy!=NULL, "The Energy plugin is not active. Please call sg_energy_plugin_init() during initialization.");
+ std::map<CpuPtr, CpuEnergyPtr>::iterator cpuIt = surf_energy->find(get_casted_workstation(resource)->p_cpu);
+ return cpuIt->second->getWattMinAt(pstate);
+}
+double surf_workstation_get_wattmax_at(surf_resource_t resource, int pstate){
+ xbt_assert(surf_energy!=NULL, "The Energy plugin is not active. Please call sg_energy_plugin_init() during initialization.");
+ std::map<CpuPtr, CpuEnergyPtr>::iterator cpuIt = surf_energy->find(get_casted_workstation(resource)->p_cpu);
+ return cpuIt->second->getWattMaxAt(pstate);
+}
double surf_workstation_get_consumed_energy(surf_resource_t resource){
- xbt_assert(surf_energy!=NULL, "The Energy plugin is not active.");
+ xbt_assert(surf_energy!=NULL, "The Energy plugin is not active. Please call sg_energy_plugin_init() during initialization.");
std::map<CpuPtr, CpuEnergyPtr>::iterator cpuIt = surf_energy->find(get_casted_workstation(resource)->p_cpu);
return cpuIt->second->getConsumedEnergy();
}