瀏覽代碼

papi: Support calibrating energy perfmodels for several implementations

Samuel Thibault 4 年之前
父節點
當前提交
61d67fc640

+ 4 - 4
doc/doxygen/chapters/320_scheduling.doxy

@@ -2,7 +2,7 @@
  *
  * Copyright (C) 2010-2019                                CNRS
  * Copyright (C) 2011,2012,2016                           Inria
- * Copyright (C) 2009-2011,2014-2019                      Université de Bordeaux
+ * Copyright (C) 2009-2011,2014-2020                      Université de Bordeaux
  *
  * StarPU is free software; you can redistribute it and/or modify
  * it under the terms of the GNU Lesser General Public License as published by
@@ -288,7 +288,7 @@ return retval;
 
 
 \code{.c}
-int starpu_energy_stop(struct starpu_perfmodel *model, struct starpu_task *task, unsigned ntasks)
+int starpu_energy_stop(struct starpu_perfmodel *model, struct starpu_task *task, unsigned nimpl, unsigned ntasks)
 {
     double energy = 0.;
 
@@ -323,7 +323,7 @@ int starpu_energy_stop(struct starpu_perfmodel *model, struct starpu_task *task,
      energy = energy / ntasks;
 
      struct starpu_perfmodel_arch *arch = starpu_worker_get_perf_archtype(workerid, STARPU_NMAX_SCHED_CTXS);
-     starpu_perfmodel_update_history(model, task, arch, cpuid, 0, energy);
+     starpu_perfmodel_update_history_n(model, task, arch, cpuid, nimpl, energy, ntasks);
 
     /* removes all events from a PAPI event set */
     if ( (retval = PAPI_cleanup_eventset(EventSet)) != PAPI_OK)
@@ -415,7 +415,7 @@ for (size = STARTlin; size < END; size *= 2)
 
         /* Stop counting and store the values into the array */
 
-         if ( (retval = starpu_energy_stop(&my_perfmodel, task, ntasks)) != 0)
+         if ( (retval = starpu_energy_stop(&my_perfmodel, task, 0, ntasks)) != 0)
 
                 ERROR_RETURN(retval);
 

+ 1 - 1
include/starpu_perfmodel.h

@@ -323,7 +323,7 @@ int starpu_energy_start();
    \EventSet -- an integer handle for a PAPI event set as created by papi_create_eventset()
 */
 
-int starpu_energy_stop(struct starpu_perfmodel *model, struct starpu_task *task, unsigned ntasks);
+int starpu_energy_stop(struct starpu_perfmodel *model, struct starpu_task *task, unsigned nimpl, unsigned ntasks);
 
 /**
    Load the performance model found in the file named \p filename. \p model has to be

+ 7 - 6
src/core/perfmodel/energy_model.c

@@ -105,7 +105,7 @@ return retval;
 
 }
 
-int starpu_energy_stop(struct starpu_perfmodel *model, struct starpu_task *task, unsigned ntasks)
+int starpu_energy_stop(struct starpu_perfmodel *model, struct starpu_task *task, unsigned nimpl, unsigned ntasks)
 {
     double energy = 0.;
  
@@ -130,20 +130,21 @@ int starpu_energy_stop(struct starpu_perfmodel *model, struct starpu_task *task,
 
              energy += values[s * N_EVTS + k];
              
-             printf("%-40s%12.6f J\t(Average Power %.1fW)\n",
+             printf("%-40s%12.6f J\t(for %f us, Average Power %.1fW)\n",
              event_names[k],
-             (energy/1.0e9),
-             ((energy/1.0e9)/(t*1.0E-6)) 
+             (energy*0.23/1.0e9),
+	     t,
+             ((energy*0.23/1.0e9)/(t*1.0E-6)) 
 );
              
 
                 }
              }
 
-     energy = energy / ntasks;
+     energy = energy * 0.23 / 1.0e9 / ntasks;
 
      struct starpu_perfmodel_arch *arch = starpu_worker_get_perf_archtype(workerid, STARPU_NMAX_SCHED_CTXS);
-     starpu_perfmodel_update_history_n(model, task, arch, cpuid, 0, energy, ntasks);
+     starpu_perfmodel_update_history_n(model, task, arch, cpuid, nimpl, energy, ntasks);
 
     /*emoves all events from a PAPI event set */
     if ( (retval = PAPI_cleanup_eventset(EventSet)) != PAPI_OK)

+ 1 - 1
tests/perfmodels/test_papi.c

@@ -162,7 +162,7 @@ int main(int argc, char **argv)
 
         /* Stop counting and store the values into the array */
 
-         if ( (retval = starpu_energy_stop(&my_perfmodel, task, ntasks)) != 0)
+         if ( (retval = starpu_energy_stop(&my_perfmodel, task, 0, ntasks)) != 0)
 
                 ERROR_RETURN(retval);