Skip to content

Commit

Permalink
Use max processor ID + 1 for numHWthreads on ARM
Browse files Browse the repository at this point in the history
  • Loading branch information
TomTheBear committed Oct 31, 2023
1 parent 4734240 commit 99ebae1
Showing 1 changed file with 19 additions and 27 deletions.
46 changes: 19 additions & 27 deletions src/topology_hwloc.c
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,14 @@ int parse_cpuinfo(uint32_t* count, uint32_t* family, uint32_t* variant, uint32_t
{
if ((binstr(tokens->entry[i],0,&procString) != BSTR_ERR))
{
c++;
struct bstrList* subtokens = bsplit(tokens->entry[i],(char) ':');
bltrimws(subtokens->entry[1]);
uint32_t tmp = ownatoi(bdata(subtokens->entry[1]));
if (tmp > c)
{
c = tmp;
}
bstrListDestroy(subtokens);
}
else if ((f == 0) && (binstr(tokens->entry[i],0,&familyString) != BSTR_ERR))
{
Expand Down Expand Up @@ -129,7 +136,7 @@ int parse_cpuinfo(uint32_t* count, uint32_t* family, uint32_t* variant, uint32_t
*stepping = s;
*part = p;
*vendor = vend;
*count = c;
*count = c + 1;
return 0;
}

Expand Down Expand Up @@ -332,37 +339,22 @@ hwloc_init_cpuInfo(cpu_set_t cpuSet)

cpuid_topology.numHWThreads = LIKWID_HWLOC_NAME(get_nbobjs_by_type)(hwloc_topology, HWLOC_OBJ_PU);
#if defined(__ARM_ARCH_7A__) || defined(__ARM_ARCH_8A)
if (cpuid_info.vendor == FUJITSU_ARM && cpuid_info.part == FUJITSU_A64FX)
{
int max_id = 0;
for (int i = 0; i < LIKWID_HWLOC_NAME(get_nbobjs_by_type)(hwloc_topology, HWLOC_OBJ_PU); i++)
{
obj = LIKWID_HWLOC_NAME(get_obj_by_type)(hwloc_topology, HWLOC_OBJ_PU, i);
if (obj->os_index > max_id)
{
max_id = obj->os_index;
}
}
if (max_id + 1 > count)
{
count = max_id + 1;
}
}
if (count > cpuid_topology.numHWThreads)
{
cpuid_topology.numHWThreads = count;
}
#endif
count = likwid_sysfs_list_len("/sys/devices/system/cpu/online");
if ((count > cpuid_topology.numHWThreads) && (!getenv("HWLOC_FSROOT")))
{

cpuid_topology.numHWThreads = count;
}
if ((cpuid_topology.activeHWThreads > cpuid_topology.numHWThreads) && (!getenv("HWLOC_FSROOT")))
if (!getenv("HWLOC_FSROOT"))
{

cpuid_topology.numHWThreads = cpuid_topology.activeHWThreads;
count = likwid_sysfs_list_len("/sys/devices/system/cpu/online");
if (count > cpuid_topology.numHWThreads)
{
cpuid_topology.numHWThreads = count;
}
if (cpuid_topology.activeHWThreads > cpuid_topology.numHWThreads)
{
cpuid_topology.numHWThreads = cpuid_topology.activeHWThreads;
}
}
DEBUG_PRINT(DEBUGLEV_DEVELOP, HWLOC CpuInfo Family %d Model %d Stepping %d Vendor 0x%X Part 0x%X isIntel %d numHWThreads %d activeHWThreads %d,
cpuid_info.family,
Expand Down

0 comments on commit 99ebae1

Please sign in to comment.