HWLOC-CALC(1) hwloc HWLOC-CALC(1) (NAME) hwloc-calc - (SYNOPSIS) hwloc-calc [ ] [] <> [<> [...] ] hwloc(7) hwloc . (TOPOLOGY OPTIONS) . --no-smt, --no-smt= (PU) . N- ( ) . PU . . --no-smt pu:2-5 . : hwloc-calc --restrict $(hwloc-calc --no-smt all) pu:2-5 --cpukind , --cpukind = (PU) (CPU kind) . info . hwloc . lstopo --cpukinds . . --cpukind 0 core:1 . : hwloc-calc --restrict $(hwloc-calc --cpukind 0 all) core:1 --default-nodes NUMA . DRAM ( ) ( HBM NVM CXL ) . NUMA NUMA (locality) ( DRAM HBM ). ()hwloc_topology_get_default_nodeset . --restrict (cpuset) . PU . . PU NUMA . --restrict nodeset= (nodeset) ( --restrict-flags ). NUMA . NUMA PU . --restrict-flags . hwloc_topology_restrict() . bynodeset,memless. 0 ( none) . --disallowed . -i , --input . XML hwloc . "-" XML . hwloc-gather-topology . x86 cpuid hwloc-gather- cpuid . archivemount tarball x86 . -i , --input ( ). "node:2 pu:3" NUMA . PU . --if , --input-format xml fsroot cpuid synthetic. (OUTPUT CONVERSION OPTIONS) ( nodeset) . . . -N --number-of . NUMA PU . . -N numa[hbm] NUMA "HBM" -N numa[mcdram] NUMA MCDRAM KNL . gpu osdev . cpukind memorytier . -I --intersect . . --physical taskset numactl (--physcpubind --membind) . --largest . . -N numa[hbm] NUMA "HBM" -N numa[mcdram] NUMA MCDRAM KNL . NUMA MCDRAM 7 ( NUMA ) . gpu osdev . cpukind memorytier . --object-output ( Core:0 0). -H --hierarchical .... . package.core Package:1.Core:2 Package:2.Core:3 . . NUMA . DRAM HBM NUMA (DRAM) NUMA (HBM) . --largest ( ) . . . --intersect . --local-memory NUMA (local) . -I numa : --local-memory --local-memory-flags -I numa . --object-output ( NUMANode:0 0). --local-memory-flags NUMA . hwloc_get_local_numanode_objs() . . 0xb ( smaller,larger,intersects) NUMA . --local-memory . --best-memattr --local-memory ( ) . (initiator) hwloc-calc . Capacity Locality Bandwidth Latency. : $ lstopo --memattrs --object-output ( NUMANode:0 0). bandwidth,strict,default. default ( --default-nodes). . strict . HBM HBM . HBM strict . / (INPUT / OUTPUT SET AND OBJECT OPTIONS) / . . -p --physical / . -l --logical / (). --pi --physical-input / . --li --logical-input / (). --po --physical-output / . --lo --logical-output / ( cpusets ). -n --nodeset nodeset (CPU sets). --nodeset-output --nodeset-input . --no --nodeset-output (nodeset) . NUMA NUMA . --ni --nodeset-input nodeset . (FORMATTING OPTIONS) . --oo --object-output ( -I --local-memory) ( Core:0 0). --sep . ( --hierarchical --largest ) ( --intersect ). --single . --cpuset-output-format --cof ( nodeset). hwloc . list 2,4-5,8. taskset taskset ( --taskset). systemd-dbus-api D-Bus systemd "ay 0x0002 0x78 0x04" "3-6,10". --nodeset-output-format ( --nof) --nodeset-output . --cpuset-input-format . --cpuset-input-format --cif ( nodeset). hwloc list taskset . "1,3,5" cpuset hwloc "0x1,0x00000003,0x00000005" "1-1,3-3,5-5" . --cpuset-output-format . -q --quiet . . -v --verbose . --version . -h --help . (DESCRIPTION) hwloc-calc . ( ) ( ) ( ) . hwloc(7) . . . . . . . --li -i . : hwloc(7) . hwloc(7) hwloc-calc . (EXAMPLES) hwloc-calc . () : $ hwloc-calc package:1 0x000000f0 () : $ hwloc-calc package:2 ~PU:even 0x00000c00 () : $ hwloc-calc all ~package:3 0x0000f0ff (): $ hwloc-calc 0x0000ffff 0xff000000 0xff00ffff (Examples of listing or counting objects) : $ hwloc-calc --intersect PU package:1 4,5,6,7 GNU OpenMP : $ export GOMP_CPU_AFFINITY=`hwloc-calc --physical-output --intersect PU all` $ echo $GOMP_CPU_AFFINITY 0,4,1,5,2,6,3,7 NUMA () : $ hwloc-calc --physical --intersect NUMAnode 0xf0f0f0f0 0,2 ( ): $ hwloc-calc --cpukind 1 -N core all 4 -H : $ echo 0x000000f0 | hwloc-calc -q -H package.core Package:1.Core1 Package:1.Core:1 Package:1.Core:2 Package:1.Core:3 ( ) --sep : $ echo 0x000000f0 | hwloc-calc -q -H package.core --sep , Package:1.Core1,Package:1.Core:1,Package:1.Core:2,Package:1.Core:3 : $ hwloc-calc core:0 --largest Core:0 $ hwloc-calc core:0-1 --largest Package:0 $ hwloc-calc core:4-7 --largest L3Cache:1 $ hwloc-calc core:2-6 --largest Package:1 Package:2 Core:6 $ hwloc-calc pack:2 --largest Package:2 $ hwloc-calc package:2-3 --largest L3Cache:1 : $ hwloc-calc core:all.pu:0 0xffff0000 $ hwloc-calc --no-smt all -I pu 0,2,4,6,8,10,12,14 : $ hwloc-calc -N cpukind package:0 2 NUMA (Examples of listing or counting NUMA nodes) NUMA : $ hwloc-calc --local-memory-flags 0 --physical-output pack:1 4,7 NUMA : $ hwloc-calc --default-nodes -I numa all 0,2,4,6 () NUMA : $ hwloc-calc --local-memory-flags 0 --best-memattr capacity --physical-output pack:1 4 NUMA "HBM": $ hwloc-calc -N "numa[hbm]" all 4 NUMA ( DRAM HBM DRAM): $ hwloc-calc -N "numa[tier=1]" all 4 NUMA MCDRAM ( KNL) (PU): $ hwloc-calc -I "numa[mcdram]" --oo pu:157 NUMANode:1 NUMA: $ hwloc-calc -I memorytier node:2 1 (Examples with physical and logical indexes) () / / --intersect --physical-output ( ) --physical-input ( ) : $ hwloc-calc --physical-output PU:2 --intersect PU 3 $ hwloc-calc --physical-input PU:3 --intersect PU 2 : $ hwloc-calc --physical-output node:2 --intersect node 3 $ hwloc-calc --physical-input node:3 --intersect node 2 : $ hwloc-calc PU:2 --physical-input PU:3 0x0000000c / (Examples with I/O devices) eth0: $ hwloc-calc os=eth0 0x00005555 PCI 0000:01:02.0: $ hwloc-calc pci=0000:01:02.0 --intersect Package 1 . NUMA (CoProcessor) : $ utils/hwloc/hwloc-calc -I osdev all 0,1,2,3,4,5,6,7,8 $ utils/hwloc/hwloc-calc -I osdev node:1 5,6,7,8 $ utils/hwloc/hwloc-calc -I coproc node:1 7,8 (Examples with other tools) GNU OpenMP : $ export OMP_NUM_THREADS=`hwloc-calc --number-of core all` $ echo $OMP_NUM_THREADS 4 $ export GOMP_CPU_AFFINITY=`hwloc-calc --physical-output --intersect PU --no-smt all` $ echo $GOMP_CPU_AFFINITY 0,2,1,3 resctrl ( ) sed hwloc-calc : $ hwloc-calc pack:all.core:7-9.pu:0 0x00000380,,0x00000380 $ hwloc-calc pack:all.core:7-9.pu:0 | sed -e 's/0x//g' -e 's/,,/,0,/g' -e 's/,,/,0,/g' 00000380,0,00000380 # echo 00000380,0,00000380 > /sys/fs/resctrl/test/cpus # cat /sys/fs/resctrl/test/cpus 00000000,00000380,00000000,00000380 cpuset nodeset systemd-dbus-api (Example of use of the systemd-dbus-api cpuset and nodeset outputs format) hwloc-calc AllowedCPUs AllowedMemoryNodes D-Bus systemd hwloc . systemd- run ( ) . slice systemd : $ busctl call org.freedesktop.systemd1 /org/freedesktop/systemd1 org.freedesktop.systemd1.Manager StartUnit ss my_slice.slice fail slice hwloc-calc : $ busctl call org.freedesktop.systemd1 /org/freedesktop/systemd1 org.freedesktop.systemd1.Manager SetUnitProperties 'sba(sv)' my_slice.slice 1 1 AllowedCPUs $(hwloc-calc pu:0 pu:31 pu:32 pu:63 pu:64 pu:77 --cpuset-output-format systemd-dbus-api) $ busctl call org.freedesktop.systemd1 /org/freedesktop/systemd1 org.freedesktop.systemd1.Manager SetUnitProperties 'sba(sv)' my_slice.slice 1 1 AllowedMemoryNodes $(hwloc-calc pu:0 pu:31 pu:32 pu:63 pu:64 pu:77 --nodeset-output-format systemd-dbus-api) slice : $ busctl call org.freedesktop.systemd1 /org/freedesktop/systemd1 org.freedesktop.systemd1.Manager StartTransientUnit 'ssa(sv)a(sa(sv))' my_scope.scope fail 3 Delegate b 1 PIDs au 1 $$ Slice s my_slice.slice 0 org.freedesktop.systemd1(5) . (RETURN VALUE) hwloc-calc () ( ) ( ) . 0 . ( ) hwloc-calc . (SEE ALSO) hwloc(7), lstopo(1), hwloc-info(1) 2.14.0 June 8, 2026 HWLOC-CALC(1)