1HWLOC-PS(1) hwloc HWLOC-PS(1)
2
3
4
6 hwloc-ps - List currently-running processes or threads that are bound
7
9 hwloc-ps [options]
10
12 -a List all processes, even those that are not bound to any spe‐
13 cific part of the machine.
14
15 --pid <pid>
16 Only show process of PID <pid>, even if it is not bound to
17 any specific part of the machine.
18
19 --name <name>
20 Only show processes whose name contains <name>, even if they
21 are not bound to any specific part of the machine. This is
22 not supported on all operating systems.
23
24 -p --physical
25 Report OS/physical indexes instead of logical indexes
26
27 -l --logical
28 Report logical indexes instead of physical/OS indexes
29 (default)
30
31 -c --cpuset
32 Show process bindings as cpusets instead of objects.
33
34 -t --threads
35 Show threads inside processes. If -a is given as well, list
36 all threads within each process. Otherwise, show all threads
37 inside each process where at least one thread is bound. This
38 is currently only supported on Linux.
39
40 -e --get-last-cpu-location
41 Report the last processors where the process/thread ran.
42 Note that the result may already be outdated when reported
43 since the operating system may move the tasks to other pro‐
44 cessors at any time according to the binding.
45
46 --whole-system
47 Do not consider administration limitations.
48
49 --pid-cmd <cmd>
50 Append the output of the given command to each PID line. For
51 each displayed process ID, execute the command <cmd> <pid>
52 and append the first line of its output to the regular hwloc-
53 ps line.
54
56 By default, hwloc-ps lists only those currently-running processes that
57 are bound. If -t is given, processes that are not bound but contain at
58 least one bound thread are also displayed, as well as all their
59 threads.
60
61 hwloc-ps displays process identifier, command-line and binding. The
62 binding may be reported as objects or cpusets.
63
64 By default, process bindings are restricted to the currently available
65 topology. If some processes are bound to processors that are not avail‐
66 able to the current process, they are ignored unless --whole-system is
67 given.
68
69 The output is a plain list. If you wish to annotate the hierarchical
70 topology with processes so as to see how they are actual distributed on
71 the machine, you might want to use lstopo --ps instead (which also only
72 shows processes that are bound).
73
74 The -a switch can be used to show all processes, if desired.
75
77 If a process is bound, it appears in the default output:
78
79 $ utils/hwloc-ps
80 4759 Core:0 myprogram
81
82 If a process is not bound but 3 of his 4 threads are bound, it only
83 appears in the thread-aware output (or if explicitly selected):
84
85 $ utils/hwloc-ps
86
87 $ utils/hwloc-ps -t
88 4759 Machine:0 myprogram
89 4759 Machine:0
90 4761 PU:0
91 4762 PU:2
92 4765 PU:1
93
94 $ utils/hwloc-ps --pid 4759
95 4759 Machine:0 myprogram
96
97 To display the binding of already running MPI processes (launched by
98 Open MPI) and append their MPI rank (in MPI_COMM_WORLD) to each line:
99
100 $ utils/hwloc-ps --pid-cmd myscript
101 29093 L1dCache:0 myprogram OMPI_COMM_WORLD_RANK=0
102 29094 L1dCache:2 myprogram OMPI_COMM_WORLD_RANK=1
103 29095 L1dCache:1 myprogram OMPI_COMM_WORLD_RANK=2
104 29096 L1dCache:3 myprogram OMPI_COMM_WORLD_RANK=3
105
106 where myscript is a bash script doing:
107
108 #!/bin/sh
109 cat /proc/$1/environ 2>/dev/null | xargs --null --max-args=1 echo |
110 grep OMPI_COMM_WORLD_RANK
111
112
114 hwloc(7), lstopo(1), hwloc-calc(1), hwloc-distrib(1)
115
116
117
118
1191.11.9 Jan 18, 2018 HWLOC-PS(1)