Created
October 17, 2023 12:43
-
-
Save jflopezfernandez/a290eef59a5765fc74a3bbd8f6e68f10 to your computer and use it in GitHub Desktop.
Calculate number of NUMA nodes on the current host.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# | |
# Calculate the number of NUMA nodes on the current host. | |
# | |
# iabwi8:~# number-of-numa-nodes | |
# 4 | |
# | |
function number-of-numa-nodes() { | |
ls --directory /sys/devices/system/node/node* | wc --lines | |
} | |
# Output an iterable sequence of all of the NUMA nodes on the current host. | |
# | |
# This function is useful for iterating over all of the NUMA nodes on the host | |
# if you say need to calculate the total number of hugepages available. | |
# | |
# iabwi8:~# echo $(numa-nodes) | |
# 0 1 2 3 | |
# | |
function numa-nodes() { | |
seq 0 $(($(number-of-numa-nodes) - 1)) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment