1 | #pragma once |
2 | |
3 | #include <c10/util/Logging.h> |
4 | |
5 | C10_DECLARE_bool(caffe2_cpu_numa_enabled); |
6 | |
7 | namespace c10 { |
8 | |
9 | /** |
10 | * Check whether NUMA is enabled |
11 | */ |
12 | C10_API bool IsNUMAEnabled(); |
13 | |
14 | /** |
15 | * Bind to a given NUMA node |
16 | */ |
17 | C10_API void NUMABind(int numa_node_id); |
18 | |
19 | /** |
20 | * Get the NUMA id for a given pointer `ptr` |
21 | */ |
22 | C10_API int GetNUMANode(const void* ptr); |
23 | |
24 | /** |
25 | * Get number of NUMA nodes |
26 | */ |
27 | C10_API int GetNumNUMANodes(); |
28 | |
29 | /** |
30 | * Move the memory pointed to by `ptr` of a given size to another NUMA node |
31 | */ |
32 | C10_API void NUMAMove(void* ptr, size_t size, int numa_node_id); |
33 | |
34 | /** |
35 | * Get the current NUMA node id |
36 | */ |
37 | C10_API int GetCurrentNUMANode(); |
38 | |
39 | } // namespace c10 |
40 | |