HWLOC-CALC(1)

NAME
hwloc-calc - Operate on cpu mask strings and objects

SYNOPSIS
hwloc-calc [options] <location1> [<location2> [...] ]

OPTIONS

-p --physical
    Use OS/physical indexes instead of logical indexes for both input and output.

-l --logical
    Use logical indexes instead of physical/OS indexes for both input and output (default).

--pi --physical-input
    Use OS/physical indexes instead of logical indexes for input.

--li --logical-input
    Use logical indexes instead of physical/OS indexes for input (default).

--po --physical-input
    Use OS/physical indexes instead of logical indexes for output.

--lo --logical-output
    Use logical indexes instead of physical/OS indexes for output (default).

--PUlist
    Report the comma-separated list of processing units' indexes instead of the cpu mask string. When combined with --physical, the list is convenient to pass to external tools such as taskset or numactl --physcpubind.

--nodelist
    Report the comma-separated list of memory nodes' indexes instead of the cpu mask string. When combined with --physical, the list is convenient to pass to external tools such as numactl --membind.

--objects
    Report the list of highest objects instead of the cpu mask string.

--single
    Singlify the output to a single CPU.

-v  Verbose output.

--version
    Report version and exit.

DESCRIPTION
hwloc-calc generates and manipulates CPU mask strings or objects. Both input and output may be either objects (with physical or logical indexes) or CPU mask strings (no logical or physical index involved).

NOTE: It is highly recommended that you read the hwloc(7) overview page before reading this man page. Most of the concepts described in hwloc(7) directly apply to the hwloc-calc utility.

EXAMPLES

hwloc-calc's operation is best described through several examples.

To display the CPU mask corresponding to the second socket:
    $ hwloc-calc socket:1
    0x000000f0 To display the CPU mask corresponding to the third socket, excluding its even numbered logical processors:
    $ hwloc-calc socket:2 ~PU:even
    0x00000c00 To combine two CPU masks:
    $ hwloc-calc 0x0000ffff 0xff000000
    0xff00ffff To display the list of logical processors included in the second socket:
    $ hwloc-calc --PUlist socket:1
    0,2,4,6 To display the list of NUMA nodes, by physical indexes, that intersect a given CPU mask:
    $ hwloc-calc --physical --nodelist 0xf0f0f0f0
    0,2 To display the physical index of a processor given by its logical index:
    $ hwloc-calc PU:2 --physical-output --PUlist
    3 To combine both physical and logical indexes as input:
    $ hwloc-calc PU:2 --physical-input PU:3
    0x0000000c

RETURN VALUE
Upon successful execution, hwloc-calc displays the CPU mask string. The return value is 0.

hwloc-calc will return nonzero if any kind of error occurs, such as (but not limited to): failure to parse the command line.

SEE ALSO
hwloc(7)