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

Function TryToReadNumaNode

tensorflow/contrib/gdr/gdr_memory_manager.cc:64–91  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

62}
63
64int TryToReadNumaNode(ibv_device* device) {
65#if defined(__APPLE__)
66 LOG(INFO) << "OS X does not support NUMA - returning NUMA node 0";
67 return port::kNUMANoAffinity;
68#elif defined(PLATFORM_WINDOWS)
69 // Windows support for NUMA is not currently implemented. Return node 0.
70 return port::kNUMANoAffinity;
71#else
72 auto filename = string(device->ibdev_path) + "/device/numa_node";
73
74 std::ifstream ifs(filename.c_str());
75 string content;
76 const auto& ret = std::getline(ifs, content);
77 if (!ret) {
78 return port::kNUMANoAffinity;
79 }
80
81 int32 value;
82 if (strings::safe_strto32(content, &value)) {
83 if (value < 0) {
84 return port::kNUMANoAffinity;
85 }
86 LOG(INFO) << "NUMA node for device: " << device->name << " is " << value;
87 return value;
88 }
89 return port::kNUMANoAffinity;
90#endif
91}
92
93void EndpointDeleter(rdma_cm_id* id) {
94 if (id) {

Callers 1

InitMethod · 0.70

Calls 2

c_strMethod · 0.80
safe_strto32Function · 0.50

Tested by

no test coverage detected