Open MPI logo

Hardware Locality Users' Mailing List Archives

  |   Home   |   Support   |   FAQ   |   all Hardware Locality Users mailing list

Subject: Re: [hwloc-users] Problems on SMP with 48 cores
From: Brice Goglin (Brice.Goglin_at_[hidden])
Date: 2012-03-13 13:54:42


Le 13/03/2012 17:04, Hartmut Kaiser a écrit :
>>> But the problems I was seeing were not MSVC specific. It's a
>>> proliferation of arcane (non-POSIX) function use (like strcasecmp,
>>> etc.) missing use of HAVE_UNISTD_H, HAVE_STRINGS_H to wrap
>>> non-standard headers, unsafe mixing of
>>> int32<->int64 data types, reliance on int (and other types) having a
>>> certain bit-size, totally unsafe shift operations, wide use of
>>> (non-C-standard) gcc extensions, etc. Should I go on?
> More investigation shows that the code currently assumes group (and
> processor) masks to be 32 bit, which is not true on 64 bit systems. For
> instance this (topology-windows.c: line 643):
>
> hwloc_bitmap_from_ith_ulong(obj->cpuset, GroupMask[i].Group,
> GroupMask[i].Mask);

Try applying something like the patch below. Totally untested obviously,
but we'll see if that starts improving lstopo.

Brice

diff --git a/src/topology-windows.c b/src/topology-windows.c
index 55821a4..94e5073 100644
--- a/src/topology-windows.c
+++ b/src/topology-windows.c
@@ -520,7 +520,8 @@ hwloc_look_windows(struct hwloc_topology *topology)
         obj = hwloc_alloc_setup_object(type, id);
         obj->cpuset = hwloc_bitmap_alloc();
         hwloc_debug("%s#%u mask %lx\n", hwloc_obj_type_string(type), id, procInfo[i].ProcessorMask);
- hwloc_bitmap_from_ulong(obj->cpuset, procInfo[i].ProcessorMask);
+ hwloc_bitmap_from_ulong(obj->cpuset, procInfo[i].ProcessorMask & 0xffffffff);
+ hwloc_bitmap_from_ith_ulong(obj->cpuset, 1, procInfo[i].ProcessorMask >> 32);
 
         switch (type) {
           case HWLOC_OBJ_NODE:
@@ -622,7 +623,8 @@ hwloc_look_windows(struct hwloc_topology *topology)
               mask = procInfo->Group.GroupInfo[id].ActiveProcessorMask;
               hwloc_debug("group %u %d cpus mask %lx\n", id,
                   procInfo->Group.GroupInfo[id].ActiveProcessorCount, mask);
- hwloc_bitmap_from_ith_ulong(obj->cpuset, id, mask);
+ hwloc_bitmap_from_ith_ulong(obj->cpuset, 2*id, mask & 0xffffffff);
+ hwloc_bitmap_from_ith_ulong(obj->cpuset, 2*id+1, mask >> 32);
               hwloc_insert_object_by_cpuset(topology, obj);
             }
             continue;
@@ -636,7 +638,8 @@ hwloc_look_windows(struct hwloc_topology *topology)
         obj->cpuset = hwloc_bitmap_alloc();
         for (i = 0; i < num; i++) {
           hwloc_debug("%s#%u %d: mask %d:%lx\n", hwloc_obj_type_string(type), id, i, GroupMask[i].Group, GroupMask[i].Mask);
- hwloc_bitmap_from_ith_ulong(obj->cpuset, GroupMask[i].Group, GroupMask[i].Mask);
+ hwloc_bitmap_from_ith_ulong(obj->cpuset, 2*GroupMask[i].Group, GroupMask[i].Mask & 0xfffffff);
+ hwloc_bitmap_from_ith_ulong(obj->cpuset, 2*GroupMask[i].Group+1, GroupMask[i].Mask >> 32);
         }
 
         switch (type) {