pytorch/c10/util/numa.h
Benson Ma 66a2600b6a [T153220354] Fix header inclusions in c10 (#1541) (#101846)
Summary:
This is a re-attempt to land the iwyu header changes, by taking the diff from [PR 100304](https://github.com/pytorch/pytorch/pull/100304), and adding the bare minimal changes to make the diff build corectly in the internal builds.

X-link: https://github.com/facebookresearch/pytorch3d/pull/1541

X-link: https://github.com/fairinternal/pytorch3d/pull/44

- Re-work D45769819 to fix header inclusions in c10

Test Plan:
```
buck2 build --no-remote-cache mode/dev-nosan //caffe2/c10/...

buck2 build --no-remote-cache mode/dev-nosan //deeplearning/fbgemm/fbgemm_gpu/...

buck2 build mode/dev-nosan //vision/fair/pytorch3d/pytorch3d:_C
```

Reviewed By: malfet

Differential Revision: D45920611

Pull Request resolved: https://github.com/pytorch/pytorch/pull/101846
Approved by: https://github.com/malfet, https://github.com/Skylion007
2023-05-20 19:35:14 +00:00

42 lines
714 B
C++

#pragma once
#include <c10/macros/Export.h>
#include <c10/util/Flags.h>
#include <stddef.h>
C10_DECLARE_bool(caffe2_cpu_numa_enabled);
namespace c10 {
/**
* Check whether NUMA is enabled
*/
C10_API bool IsNUMAEnabled();
/**
* Bind to a given NUMA node
*/
C10_API void NUMABind(int numa_node_id);
/**
* Get the NUMA id for a given pointer `ptr`
*/
C10_API int GetNUMANode(const void* ptr);
/**
* Get number of NUMA nodes
*/
C10_API int GetNumNUMANodes();
/**
* Move the memory pointed to by `ptr` of a given size to another NUMA node
*/
C10_API void NUMAMove(void* ptr, size_t size, int numa_node_id);
/**
* Get the current NUMA node id
*/
C10_API int GetCurrentNUMANode();
} // namespace c10