numa.h 713 B

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