Browse Source

src: hwloc topology needs to be initialised outside the driver function as the driver may be disabled

Nathalie Furmento 12 years ago
parent
commit
2d3f2f9c71
2 changed files with 4 additions and 7 deletions
  1. 3 0
      src/core/topology.c
  2. 1 7
      src/drivers/cpu/driver_cpu.c

+ 3 - 0
src/core/topology.c

@@ -268,6 +268,9 @@ _starpu_init_topology (struct _starpu_machine_config *config)
 
 	topology->nhwcpus = 0;
 
+	hwloc_topology_init(&topology->hwtopology);
+	hwloc_topology_load(topology->hwtopology);
+
 	_starpu_cpu_discover_devices(config);
 	_starpu_cuda_discover_devices(config);
 	_starpu_opencl_discover_devices(config);

+ 1 - 7
src/drivers/cpu/driver_cpu.c

@@ -2,7 +2,7 @@
  *
  * Copyright (C) 2010-2012  Université de Bordeaux 1
  * Copyright (C) 2010  Mehdi Juhoor <mjuhoor@gmail.com>
- * Copyright (C) 2010, 2011  Centre National de la Recherche Scientifique
+ * Copyright (C) 2010, 2011, 2012  Centre National de la Recherche Scientifique
  * Copyright (C) 2011  Télécom-SudParis
  *
  * StarPU is free software; you can redistribute it and/or modify
@@ -49,12 +49,6 @@ _starpu_cpu_discover_devices(struct _starpu_machine_config *config)
 
 	struct starpu_machine_topology *topology = &config->topology;
 
-	// FIXME: This should already be set.
-	topology->nhwcpus = 0;
-
-	hwloc_topology_init(&topology->hwtopology);
-	hwloc_topology_load(topology->hwtopology);
-
 	config->cpu_depth = hwloc_get_type_depth (topology->hwtopology,
 						  HWLOC_OBJ_CORE);