Migrate to modern TBB version (#6300)

This commit is contained in:
Siarhei Fedartsou
2022-08-24 18:13:49 +02:00
committed by GitHub
parent a98074a051
commit 91895604c9
18 changed files with 586 additions and 718 deletions
-10
View File
@@ -27,12 +27,7 @@
#include <boost/assert.hpp>
#include <boost/filesystem/operations.hpp>
#if TBB_VERSION_MAJOR == 2020
#include <tbb/global_control.h>
#else
#include <tbb/task_scheduler_init.h>
#endif
#include "util/geojson_debug_logger.hpp"
#include "util/geojson_debug_policies.hpp"
@@ -74,13 +69,8 @@ auto getGraphBisection(const PartitionerConfig &config)
int Partitioner::Run(const PartitionerConfig &config)
{
#if TBB_VERSION_MAJOR == 2020
tbb::global_control gc(tbb::global_control::max_allowed_parallelism,
config.requested_num_threads);
#else
tbb::task_scheduler_init init(config.requested_num_threads);
BOOST_ASSERT(init.is_active());
#endif
const std::vector<BisectionID> &node_based_partition_ids = getGraphBisection(config);
+3 -3
View File
@@ -7,7 +7,7 @@
#include "util/log.hpp"
#include "util/timing_util.hpp"
#include <tbb/parallel_do.h>
#include <tbb/parallel_for_each.h>
#include <algorithm>
#include <climits> // for CHAR_BIT
@@ -64,12 +64,12 @@ RecursiveBisection::RecursiveBisection(BisectionGraph &bisection_graph_,
return TreeNode{std::move(graph), internal_state.SCCDepth()};
});
using Feeder = tbb::parallel_do_feeder<TreeNode>;
using Feeder = tbb::feeder<TreeNode>;
TIMER_START(bisection);
// Bisect graph into two parts. Get partition point and recurse left and right in parallel.
tbb::parallel_do(begin(forest), end(forest), [&](const TreeNode &node, Feeder &feeder) {
tbb::parallel_for_each(begin(forest), end(forest), [&](const TreeNode &node, Feeder &feeder) {
const auto cut =
computeInertialFlowCut(node.graph, num_optimizing_cuts, balance, boundary_factor);
const auto center = internal_state.ApplyBisection(