Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Export DVFS functionality for smpi (experimental).
authorArnaud Giersch <arnaud.giersch@iut-bm.univ-fcomte.fr>
Wed, 6 Nov 2013 16:01:43 +0000 (17:01 +0100)
committerArnaud Giersch <arnaud.giersch@iut-bm.univ-fcomte.fr>
Thu, 7 Nov 2013 08:21:32 +0000 (09:21 +0100)
buildtools/Cmake/DefinePackages.cmake
include/smpi/smpi.h
src/smpi/smpi_dvfs.c [new file with mode: 0644]
src/smpi/smpi_global.c

index 2e41e3d..abc3963 100644 (file)
@@ -104,6 +104,7 @@ set(SMPI_SRC
   src/smpi/smpi_c99.c
   src/smpi/smpi_coll.c
   src/smpi/smpi_comm.c
+  src/smpi/smpi_dvfs.c
   src/smpi/smpi_global.c
   src/smpi/smpi_group.c
   src/smpi/smpi_mpi.c
index 9997744..3901734 100644 (file)
@@ -685,6 +685,12 @@ 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_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);
+XBT_PUBLIC(void) smpi_set_host_power_peak_at(int pstate_index);
+XBT_PUBLIC(double) smpi_get_host_consumed_energy(void);
+
 XBT_PUBLIC(unsigned int) smpi_sleep(unsigned int secs);
 XBT_PUBLIC(int) smpi_gettimeofday(struct timeval *tv);
 XBT_PUBLIC(unsigned long long) smpi_rastro_resolution (void);
diff --git a/src/smpi/smpi_dvfs.c b/src/smpi/smpi_dvfs.c
new file mode 100644 (file)
index 0000000..b5aee9a
--- /dev/null
@@ -0,0 +1,61 @@
+/* Copyright (c) 2013. The SimGrid Team.
+ * All rights reserved.                                                     */
+
+/* This program is free software; you can redistribute it and/or modify it
+  * under the terms of the license (GNU LGPL) which comes with this package. */
+
+#include "xbt/log.h"
+#include "simgrid/simix.h"
+#include "smpi/smpi.h"
+
+XBT_LOG_NEW_DEFAULT_SUBCATEGORY(smpi_dvfs, smpi,
+                                "Logging specific to SMPI (experimental DVFS support)");
+
+/**
+ * \brief Return the speed of the processor (in flop/s) at a given pstate
+ *
+ * \param pstate_index pstate to test
+ * \return Returns the processor speed associated with pstate_index
+ */
+double smpi_get_host_power_peak_at(int pstate_index)
+{
+  return simcall_host_get_power_peak_at(SIMIX_host_self(), 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)
+{
+  return simcall_host_get_current_power_peak(SIMIX_host_self());
+}
+
+/**
+ * \brief Return the number of pstates defined for host
+ */
+int smpi_get_host_nb_pstates(void)
+{
+  return simcall_host_get_nb_pstates(SIMIX_host_self());
+}
+
+/**
+ * \brief Sets the speed of the processor (in flop/s) at a given pstate
+ *
+ * \param pstate_index pstate to switch to
+ */
+void smpi_set_host_power_peak_at(int pstate_index)
+{
+  simcall_host_set_power_peak_at(SIMIX_host_self(), 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)
+{
+  return simcall_host_get_consumed_energy(SIMIX_host_self());
+}
index bfd7ba1..b5b05af 100644 (file)
@@ -407,14 +407,15 @@ int smpi_main(int (*realmain) (int argc, char *argv[]), int argc, char *argv[])
   XBT_LOG_CONNECT(smpi_base);
   XBT_LOG_CONNECT(smpi_bench);
   XBT_LOG_CONNECT(smpi_coll);
+  XBT_LOG_CONNECT(smpi_colls);
   XBT_LOG_CONNECT(smpi_comm);
+  XBT_LOG_CONNECT(smpi_dvfs);
   XBT_LOG_CONNECT(smpi_group);
   XBT_LOG_CONNECT(smpi_kernel);
   XBT_LOG_CONNECT(smpi_mpi);
   XBT_LOG_CONNECT(smpi_mpi_dt);
   XBT_LOG_CONNECT(smpi_pmpi);
   XBT_LOG_CONNECT(smpi_replay);
-  XBT_LOG_CONNECT(smpi_colls);
 
 #ifdef HAVE_TRACING
   TRACE_global_init(&argc, argv);