info.h 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. /*
  2. Copyright (c) 2019-2020 Intel Corporation
  3. Licensed under the Apache License, Version 2.0 (the "License");
  4. you may not use this file except in compliance with the License.
  5. You may obtain a copy of the License at
  6. http://www.apache.org/licenses/LICENSE-2.0
  7. Unless required by applicable law or agreed to in writing, software
  8. distributed under the License is distributed on an "AS IS" BASIS,
  9. WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  10. See the License for the specific language governing permissions and
  11. limitations under the License.
  12. */
  13. #ifndef __TBB_info_H
  14. #define __TBB_info_H
  15. #include "tbb_config.h"
  16. #if __TBB_NUMA_SUPPORT
  17. #include <vector>
  18. namespace tbb {
  19. namespace internal {
  20. namespace numa_topology {
  21. unsigned nodes_count();
  22. void fill(int* indexes_array);
  23. int default_concurrency(int node_id);
  24. } //namespace numa_topology
  25. } // namespace internal
  26. typedef int numa_node_id;
  27. namespace info {
  28. inline std::vector<numa_node_id> numa_nodes() {
  29. std::vector<numa_node_id> nodes_indexes(tbb::internal::numa_topology::nodes_count());
  30. internal::numa_topology::fill(&nodes_indexes.front());
  31. return nodes_indexes;
  32. }
  33. inline int default_concurrency(numa_node_id id = -1) {
  34. return internal::numa_topology::default_concurrency(id);
  35. }
  36. } // namespace info
  37. } // namespace tbb
  38. #endif /*__TBB_NUMA_SUPPORT*/
  39. #endif /*__TBB_info_H*/