Skip to content

Commit

Permalink
memattrs: add MemoryTiersNr=2 info attr to topology
Browse files Browse the repository at this point in the history
Closes #661

Signed-off-by: Brice Goglin <Brice.Goglin@inria.fr>
(cherry picked from commit 0839821
                and commit 6d4df37)
  • Loading branch information
bgoglin committed Apr 30, 2024
1 parent 49886d7 commit df30a99
Show file tree
Hide file tree
Showing 10 changed files with 29 additions and 8 deletions.
3 changes: 3 additions & 0 deletions NEWS
Expand Up @@ -21,6 +21,9 @@ Version 2.11.0
--------------
* API
+ Add hwloc_obj_set_subtype().
* Misc
+ The MemoryTiersNr info attribute in the root object now says how many
memory tiers were built. Thanks to Antoine Morvan for the report.
* Tools/
+ Option --best-memattr may now return multiple nodes. Additional
configuration flags may be given to tweak its behavior.
Expand Down
13 changes: 12 additions & 1 deletion doc/hwloc.doxy
@@ -1,6 +1,6 @@
/*
* Copyright © 2009 CNRS
* Copyright © 2009-2023 Inria. All rights reserved.
* Copyright © 2009-2024 Inria. All rights reserved.
* Copyright © 2009-2013 Université Bordeaux
* Copyright © 2009-2020 Cisco Systems, Inc. All rights reserved.
* Copyright © 2020 Hewlett Packard Enterprise. All rights reserved.
Expand Down Expand Up @@ -2032,6 +2032,10 @@ If several components were combined, multiple Backend pairs may exist,
with different values, for instance <tt>x86</tt> and <tt>Linux</tt> in the root
object and <tt>CUDA</tt> in CUDA OS device objects.
</dd>
<dt>MemoryTiersNr</dt>
<dd>The number of different memory tiers in the topology, if any.
See \ref heteromem.
</dd>
<dt>SyntheticDescription</dt>
<dd>The description string that was given to hwloc to build this
synthetic topology.
Expand Down Expand Up @@ -2565,6 +2569,13 @@ $ hwloc-calc -I 'numa[tier=0]' -p all
2,3
\endverbatim

The number of tiers may be retrieved by looking at topology attributes
in the root object:
\verbatim
$ hwloc-info --get-attr "info MemoryTiersNr" topology
2
\endverbatim

hwloc-calc and hwloc-bind also have options such as
<tt>\--local-memory</tt> and <tt>\--best-memattr</tt>
to select the best NUMA node among the local ones.
Expand Down
8 changes: 7 additions & 1 deletion hwloc/memattrs.c
@@ -1,5 +1,5 @@
/*
* Copyright © 2020-2023 Inria. All rights reserved.
* Copyright © 2020-2024 Inria. All rights reserved.
* See COPYING in top-level directory.
*/

Expand Down Expand Up @@ -1806,6 +1806,12 @@ hwloc__apply_memory_tiers_subtypes(hwloc_topology_t topology,
}
}
}
if (nr_tiers > 1) {
hwloc_obj_t root = hwloc_get_root_obj(topology);
char tmp[20];
snprintf(tmp, sizeof(tmp), "%u", nr_tiers);
hwloc__add_info_nodup(&root->infos, &root->infos_count, "MemoryTiersNr", tmp, 1);
}
}

int
Expand Down
2 changes: 1 addition & 1 deletion hwloc/topology-xml.c
@@ -1,6 +1,6 @@
/*
* Copyright © 2009 CNRS
* Copyright © 2009-2023 Inria. All rights reserved.
* Copyright © 2009-2024 Inria. All rights reserved.
* Copyright © 2009-2011, 2020 Université Bordeaux
* Copyright © 2009-2018 Cisco Systems, Inc. All rights reserved.
* See COPYING in top-level directory.
Expand Down
2 changes: 1 addition & 1 deletion tests/hwloc/linux/64intel64-fakeKNL-SNC4-hybrid-msc.output
@@ -1,4 +1,4 @@
Machine (P#0 total=12582912KB ClusterMode=SNC4 MemoryMode=Hybrid50 Backend=Linux OSName=Linux OSRelease=3.10.0-327.el7.x86_64 OSVersion="#1 SMP Thu Oct 29 17:29:29 EDT 2015" HostName=localhost.localdomain Architecture=x86_64)
Machine (P#0 total=12582912KB ClusterMode=SNC4 MemoryMode=Hybrid50 Backend=Linux OSName=Linux OSRelease=3.10.0-327.el7.x86_64 OSVersion="#1 SMP Thu Oct 29 17:29:29 EDT 2015" HostName=localhost.localdomain Architecture=x86_64 MemoryTiersNr=2)
Package L#0 (P#0 total=12582912KB CPUVendor=GenuineIntel CPUFamilyNumber=6 CPUModelNumber=87 CPUModel=06/57 CPUStepping=0)
Group0(Cluster) L#0 (total=3145728KB)
MemCache L#0 (total=1048576KB size=2097152KB linesize=64 ways=1 Inclusive=1)
Expand Down
2 changes: 1 addition & 1 deletion tests/hwloc/linux/64intel64-fakeKNL-SNC4-hybrid.output
@@ -1,4 +1,4 @@
Machine (P#0 total=12582912KB ClusterMode=SNC4 MemoryMode=Hybrid50 Backend=Linux OSName=Linux OSRelease=3.10.0-327.el7.x86_64 OSVersion="#1 SMP Thu Oct 29 17:29:29 EDT 2015" HostName=localhost.localdomain Architecture=x86_64)
Machine (P#0 total=12582912KB ClusterMode=SNC4 MemoryMode=Hybrid50 Backend=Linux OSName=Linux OSRelease=3.10.0-327.el7.x86_64 OSVersion="#1 SMP Thu Oct 29 17:29:29 EDT 2015" HostName=localhost.localdomain Architecture=x86_64 MemoryTiersNr=2)
Package L#0 (P#0 total=12582912KB CPUVendor=GenuineIntel CPUFamilyNumber=6 CPUModelNumber=87 CPUModel=06/57 CPUStepping=0)
L3Cache(MemorySideCache) L#0 (total=3145728KB size=2097152KB linesize=64 ways=1 Inclusive=1)
NUMANode(DRAM) L#0 (P#0 local=1048576KB total=1048576KB MemoryTier=1)
Expand Down
2 changes: 1 addition & 1 deletion tests/hwloc/linux/fakeheteromemtiers.output
@@ -1,4 +1,4 @@
Machine (P#0 total=6236076KB DMIProductName="Standard PC (i440FX + PIIX, 1996)" DMIProductVersion=pc-i440fx-7.0 DMIProductSerial= DMIChassisVendor=QEMU DMIChassisType=1 DMIChassisVersion=pc-i440fx-7.0 DMIChassisSerial= DMIChassisAssetTag= DMIBIOSVendor="EFI Development Kit II / OVMF" DMIBIOSVersion=0.0.0 DMIBIOSDate=02/06/2015 DMISysVendor=QEMU Backend=Linux LinuxCgroup=/ OSName=Linux OSRelease=5.18.0-rc4 OSVersion="#1 SMP PREEMPT_DYNAMIC Tue Apr 26 11:49:51 CEST 2022" HostName=efi Architecture=x86_64)
Machine (P#0 total=6236076KB DMIProductName="Standard PC (i440FX + PIIX, 1996)" DMIProductVersion=pc-i440fx-7.0 DMIProductSerial= DMIChassisVendor=QEMU DMIChassisType=1 DMIChassisVersion=pc-i440fx-7.0 DMIChassisSerial= DMIChassisAssetTag= DMIBIOSVendor="EFI Development Kit II / OVMF" DMIBIOSVersion=0.0.0 DMIBIOSDate=02/06/2015 DMISysVendor=QEMU Backend=Linux LinuxCgroup=/ OSName=Linux OSRelease=5.18.0-rc4 OSVersion="#1 SMP PREEMPT_DYNAMIC Tue Apr 26 11:49:51 CEST 2022" HostName=efi Architecture=x86_64 MemoryTiersNr=3)
Package L#0 (P#0 total=6236076KB CPUVendor=GenuineIntel CPUFamilyNumber=15 CPUModelNumber=107 CPUModel="QEMU Virtual CPU version 2.5+" CPUStepping=1)
L3Cache L#0 (P#0 total=6236076KB size=16384KB linesize=64 ways=16)
Group0 L#0 (total=3398608KB)
Expand Down
2 changes: 1 addition & 1 deletion tests/hwloc/linux/fakememinitiators-1np2c+1npp+gi.output
@@ -1,4 +1,4 @@
Machine (P#0 total=1951314696KB Backend=Linux LinuxCgroup=/)
Machine (P#0 total=1951314696KB Backend=Linux LinuxCgroup=/ MemoryTiersNr=2)
Package L#0 (P#0 total=974581080KB CPUModel="Intel(R) Xeon(R) Gold 6230 CPU @ 2.10GHz")
NUMANode(NVM) L#2 (P#7 local=778043392KB total=778043392KB DAXDevice=dax0.0 DAXType=NVM DAXParent=LNXSYSTM:00/LNXSYBUS:00/ACPI0012:00/ndbus0/region0/dax0.1 MemoryTier=1)
Group0 L#0 (total=97447340KB)
Expand Down
2 changes: 1 addition & 1 deletion tests/hwloc/linux/nvidiagpunumanodes.kept.output
@@ -1,4 +1,4 @@
Machine (P#0 total=358162944KB PlatformName=PowerNV PlatformModel="PowerNV 8335-GTW" Backend=Linux LinuxCgroup=/jjh OSName=Linux OSRelease=4.14.0-49.el7a.bz1553205.page_fault_hang.ppc64le OSVersion="#1 SMP Fri Mar 30 12:06:11 CDT 2018" HostName=c685f8n02 Architecture=ppc64le)
Machine (P#0 total=358162944KB PlatformName=PowerNV PlatformModel="PowerNV 8335-GTW" Backend=Linux LinuxCgroup=/jjh OSName=Linux OSRelease=4.14.0-49.el7a.bz1553205.page_fault_hang.ppc64le OSVersion="#1 SMP Fri Mar 30 12:06:11 CDT 2018" HostName=c685f8n02 Architecture=ppc64le MemoryTiersNr=2)
Package L#0 (P#0 total=177025024KB CPUModel="POWER9, altivec supported" CPURevision="2.1 (pvr 004e 1201)")
NUMANode L#0 (P#0 local=129839104KB total=129839104KB MemoryTier=0)
NUMANode(GPUMemory) L#1 (P#253 local=15728640KB total=15728640KB PCIBusID=0006:00:00.0 MemoryTier=1)
Expand Down
1 change: 1 addition & 0 deletions utils/hwloc/hwloc-info.c
Expand Up @@ -705,6 +705,7 @@ hwloc_info_show_topology_infos(hwloc_topology_t topology)
const char *infoname = root->infos[i].name;
if (!strcmp(infoname, "Backend")
|| !strcmp(infoname, "SyntheticDescription")
|| !strcmp(infoname, "MemoryTiersNr")
|| !strcmp(infoname, "LinuxCgroup")
|| !strcmp(infoname, "WindowsBuildEnvironment")
|| !strcmp(infoname, "OSName")
Expand Down

0 comments on commit df30a99

Please sign in to comment.