Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
proper check for the -std=gnu++11 standard, and take in on clang too
[simgrid.git] / src / smpi / smpi_dvfs.c
1 /* Copyright (c) 2013-2014. The SimGrid Team.
2  * All rights reserved.                                                     */
3
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. */
6
7 #include "xbt/log.h"
8 #include "simgrid/simix.h"
9 #include "smpi/smpi.h"
10 #include "internal_config.h"
11
12 XBT_LOG_NEW_DEFAULT_SUBCATEGORY(smpi_dvfs, smpi,
13                                 "Logging specific to SMPI (experimental DVFS support)");
14
15 /**
16  * \brief Return the speed of the processor (in flop/s) at a given pstate
17  *
18  * \param pstate_index pstate to test
19  * \return Returns the processor speed associated with pstate_index
20  */
21 double smpi_get_host_power_peak_at(int pstate_index)
22 {
23   return simcall_host_get_power_peak_at(SIMIX_host_self(), pstate_index);
24 }
25
26 /**
27  * \brief Return the current speed of the processor (in flop/s)
28  *
29  * \return Returns the current processor speed
30  */
31 double smpi_get_host_current_power_peak(void)
32 {
33   return simcall_host_get_current_power_peak(SIMIX_host_self());
34 }
35
36 /**
37  * \brief Return the number of pstates defined for host
38  */
39 int smpi_get_host_nb_pstates(void)
40 {
41   return simcall_host_get_nb_pstates(SIMIX_host_self());
42 }
43
44 /**
45  * \brief Sets the pstate at which the processor should run
46  *
47  * \param pstate_index pstate to switch to
48  */
49 void smpi_set_host_pstate(int pstate_index)
50 {
51   simcall_host_set_pstate(SIMIX_host_self(), pstate_index);
52 }
53 /**
54  * \brief Gets the pstate at which the processor currently running
55  *
56  * \param pstate_index pstate to switch to
57  */
58 int smpi_get_host_pstate()
59 {
60   return simcall_host_get_pstate(SIMIX_host_self());
61 }
62
63 /**
64  * \brief Return the total energy consumed by a host (in Joules)
65  *
66  * \return Returns the consumed energy
67  */
68 double smpi_get_host_consumed_energy(void)
69 {
70   return simcall_host_get_consumed_energy(SIMIX_host_self());
71 }
72
73
74 #ifdef SMPI_FORTRAN
75
76 #if defined(__alpha__) || defined(__sparc64__) || defined(__x86_64__) || defined(__ia64__)
77 typedef int integer;
78 typedef unsigned int uinteger;
79 #else
80 typedef long int integer;
81 typedef unsigned long int uinteger;
82 #endif
83 typedef char *address;
84 typedef short int shortint;
85 typedef float real;
86 typedef double doublereal;
87 typedef struct { real r, i; } complex;
88 typedef struct { doublereal r, i; } doublecomplex;
89
90 XBT_PUBLIC(doublereal) smpi_get_host_power_peak_at_(integer *pstate_index);
91 doublereal smpi_get_host_power_peak_at_(integer *pstate_index)
92 {
93   return (doublereal)smpi_get_host_power_peak_at((int)*pstate_index);
94 }
95
96 XBT_PUBLIC(doublereal) smpi_get_host_current_power_peak_(void);
97 doublereal smpi_get_host_current_power_peak_(void)
98 {
99   return smpi_get_host_current_power_peak();
100 }
101
102 XBT_PUBLIC(integer) smpi_get_host_nb_pstates_(void);
103 integer smpi_get_host_nb_pstates_(void)
104 {
105   return (integer)smpi_get_host_nb_pstates();
106 }
107
108 XBT_PUBLIC(void) smpi_set_host_pstate_(integer *pstate_index);
109 void smpi_set_host_pstate_(integer *pstate_index)
110 {
111   smpi_set_host_pstate((int)*pstate_index);
112 }
113
114 XBT_PUBLIC(doublereal) smpi_get_host_consumed_energy_(void);
115 doublereal smpi_get_host_consumed_energy_(void)
116 {
117   return (doublereal)smpi_get_host_consumed_energy();
118 }
119
120 #endif