From 3ba35a3261e2222326b3d81f273d3e8261cad942 Mon Sep 17 00:00:00 2001 From: Honggang Li Date: Thu, 2 Apr 2020 18:29:43 +0800 Subject: [PATCH] Fix Processing Unit calculation for non-NUMA machine For hwloc without commit ba7d4976d38f, function hwloc_get_nbobjs_by_type(topology, HWLOC_OBJ_NUMANODE) return zero instead of one when no NUMA node exists. This patch fixes a floating point exception issue for non-NUMA machine. Signed-off-by: Honggang Li --- src/mpid/ch3/channels/common/src/affinity/hwloc_bind.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/mpid/ch3/channels/common/src/affinity/hwloc_bind.c b/src/mpid/ch3/channels/common/src/affinity/hwloc_bind.c index 7afb9f74248d..f1a1f1fefb97 100644 --- a/src/mpid/ch3/channels/common/src/affinity/hwloc_bind.c +++ b/src/mpid/ch3/channels/common/src/affinity/hwloc_bind.c @@ -2748,7 +2748,12 @@ static int mv2_generate_implicit_cpu_mapping (int local_procs, int num_app_threa num_physical_cores_per_socket = num_physical_cores / num_sockets; num_pu_per_socket = num_pu / num_sockets; - num_pu_per_numanode = num_pu / num_numanodes; + + /* non-NUMA */ + if (num_numanodes == 0) + num_pu_per_numanode = num_pu; + else + num_pu_per_numanode = num_pu / num_numanodes; topodepth = hwloc_get_type_depth (topology, HWLOC_OBJ_CORE); obj = hwloc_get_obj_by_depth (topology, topodepth, 0); /* check on core 0*/ -- 2.25.2