[mpich2-commits] r5610 - mpich2/trunk/src/pm/hydra/tools/bind/hwloc

mercierg at mcs.anl.gov mercierg at mcs.anl.gov
Thu Oct 29 05:03:35 CDT 2009


Author: mercierg
Date: 2009-10-29 05:03:35 -0500 (Thu, 29 Oct 2009)
New Revision: 5610

Modified:
   mpich2/trunk/src/pm/hydra/tools/bind/hwloc/bind_hwloc.c
Log:
Fix for issues when No Nodes/Socket level is present 


Modified: mpich2/trunk/src/pm/hydra/tools/bind/hwloc/bind_hwloc.c
===================================================================
--- mpich2/trunk/src/pm/hydra/tools/bind/hwloc/bind_hwloc.c	2009-10-29 09:04:06 UTC (rev 5609)
+++ mpich2/trunk/src/pm/hydra/tools/bind/hwloc/bind_hwloc.c	2009-10-29 10:03:35 UTC (rev 5610)
@@ -68,14 +68,20 @@
     cpuset_sys = obj_sys->cpuset;
 
     /* Compute the number of sockets per NUMA Node */
-    /* FIX ME : We assume that the number of sockets is the same for each node (e.g node 0)!*/
-    obj_node = hwloc_get_obj_inside_cpuset_by_type(topology,cpuset_sys,HWLOC_OBJ_NODE,0);
-    HYDT_bind_info.num_sockets = hwloc_get_nbobjs_inside_cpuset_by_type(topology,obj_node->cpuset,HWLOC_OBJ_SOCKET);
-
-    /* Compute the number of cores per socket */
-    /* FIX ME : We assume that the number of CORES is the same for each SOCKET (e.g sock 0)!*/
-    obj_sock = hwloc_get_obj_by_type(topology,HWLOC_OBJ_SOCKET,0);      
-    HYDT_bind_info.num_cores = hwloc_get_nbobjs_inside_cpuset_by_type(topology,obj_sock->cpuset,HWLOC_OBJ_CORE);    
+   /* FIX ME : We assume that the number of sockets is the same for each node (e.g node 0)!*/
+   obj_node = hwloc_get_obj_inside_cpuset_by_type(topology,cpuset_sys,HWLOC_OBJ_NODE,0);
+   if(obj_node)
+     HYDT_bind_info.num_sockets = hwloc_get_nbobjs_inside_cpuset_by_type(topology,obj_node->cpuset,HWLOC_OBJ_SOCKET);
+   else
+     HYDT_bind_info.num_sockets = hwloc_get_nbobjs_by_type(topology,HWLOC_OBJ_SOCKET);
+   
+   /* Compute the number of cores per socket */
+   /* FIX ME : We assume that the number of CORES is the same for each SOCKET (e.g sock 0)!*/
+   obj_sock = hwloc_get_obj_by_type(topology,HWLOC_OBJ_SOCKET,0);      
+   if(obj_node)
+     HYDT_bind_info.num_cores = hwloc_get_nbobjs_inside_cpuset_by_type(topology,obj_sock->cpuset,HWLOC_OBJ_CORE);    
+   else
+     HYDT_bind_info.num_cores = hwloc_get_nbobjs_by_type(topology,HWLOC_OBJ_CORE);
     
     HYDT_bind_info.num_threads = (HYDT_bind_info.num_procs/(hwloc_get_nbobjs_by_type(topology,HWLOC_OBJ_CORE))); 
 



More information about the mpich2-commits mailing list