numa.h 665 B

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