DZone Snippets is a public source code repository. Easily build up your personal collection of code snippets, categorize them with tags / keywords, and share them with the world
NUMA Control Commands
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.
numactl --hardware
Print an overview of the available nodes.




