@@ -153,9 +153,6 @@ int starpu_energy_stop(struct starpu_perfmodel *model, struct starpu_task *task,
if ( (retval = PAPI_destroy_eventset(&EventSet)) != PAPI_OK)
ERROR_RETURN(retval);
- /* free the resources used by PAPI */
- PAPI_shutdown();
-
return retval;
}
@@ -240,6 +240,11 @@ void _starpu_profiling_terminate(void)
{
STARPU_PTHREAD_MUTEX_DESTROY(&worker_info_mutex[worker]);
+#ifdef STARPU_PAPI
+ /* free the resources used by PAPI */
+ PAPI_shutdown();
+#endif
+
/*