From 51b3df03e813ceb19bdcbc8564a2529dab183325 Mon Sep 17 00:00:00 2001 From: Christian Heinrich Date: Fri, 29 Jun 2018 17:32:14 +0200 Subject: [PATCH] [SMPI] Deprecate functions in smpi_dvfs.cpp #278 These functions are not SMPI specific and could be implemented for other modules (MSG, ...) as well. If you really can't use the barely longer version, let us know. --- examples/smpi/energy/energy.c | 15 +++++++++------ include/smpi/smpi.h | 15 ++++++++------- 2 files changed, 17 insertions(+), 13 deletions(-) diff --git a/examples/smpi/energy/energy.c b/examples/smpi/energy/energy.c index 5683b0e1d2..f8ca6dcd67 100644 --- a/examples/smpi/energy/energy.c +++ b/examples/smpi/energy/energy.c @@ -9,6 +9,9 @@ #include #include +#include +#include + int main(int argc, char *argv[]) { int rank; @@ -28,20 +31,20 @@ int main(int argc, char *argv[]) exit(EXIT_FAILURE); } - int pstates = smpi_get_host_nb_pstates(); + int pstates = sg_host_get_nb_pstates(sg_host_self()); char *s = buf; size_t sz = sizeof buf; size_t x = snprintf(s, sz, "[%.6f] [rank %d] Pstates: %d; Powers: %.0f", - MPI_Wtime(), rank, pstates, smpi_get_host_power_peak_at(0)); + MPI_Wtime(), rank, pstates, sg_host_get_pstate_speed(sg_host_self(), 0)); if (x < sz) { s += x; sz -= x; } else sz = 0; for (i = 1; i < pstates; i++) { - x = snprintf(s, sz, ", %.0f", smpi_get_host_power_peak_at(i)); + x = snprintf(s, sz, ", %.0f", sg_host_get_pstate_speed(sg_host_self(), i)); if (x < sz) { s += x; sz -= x; @@ -51,16 +54,16 @@ int main(int argc, char *argv[]) fprintf(stderr, "%s%s\n", buf, (sz ? "" : " [...]")); for (i = 0; i < pstates; i++) { - smpi_set_host_pstate(i); + sg_host_set_pstate(sg_host_self(), i); fprintf(stderr, "[%.6f] [rank %d] Current pstate: %d; Current power: %.0f\n", - MPI_Wtime(), rank, i, smpi_get_host_current_power_peak()); + MPI_Wtime(), rank, i, sg_host_speed(sg_host_self())); SMPI_SAMPLE_FLOPS(1e9) { /* imagine here some code running for 1e9 flops... */ } fprintf(stderr, "[%.6f] [rank %d] Energy consumed: %g Joules.\n", - MPI_Wtime(), rank, smpi_get_host_consumed_energy()); + MPI_Wtime(), rank, sg_host_get_consumed_energy(sg_host_self())); } err = MPI_Finalize(); diff --git a/include/smpi/smpi.h b/include/smpi/smpi.h index e9fa18d799..12e2ae6d8a 100644 --- a/include/smpi/smpi.h +++ b/include/smpi/smpi.h @@ -919,13 +919,14 @@ XBT_PUBLIC void smpi_execute_flops(double flops); XBT_PUBLIC void smpi_execute(double duration); XBT_PUBLIC void smpi_execute_benched(double duration); -XBT_PUBLIC double smpi_get_host_power_peak_at(int pstate_index); -XBT_PUBLIC double smpi_get_host_current_power_peak(); -XBT_PUBLIC int smpi_get_host_nb_pstates(); -XBT_PUBLIC void smpi_set_host_pstate(int pstate_index); -XBT_PUBLIC int smpi_get_host_pstate(); - -XBT_PUBLIC double smpi_get_host_consumed_energy(); +// PLEASE NOTE: If you remove these functions, the entire smpi_dvfs.cpp file can be removed as well!! +XBT_ATTRIB_DEPRECATED_v324("Please use sg_host_get_pstate_speed(sg_host_self(), pstate_index) instead") XBT_PUBLIC double smpi_get_host_power_peak_at(int pstate_index); +XBT_ATTRIB_DEPRECATED_v324("Please use sg_host_speed(sg_host_self()) instead") XBT_PUBLIC double smpi_get_host_current_power_peak(); +XBT_ATTRIB_DEPRECATED_v324("Please use sg_host_get_nb_pstates(sg_host_self()) instead") XBT_PUBLIC int smpi_get_host_nb_pstates(); +XBT_ATTRIB_DEPRECATED_v324("Please use sg_host_set_pstate(sg_host_self(), pstate_index) instead") XBT_PUBLIC void smpi_set_host_pstate(int pstate_index); +XBT_ATTRIB_DEPRECATED_v324("Please use sg_host_get_pstate(sg_host_self()) instead") XBT_PUBLIC int smpi_get_host_pstate(); + +XBT_ATTRIB_DEPRECATED_v324("Please use sg_host_get_consumed_energy(sg_host_self()) instead") XBT_PUBLIC double smpi_get_host_consumed_energy(); XBT_PUBLIC unsigned long long smpi_rastro_resolution(); -- 2.20.1