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

Method InspectNumaNodes

tensorflow/stream_executor/rocm/rocm_platform.cc:38–60  ·  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

36// at module initialization time, because non-GPU programs still include this
37// plugin via various methods, so instead, it has to be init-on-reference.
38void ROCmPlatform::InspectNumaNodes() {
39 // To get NUMA node information, we need to create all executors, so we can
40 // examine their device descriptions to see their bus assignments.
41 std::once_flag once;
42 std::call_once(once, [&] {
43 StreamExecutorConfig config;
44 for (int i = 0; i < VisibleDeviceCount(); i++) {
45 config.ordinal = i;
46 StreamExecutor* exec = GetExecutor(config).ValueOrDie();
47 if (i == 0) {
48 // NUMA nodes may not start at 0, so set the minimum node based on the
49 // first executor we see.
50 min_numa_node_ = exec->GetDeviceDescription().numa_node();
51 limit_numa_node_ = min_numa_node_ + 1;
52 } else {
53 min_numa_node_ =
54 std::min(min_numa_node_, exec->GetDeviceDescription().numa_node());
55 limit_numa_node_ = std::max(
56 limit_numa_node_, exec->GetDeviceDescription().numa_node() + 1);
57 }
58 }
59 });
60}
61
62int ROCmPlatform::BusCount() {
63 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