The emerging standard for easily binding processes to processors on Linux-based NUMA supercomputers is numactl. It can operate on a coarser-grained basis (i.e., CPU sockets rather than individual CPU cores) than taskset (only CPU cores) because it is aware of the processor topology and how the CPU cores map to CPU sockets. Using numact is typically easier–after all, the common goal is to confine a process to a numa pool (or “cpu node”) rather than specific CPU cores. To that end, numactl also lets you bind a processor’s memory locality to prevent processes from having to jump across NUMA pools (called “memory nodes” in numactl parlance). The policy is set for command and inherited by all of its children. In addition it can set persistent policy for shared memory segments or files.
numactl --cpubind=0 --membind=0,1 myprog Runs program “myprog” on cpu 0, using memory on nodes 0 and 1.
numactl --physcpubind=+0-4,8-12 myapplic arguments Run myapplic on cpus 0-4 and 8-12 of the current cpuset.
numactl --interleave=all bigdatabase arguments Run big database with its memory interleaved on all CPUs.
numactl --cpubind=0 --membind=0,1 process Run process on node 0 with memory allocated on node 0 and 1.
numactl --preferred=1 numactl --show Set preferred node 1 and show the resulting state.
numactl --interleave=all --shmkeyfile /tmp/shmkey Interleave all of the sysv shared memory region specified by /tmp/shmkey over all nodes.
numactl --offset=1G --length=1G --membind=1 --file /dev/shm/A --touch Bind the second gigabyte in the tmpfs file /dev/shm/A to node 1.
numactl --localalloc /dev/shm/file Reset the policy for the shared memory file file to the default localalloc policy.
|GNU General Public License