MCPcopy Create free account
hub / github.com/DeepRec-AI/DeepRec / InspectNumaNodes

Method InspectNumaNodes

tensorflow/stream_executor/cuda/cuda_platform.cc:78–100  ·  view source on GitHub ↗

Due to legacy issues in user code, we can't currently call InpectNumaNodes at module initialization time, because non-GPU programs still include this plugin via various methods, so instead, it has to be init-on-reference.

Source from the content-addressed store, hash-verified

76// at module initialization time, because non-GPU programs still include this
77// plugin via various methods, so instead, it has to be init-on-reference.
78void CudaPlatform::InspectNumaNodes() {
79 // To get NUMA node information, we need to create all executors, so we can
80 // examine their device descriptions to see their bus assignments.
81 static std::once_flag once;
82 std::call_once(once, [&] {
83 StreamExecutorConfig config;
84 for (int i = 0; i < VisibleDeviceCount(); i++) {
85 config.ordinal = i;
86 StreamExecutor* exec = GetExecutor(config).ValueOrDie();
87 if (i == 0) {
88 // NUMA nodes may not start at 0, so set the minimum node based on the
89 // first executor we see.
90 min_numa_node_ = exec->GetDeviceDescription().numa_node();
91 limit_numa_node_ = min_numa_node_ + 1;
92 } else {
93 min_numa_node_ =
94 std::min(min_numa_node_, exec->GetDeviceDescription().numa_node());
95 limit_numa_node_ = std::max(
96 limit_numa_node_, exec->GetDeviceDescription().numa_node() + 1);
97 }
98 }
99 });
100}
101
102int CudaPlatform::BusCount() {
103 InspectNumaNodes();

Callers

nothing calls this directly

Calls 4

VisibleDeviceCountFunction · 0.85
numa_nodeMethod · 0.80
minFunction · 0.50
maxFunction · 0.50

Tested by

no test coverage detected