File mvapich2-hwloc-fix-affinity-init-on-non-NUMA-systems.patch of Package mvapich2.25423

commit 01ecf7e1698da2d48418ed4352108d54863aecab
Author: Nicolas Morey-Chaisemartin <nmoreychaisemartin@suse.com>
Date:   Mon May 23 14:38:12 2022 +0200

    mvapich2: hwloc: fix affinity init on non-NUMA systems (bsc#1199808, bsc#1175679)
    
    Signed-off-by: Nicolas Morey-Chaisemartin <nmoreychaisemartin@suse.com>

diff --git src/mpid/ch3/channels/common/src/affinity/hwloc_bind.c src/mpid/ch3/channels/common/src/affinity/hwloc_bind.c
index 7afb9f74248d..f5875b7970fc 100644
--- src/mpid/ch3/channels/common/src/affinity/hwloc_bind.c
+++ src/mpid/ch3/channels/common/src/affinity/hwloc_bind.c
@@ -2746,9 +2746,21 @@ static int mv2_generate_implicit_cpu_mapping (int local_procs, int num_app_threa
     num_physical_cores = hwloc_get_nbobjs_by_type(topology, HWLOC_OBJ_CORE);
     num_pu = hwloc_get_nbobjs_by_type(topology, HWLOC_OBJ_PU);
 
-    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-socket */
+    if (num_sockets == 0) {
+        num_pu_per_socket = num_pu;
+        num_physical_cores_per_socket = num_physical_cores;
+    }
+    else {
+        num_pu_per_socket = num_pu / num_sockets;
+        num_physical_cores_per_socket = num_physical_cores / num_sockets;
+    }
+
+    /* 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*/
openSUSE Build Service is sponsored by