浏览代码

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

Nathalie Furmento 12 年之前
父节点
当前提交
2d3f2f9c71
共有 2 个文件被更改,包括 4 次插入7 次删除
  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);