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