From aff24bd77b196c6e218dc716351741efbcf3c401 Mon Sep 17 00:00:00 2001 From: acxz <17132214+acxz@users.noreply.github.com> Date: Sat, 11 Jan 2020 18:11:59 -0500 Subject: [PATCH] remove tbb.h include and specify individual includes needed remove deprecated tbb::task_scheduler_init --- examples/SolverComparer.cpp | 8 -------- examples/TimeTBB.cpp | 8 ++++---- gtsam/base/treeTraversal/parallelTraversalTasks.h | 7 ++----- 3 files changed, 6 insertions(+), 17 deletions(-) diff --git a/examples/SolverComparer.cpp b/examples/SolverComparer.cpp index 80ac08e03..528a441b3 100644 --- a/examples/SolverComparer.cpp +++ b/examples/SolverComparer.cpp @@ -57,12 +57,6 @@ #include #include -#ifdef GTSAM_USE_TBB -#include -#undef max // TBB seems to include windows.h and we don't want these macros -#undef min -#endif - using namespace std; using namespace gtsam; using namespace gtsam::symbol_shorthand; @@ -206,10 +200,8 @@ int main(int argc, char *argv[]) { } #ifdef GTSAM_USE_TBB - std::unique_ptr init; if(nThreads > 0) { cout << "Using " << nThreads << " threads" << endl; - init.reset(new tbb::task_scheduler_init(nThreads)); } else cout << "Using threads for all processors" << endl; #else diff --git a/examples/TimeTBB.cpp b/examples/TimeTBB.cpp index 178fa513f..58da3d67b 100644 --- a/examples/TimeTBB.cpp +++ b/examples/TimeTBB.cpp @@ -28,9 +28,10 @@ using boost::assign::list_of; #ifdef GTSAM_USE_TBB -#include -#undef max // TBB seems to include windows.h and we don't want these macros -#undef min +#include // tbb::blocked_range +#include // tbb::tick_count +#include // tbb::parallel_for +#include // tbb::cache_aligned_allocator static const DenseIndex numberOfProblems = 1000000; static const DenseIndex problemSize = 4; @@ -153,7 +154,6 @@ int main(int argc, char* argv[]) for(size_t n: numThreads) { cout << "With " << n << " threads:" << endl; - tbb::task_scheduler_init init((int)n); results[(int)n].grainSizesWithoutAllocation = testWithoutMemoryAllocation(); results[(int)n].grainSizesWithAllocation = testWithMemoryAllocation(); cout << endl; diff --git a/gtsam/base/treeTraversal/parallelTraversalTasks.h b/gtsam/base/treeTraversal/parallelTraversalTasks.h index 9b2dae3d0..3dd6e307f 100644 --- a/gtsam/base/treeTraversal/parallelTraversalTasks.h +++ b/gtsam/base/treeTraversal/parallelTraversalTasks.h @@ -22,11 +22,8 @@ #include #ifdef GTSAM_USE_TBB -# include -# include -# undef max // TBB seems to include windows.h and we don't want these macros -# undef min -# undef ERROR +#include // tbb::task, tbb::task_list +#include // tbb::scalable_allocator namespace gtsam {