A high-throughput and memory-efficient inference and serving engine for LLMs
Mirrored from https://github.com/tduncan-lum/Nvidia-Optimization-Stack---VLLM.git
Synced Nov 13, 08:15 UTC
Add NUMA node validation for CPU thread binding (#28555)
Signed-off-by: Bradley <bradley.b.pitt@gmail.com>
usberkeley committed
Nov 13, 2025 at 15:03 UTC
4ab34f6ef1bbd4720a915fe2613ecb9da3090913
1 file changed
+10
csrc/cpu/utils.cpp
+10
@@ -45,6 +45,16 @@ std::string init_cpu_threads_env(const std::string& cpu_ids) {
45
// Memory node binding
46
if (numa_available() != -1) {
47
int mem_node_id = numa_node_of_cpu(omp_cpu_ids.front());
48
+ // Verify all CPUs are on the same NUMA node
49
+ for (size_t i = 1; i < omp_cpu_ids.size(); ++i) {
50
+ int node_id = numa_node_of_cpu(omp_cpu_ids[i]);
51
+ TORCH_CHECK(node_id == mem_node_id, "CPU ", omp_cpu_ids[i],
52
+ " is on NUMA node ", node_id, ", but CPU ",
53
+ omp_cpu_ids.front(), " is on NUMA node ", mem_node_id,
54
+ ". All CPUs should be on the same NUMA node for optimal "
55
+ "performance. Memory will be bound to NUMA node ",
56
+ mem_node_id, ".");
57
+ }
58
bitmask* mask = numa_parse_nodestring(std::to_string(mem_node_id).c_str());
59
bitmask* src_mask = numa_get_membind();
60