numactl
systemLinux
The numactl command is one of the most frequently used commands in Linux/Unix-like operating systems. numactl Control NUMA policy for processes or shared memory
Quick Reference
Command Name:
numactl
Category:
system
Platform:
Linux
Basic Usage:
numactl [options] [arguments]
Common Use Cases
Syntax
numactl [options] -- program [arguments]
Options
Option | Description |
---|---|
--hardware , -H |
Show hardware configuration |
--show , -s |
Show NUMA policy settings of current process |
--membind=nodes , -m nodes |
Only allocate memory from specified nodes |
--cpunodebind=nodes , -N nodes |
Only execute process on CPUs of specified nodes |
--physcpubind=cpus , -C cpus |
Only execute process on specified physical CPUs |
--localalloc , -l |
Allocate memory on the current node |
--preferred=node , -p node |
Prefer memory allocations from specified node |
--interleave=nodes , -i nodes |
Interleave memory allocations between nodes |
--offset=offset , -o offset |
Set offset in shared memory segment (for --shmid option) |
--shmmode=mode |
Set shared memory segment mode (for --shmid option) |
--length=length , -L length |
Set length of shared memory segment (for --shmid option) |
--shmid=id |
Operate on shared memory segment with specified id |
--huge |
Use huge pages for shared memory segment |
--touch |
Touch pages before process startup (for --shmid option) |
Node Specification Format:
Format | Description |
---|---|
number | Single node (e.g., 0, 1, 2) |
number1-number2 | Range of nodes (e.g., 0-2 means nodes 0, 1, 2) |
number1,number2,... | List of nodes (e.g., 0,2 means nodes 0 and 2) |
all | All online nodes |
Examples
How to Use These Examples
The examples below show common ways to use the numactl
command. Try them in your terminal to see the results. You can copy any example by clicking on the code block.
# Basic Examples Basic
numactl --show