Kaynağa Gözat

Avoid initializing combined worker several times

This is not actually supported.
Samuel Thibault 6 yıl önce
ebeveyn
işleme
8e2a8f6f56

+ 6 - 0
src/core/detect_combined_workers.c

@@ -26,6 +26,8 @@
 #ifdef STARPU_HAVE_HWLOC
 #include <hwloc.h>
 
+int _starpu_initialized_combined_workers;
+
 static void find_workers(hwloc_obj_t obj, int cpu_workers[STARPU_NMAXWORKERS], unsigned *n)
 {
 	struct _starpu_hwloc_userdata *data = obj->userdata;
@@ -358,6 +360,10 @@ void _starpu_sched_find_worker_combinations(int *workerids, int nworkers)
 {
 	/* FIXME: this seems to be lacking shutdown support? */
 
+	if (_starpu_initialized_combined_workers)
+		return;
+	_starpu_initialized_combined_workers = 1;
+
 	struct _starpu_machine_config *config = _starpu_get_machine_config();
 
 	if (config->conf.single_combined_worker > 0)

+ 1 - 0
src/core/detect_combined_workers.h

@@ -20,3 +20,4 @@
 /* Initialize combined workers */
 void _starpu_sched_find_worker_combinations(int *workerids, int nworkers);
 
+int _starpu_initialized_combined_workers;

+ 2 - 0
src/core/workers.c

@@ -33,6 +33,7 @@
 #include <core/debug.h>
 #include <core/disk.h>
 #include <core/task.h>
+#include <core/detect_combined_workers.h>
 #include <datawizard/malloc.h>
 #include <profiling/profiling.h>
 #include <sched_policies/sched_component.h>
@@ -1753,6 +1754,7 @@ void starpu_shutdown(void)
 	free(_starpu_config.topology.tree);
 #endif
 	_starpu_destroy_topology(&_starpu_config);
+	_starpu_initialized_combined_workers = 0;
 #ifdef STARPU_USE_FXT
 	_starpu_stop_fxt_profiling();
 #endif