Warning, file /include/oneapi/tbb/info.h was not indexed
or was modified since last indexation (in which case cross-reference links may be missing, inaccurate or erroneous).
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017 #ifndef __TBB_info_H
0018 #define __TBB_info_H
0019
0020 #include "detail/_config.h"
0021 #include "detail/_namespace_injection.h"
0022
0023 #if __TBB_ARENA_BINDING
0024 #include <vector>
0025 #include <cstdint>
0026
0027 namespace tbb {
0028 namespace detail {
0029
0030 namespace d1{
0031
0032 using numa_node_id = int;
0033 using core_type_id = int;
0034
0035
0036 struct constraints {
0037 #if !__TBB_CPP20_PRESENT
0038 constraints(numa_node_id id = -1, int maximal_concurrency = -1)
0039 : numa_id(id)
0040 , max_concurrency(maximal_concurrency)
0041 {}
0042 #endif
0043
0044 constraints& set_numa_id(numa_node_id id) {
0045 numa_id = id;
0046 return *this;
0047 }
0048 constraints& set_max_concurrency(int maximal_concurrency) {
0049 max_concurrency = maximal_concurrency;
0050 return *this;
0051 }
0052 constraints& set_core_type(core_type_id id) {
0053 core_type = id;
0054 return *this;
0055 }
0056 constraints& set_max_threads_per_core(int threads_number) {
0057 max_threads_per_core = threads_number;
0058 return *this;
0059 }
0060
0061 numa_node_id numa_id = -1;
0062 int max_concurrency = -1;
0063 core_type_id core_type = -1;
0064 int max_threads_per_core = -1;
0065 };
0066
0067 }
0068
0069 namespace r1 {
0070 TBB_EXPORT unsigned __TBB_EXPORTED_FUNC numa_node_count();
0071 TBB_EXPORT void __TBB_EXPORTED_FUNC fill_numa_indices(int* index_array);
0072 TBB_EXPORT int __TBB_EXPORTED_FUNC numa_default_concurrency(int numa_id);
0073
0074
0075
0076 TBB_EXPORT unsigned __TBB_EXPORTED_FUNC core_type_count(intptr_t reserved = 0);
0077 TBB_EXPORT void __TBB_EXPORTED_FUNC fill_core_type_indices(int* index_array, intptr_t reserved = 0);
0078
0079 TBB_EXPORT int __TBB_EXPORTED_FUNC constraints_default_concurrency(const d1::constraints& c, intptr_t reserved = 0);
0080 TBB_EXPORT int __TBB_EXPORTED_FUNC constraints_threads_per_core(const d1::constraints& c, intptr_t reserved = 0);
0081 }
0082
0083 namespace d1 {
0084
0085 inline std::vector<numa_node_id> numa_nodes() {
0086 std::vector<numa_node_id> node_indices(r1::numa_node_count());
0087 r1::fill_numa_indices(node_indices.data());
0088 return node_indices;
0089 }
0090
0091 inline int default_concurrency(numa_node_id id = -1) {
0092 return r1::numa_default_concurrency(id);
0093 }
0094
0095 inline std::vector<core_type_id> core_types() {
0096 std::vector<int> core_type_indexes(r1::core_type_count());
0097 r1::fill_core_type_indices(core_type_indexes.data());
0098 return core_type_indexes;
0099 }
0100
0101 inline int default_concurrency(constraints c) {
0102 if (c.max_concurrency > 0) { return c.max_concurrency; }
0103 return r1::constraints_default_concurrency(c);
0104 }
0105
0106 }
0107 }
0108
0109 inline namespace v1 {
0110 using detail::d1::numa_node_id;
0111 using detail::d1::core_type_id;
0112
0113 namespace info {
0114 using detail::d1::numa_nodes;
0115 using detail::d1::core_types;
0116
0117 using detail::d1::default_concurrency;
0118 }
0119 }
0120
0121 }
0122
0123 #endif
0124
0125 #endif