1 /* Copyright (c) 2013-2015. The SimGrid Team.
2 * All rights reserved. */
4 /* This program is free software; you can redistribute it and/or modify it
5 * under the terms of the license (GNU LGPL) which comes with this package. */
8 #include "simgrid/simix.h"
10 #include "src/internal_config.h"
12 XBT_LOG_NEW_DEFAULT_SUBCATEGORY(smpi_dvfs, smpi,
13 "Logging specific to SMPI (experimental DVFS support)");
16 * \brief Return the speed of the processor (in flop/s) at a given pstate
18 * \param pstate_index pstate to test
19 * \return Returns the processor speed associated with pstate_index
21 double smpi_get_host_power_peak_at(int pstate_index)
23 return simcall_host_get_power_peak_at(SIMIX_host_self(), pstate_index);
27 * \brief Return the current speed of the processor (in flop/s)
29 * \return Returns the current processor speed
31 double smpi_get_host_current_power_peak(void)
33 return simcall_host_get_current_power_peak(SIMIX_host_self());
37 * \brief Return the number of pstates defined for the current host
39 int smpi_get_host_nb_pstates(void)
41 return sg_host_get_nb_pstates(SIMIX_host_self());
45 * \brief Sets the pstate at which the processor should run
47 * \param pstate_index pstate to switch to
49 void smpi_set_host_pstate(int pstate_index)
51 simcall_host_set_pstate(SIMIX_host_self(), pstate_index);
54 * \brief Gets the pstate at which the processor currently running
56 * \param pstate_index pstate to switch to
58 int smpi_get_host_pstate() {
59 return sg_host_get_pstate(SIMIX_host_self());
63 * \brief Return the total energy consumed by a host (in Joules)
65 * \return Returns the consumed energy
67 double smpi_get_host_consumed_energy(void) {
68 return sg_host_get_consumed_energy(SIMIX_host_self());
74 #if defined(__alpha__) || defined(__sparc64__) || defined(__x86_64__) || defined(__ia64__)
76 typedef unsigned int uinteger;
78 typedef long int integer;
79 typedef unsigned long int uinteger;
81 typedef char *address;
82 typedef short int shortint;
84 typedef double doublereal;
85 typedef struct { real r, i; } complex;
86 typedef struct { doublereal r, i; } doublecomplex;
88 XBT_PUBLIC(doublereal) smpi_get_host_power_peak_at_(integer *pstate_index);
89 doublereal smpi_get_host_power_peak_at_(integer *pstate_index)
91 return (doublereal)smpi_get_host_power_peak_at((int)*pstate_index);
94 XBT_PUBLIC(doublereal) smpi_get_host_current_power_peak_(void);
95 doublereal smpi_get_host_current_power_peak_(void)
97 return smpi_get_host_current_power_peak();
100 XBT_PUBLIC(integer) smpi_get_host_nb_pstates_(void);
101 integer smpi_get_host_nb_pstates_(void)
103 return (integer)smpi_get_host_nb_pstates();
106 XBT_PUBLIC(void) smpi_set_host_pstate_(integer *pstate_index);
107 void smpi_set_host_pstate_(integer *pstate_index)
109 smpi_set_host_pstate((int)*pstate_index);
112 XBT_PUBLIC(doublereal) smpi_get_host_consumed_energy_(void);
113 doublereal smpi_get_host_consumed_energy_(void)
115 return (doublereal)smpi_get_host_consumed_energy();