Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Add Fortran bindigns for smpi+dvfs.
[simgrid.git] / src / smpi / smpi_dvfs.c
1 /* Copyright (c) 2013. 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
11 XBT_LOG_NEW_DEFAULT_SUBCATEGORY(smpi_dvfs, smpi,
12                                 "Logging specific to SMPI (experimental DVFS support)");
13
14 XBT_PUBLIC(double) smpi_get_host_power_peak_at_(int *pstate_index);
15 XBT_PUBLIC(void) smpi_set_host_power_peak_at_(int *pstate_index);
16
17 /**
18  * \brief Return the speed of the processor (in flop/s) at a given pstate
19  *
20  * \param pstate_index pstate to test
21  * \return Returns the processor speed associated with pstate_index
22  */
23 double smpi_get_host_power_peak_at(int pstate_index)
24 {
25   return simcall_host_get_power_peak_at(SIMIX_host_self(), pstate_index);
26 }
27
28 double smpi_get_host_power_peak_at_(int *pstate_index)
29 {
30   return smpi_get_host_power_peak_at(*pstate_index);
31 }
32
33 /**
34  * \brief Return the current speed of the processor (in flop/s)
35  *
36  * \return Returns the current processor speed
37  */
38 double smpi_get_host_current_power_peak_(void)
39 {
40   return simcall_host_get_current_power_peak(SIMIX_host_self());
41 }
42
43 /**
44  * \brief Return the number of pstates defined for host
45  */
46 int smpi_get_host_nb_pstates_(void)
47 {
48   return simcall_host_get_nb_pstates(SIMIX_host_self());
49 }
50
51 /**
52  * \brief Sets the speed of the processor (in flop/s) at a given pstate
53  *
54  * \param pstate_index pstate to switch to
55  */
56 void smpi_set_host_power_peak_at(int pstate_index)
57 {
58   simcall_host_set_power_peak_at(SIMIX_host_self(), pstate_index);
59 }
60
61 void smpi_set_host_power_peak_at_(int *pstate_index)
62 {
63   smpi_set_host_power_peak_at(*pstate_index);
64 }
65
66 /**
67  * \brief Return the total energy consumed by a host (in Joules)
68  *
69  * \return Returns the consumed energy
70  */
71 double smpi_get_host_consumed_energy_(void)
72 {
73   return simcall_host_get_consumed_energy(SIMIX_host_self());
74 }