numactl is a command line tool for running processes with a specific NUMA policy. It is useful for setting policies for programs that cannot be modified and recompiled.
Here are some simple examples of how to use numactl:
numactl --cpubind=0 --membind=0,1 program
Run the program on the CPUs of node 0 and only allocate memory from node 0 or 1. cpubind uses node numbers, not CPU numbers. On a system with multiple CPUs per node, this can differ.
numactl --preferred=1 numactl --show
Allocate memory preferable from node 1 and show the resulting state.
numactl --interleave=all numbercruncher
Run memory bandwidth-intensive number cruncher with memory interleaved over all available 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 /dev/shm/file.
Print an overview of the available nodes.