瀏覽代碼

Mention what hwloc reports when we happen to bind several workers to the same core

Samuel Thibault 7 年之前
父節點
當前提交
dd71894763
共有 1 個文件被更改,包括 9 次插入9 次删除
  1. 9 9
      src/core/topology.c

+ 9 - 9
src/core/topology.c

@@ -1818,15 +1818,6 @@ _starpu_bind_thread_on_cpu (
 	if (cpuid < 0)
 	if (cpuid < 0)
 		return;
 		return;
 
 
-	if (workerid != STARPU_NOWORKERID && cpuid < STARPU_MAXCPUS)
-	{
-		int previous = cpu_worker[cpuid];
-		if (previous != STARPU_NOWORKERID && previous != workerid)
-			_STARPU_DISP("Warning: both workers %d and %d are bound to the same PU %d, this will strongly degrade performance. Maybe check starpu_machine_display's output to determine what wrong binding happened\n", previous, workerid, cpuid);
-		else
-			cpu_worker[cpuid] = workerid;
-	}
-
 #ifdef STARPU_HAVE_HWLOC
 #ifdef STARPU_HAVE_HWLOC
 	const struct hwloc_topology_support *support;
 	const struct hwloc_topology_support *support;
 
 
@@ -1839,6 +1830,15 @@ _starpu_bind_thread_on_cpu (
 	struct _starpu_machine_config *config = _starpu_get_machine_config();
 	struct _starpu_machine_config *config = _starpu_get_machine_config();
 	_starpu_init_topology(config);
 	_starpu_init_topology(config);
 
 
+	if (workerid != STARPU_NOWORKERID && cpuid < STARPU_MAXCPUS)
+	{
+		int previous = cpu_worker[cpuid];
+		if (previous != STARPU_NOWORKERID && previous != workerid)
+			_STARPU_DISP("Warning: both workers %d and %d are bound to the same PU %d, this will strongly degrade performance. Maybe check starpu_machine_display's output to determine what wrong binding happened. Hwloc reported %d cores and %d threads, perhaps there is misdetection between hwloc, the kernel and the BIOS, or an administrative allocation issue from e.g. the job scheduler?\n", previous, workerid, cpuid, config->topology.nhwcpus, config->topology.nhwpus);
+		else
+			cpu_worker[cpuid] = workerid;
+	}
+
 	support = hwloc_topology_get_support (config->topology.hwtopology);
 	support = hwloc_topology_get_support (config->topology.hwtopology);
 	if (support->cpubind->set_thisthread_cpubind)
 	if (support->cpubind->set_thisthread_cpubind)
 	{
 	{