From 5070b8115b200706bfce1b8b46884496d4402c6b Mon Sep 17 00:00:00 2001 From: Arnaud Giersch Date: Thu, 7 Nov 2013 00:12:02 +0100 Subject: [PATCH] Add Fortran bindigns for smpi+dvfs. (cherry picked from commit 12a61a8ab437baed346e356f63e02cdaeabeb6f4) --- include/smpi/mpif.h.in | 13 +++++++++++++ include/smpi/smpi.h | 10 +++++++--- src/smpi/smpi_bench.c | 12 ++++++++++++ src/smpi/smpi_dvfs.c | 19 ++++++++++++++++--- 4 files changed, 48 insertions(+), 6 deletions(-) diff --git a/include/smpi/mpif.h.in b/include/smpi/mpif.h.in index c6a96a2857..213fe84904 100644 --- a/include/smpi/mpif.h.in +++ b/include/smpi/mpif.h.in @@ -238,3 +238,16 @@ double precision MPI_WTIME double precision MPI_WTICK + + external smpi_execute_flops + external smpi_execute + external smpi_get_host_power_peak_at + external smpi_get_host_current_power_peak + external smpi_get_host_nb_pstates + external smpi_set_host_power_peak_at + external smpi_get_host_consumed_energy + + double precision smpi_get_host_power_peak_at + double precision smpi_get_host_current_power_peak + integer smpi_get_host_nb_pstates + double precision smpi_get_host_consumed_energy diff --git a/include/smpi/smpi.h b/include/smpi/smpi.h index 3901734b77..be167eb546 100644 --- a/include/smpi/smpi.h +++ b/include/smpi/smpi.h @@ -685,11 +685,15 @@ XBT_PUBLIC(void) smpi_exit(int); XBT_PUBLIC(void) smpi_execute_flops(double flops); XBT_PUBLIC(void) smpi_execute(double duration); +XBT_PUBLIC(double) smpi_get_host_current_power_peak_(void); +XBT_PUBLIC(int) smpi_get_host_nb_pstates_(void); +XBT_PUBLIC(double) smpi_get_host_consumed_energy_(void); + XBT_PUBLIC(double) smpi_get_host_power_peak_at(int pstate_index); -XBT_PUBLIC(double) smpi_get_host_current_power_peak(void); -XBT_PUBLIC(int) smpi_get_host_nb_pstates(void); +#define smpi_get_host_current_power_peak() smpi_get_host_current_power_peak_() +#define smpi_get_host_nb_pstates() smpi_get_host_nb_pstates_() XBT_PUBLIC(void) smpi_set_host_power_peak_at(int pstate_index); -XBT_PUBLIC(double) smpi_get_host_consumed_energy(void); +#define smpi_get_host_consumed_energy() smpi_get_host_consumed_energy_() XBT_PUBLIC(unsigned int) smpi_sleep(unsigned int secs); XBT_PUBLIC(int) smpi_gettimeofday(struct timeval *tv); diff --git a/src/smpi/smpi_bench.c b/src/smpi/smpi_bench.c index cc313b7407..b0f25dcaf6 100644 --- a/src/smpi/smpi_bench.c +++ b/src/smpi/smpi_bench.c @@ -126,6 +126,18 @@ void smpi_bench_destroy(void) xbt_dict_free(&calls); } +XBT_PUBLIC(void) smpi_execute_flops_(double *flops); +void smpi_execute_flops_(double *flops) +{ + smpi_execute_flops(*flops); +} + +XBT_PUBLIC(void) smpi_execute_(double *duration); +void smpi_execute_(double *duration) +{ + smpi_execute(*duration); +} + void smpi_execute_flops(double flops) { smx_action_t action; smx_host_t host; diff --git a/src/smpi/smpi_dvfs.c b/src/smpi/smpi_dvfs.c index b5aee9afa5..352e548efc 100644 --- a/src/smpi/smpi_dvfs.c +++ b/src/smpi/smpi_dvfs.c @@ -11,6 +11,9 @@ XBT_LOG_NEW_DEFAULT_SUBCATEGORY(smpi_dvfs, smpi, "Logging specific to SMPI (experimental DVFS support)"); +XBT_PUBLIC(double) smpi_get_host_power_peak_at_(int *pstate_index); +XBT_PUBLIC(void) smpi_set_host_power_peak_at_(int *pstate_index); + /** * \brief Return the speed of the processor (in flop/s) at a given pstate * @@ -22,12 +25,17 @@ double smpi_get_host_power_peak_at(int pstate_index) return simcall_host_get_power_peak_at(SIMIX_host_self(), pstate_index); } +double smpi_get_host_power_peak_at_(int *pstate_index) +{ + return smpi_get_host_power_peak_at(*pstate_index); +} + /** * \brief Return the current speed of the processor (in flop/s) * * \return Returns the current processor speed */ -double smpi_get_host_current_power_peak(void) +double smpi_get_host_current_power_peak_(void) { return simcall_host_get_current_power_peak(SIMIX_host_self()); } @@ -35,7 +43,7 @@ double smpi_get_host_current_power_peak(void) /** * \brief Return the number of pstates defined for host */ -int smpi_get_host_nb_pstates(void) +int smpi_get_host_nb_pstates_(void) { return simcall_host_get_nb_pstates(SIMIX_host_self()); } @@ -50,12 +58,17 @@ void smpi_set_host_power_peak_at(int pstate_index) simcall_host_set_power_peak_at(SIMIX_host_self(), pstate_index); } +void smpi_set_host_power_peak_at_(int *pstate_index) +{ + smpi_set_host_power_peak_at(*pstate_index); +} + /** * \brief Return the total energy consumed by a host (in Joules) * * \return Returns the consumed energy */ -double smpi_get_host_consumed_energy(void) +double smpi_get_host_consumed_energy_(void) { return simcall_host_get_consumed_energy(SIMIX_host_self()); } -- 2.20.1