17 #include "../tbb/tbb_assert_impl.h" 20 #if _MSC_VER && !__INTEL_COMPILER 21 #pragma warning( push ) 22 #pragma warning( disable : 4100 ) 25 #if _MSC_VER && !__INTEL_COMPILER 26 #pragma warning( pop ) 33 #define assertion_hwloc_wrapper(command, ...) \ 34 __TBB_ASSERT_EX( (command(__VA_ARGS__)) >= 0, "Error occurred during call to hwloc API."); 90 if ( hwloc_topology_init( &
topology ) == 0 ) {
92 if ( hwloc_topology_load(
topology ) == 0 ) {
138 unsigned counter = 0;
140 int max_numa_index = -1;
142 hwloc_obj_t node_buffer;
144 node_buffer = hwloc_get_obj_by_type(
topology, HWLOC_OBJ_NUMANODE, i);
152 } hwloc_bitmap_foreach_end();
153 __TBB_ASSERT(max_numa_index >= 0,
"Maximal NUMA index must not be negative");
161 node_buffer = hwloc_get_obj_by_type(
topology, HWLOC_OBJ_NUMANODE, i);
162 index = static_cast<int>(node_buffer->logical_index);
165 current_mask = hwloc_bitmap_dup(node_buffer->cpuset);
168 __TBB_ASSERT(!hwloc_bitmap_iszero(current_mask),
"hwloc detected unavailable NUMA node");
170 } hwloc_bitmap_foreach_end();
190 void fill(
int& nodes_count,
int*& indexes_list,
int*& concurrency_list ) {
203 hwloc_bitmap_free(mask_to_free);
211 "Current affinity mask must intersects with process affinity mask");
220 "Trying to get affinity mask for uninitialized NUMA node");
248 "The slot number is greater than the number of slots in the arena");
250 "Trying to get access to uninitialized platform_topology");
259 "Trying to get access to uninitialized platform_topology");
268 int& nodes_count,
int*& indexes_list,
int*& concurrency_list ) {
274 __TBB_ASSERT(slot_num > 0,
"Trying to create numa handler for 0 threads.");
279 __TBB_ASSERT(handler_ptr != NULL,
"Trying to deallocate NULL pointer.");
284 __TBB_ASSERT(handler_ptr != NULL,
"Trying to get access to uninitialized metadata.");
286 "Trying to get access to uninitialized platform_topology.");
291 __TBB_ASSERT(handler_ptr != NULL,
"Trying to get access to uninitialized metadata.");
293 "Trying to get access to uninitialized platform_topology.");
302 #undef assertion_hwloc_wrapper void set_new_affinity_mask(const_affinity_mask new_mask)
binding_handler(size_t size)
hwloc_cpuset_t process_cpu_affinity_mask
affinity_mask allocate_process_affinity_mask()
void fill(int &nodes_count, int *&indexes_list, int *&concurrency_list)
void restore_previous_affinity_mask(unsigned slot_num)
hwloc_cpuset_t affinity_mask
hwloc_const_cpuset_t const_affinity_mask
std::vector< platform_topology::affinity_mask > affinity_masks_container
std::vector< int > default_concurrency_list
void const char const char int ITT_FORMAT __itt_group_sync x void const char ITT_FORMAT __itt_group_sync s void ITT_FORMAT __itt_group_sync p void ITT_FORMAT p void ITT_FORMAT p no args __itt_suppress_mode_t unsigned int void size_t size
void initialize(size_t groups_num)
void store_current_affinity_mask(affinity_mask current_mask)
friend class numa_affinity_handler
void bind_to_node(binding_handler *handler_ptr, int slot_num, int numa_id)
void initialize_numa_topology(size_t groups_num, int &nodes_count, int *&indexes_list, int *&concurrency_list)
static platform_topology & instance()
void deallocate_binding_handler(binding_handler *handler_ptr)
const_affinity_mask get_node_affinity_mask(int node_index)
bool intergroup_binding_allowed(size_t groups_num)
std::vector< hwloc_cpuset_t > affinity_masks_list
binding_handler * allocate_binding_handler(int slot_num)
#define assertion_hwloc_wrapper(command,...)
void free_affinity_mask(affinity_mask mask_to_free)
void bind_thread_to_node(unsigned slot_num, unsigned numa_node_id)
bool is_topology_parsed()
#define __TBB_ASSERT(predicate, comment)
No-op version of __TBB_ASSERT.
void restore_affinity(binding_handler *handler_ptr, int slot_num)
hwloc_nodeset_t process_node_affinity_mask
enum tbb::internal::platform_topology::init_stages initialization_state
affinity_masks_container affinity_backup
std::vector< int > numa_indexes_list
hwloc_topology_t topology