| 62 | } |
| 63 | |
| 64 | int 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 | |
| 93 | void EndpointDeleter(rdma_cm_id* id) { |
| 94 | if (id) { |
no test coverage detected