remove tbb.h include and specify individual includes needed

remove deprecated tbb::task_scheduler_init
release/4.3a0
acxz 2020-01-11 18:11:59 -05:00
parent af5d22248b
commit aff24bd77b
3 changed files with 6 additions and 17 deletions

View File

@ -57,12 +57,6 @@
#include <fstream> #include <fstream>
#include <iostream> #include <iostream>
#ifdef GTSAM_USE_TBB
#include <tbb/tbb.h>
#undef max // TBB seems to include windows.h and we don't want these macros
#undef min
#endif
using namespace std; using namespace std;
using namespace gtsam; using namespace gtsam;
using namespace gtsam::symbol_shorthand; using namespace gtsam::symbol_shorthand;
@ -206,10 +200,8 @@ int main(int argc, char *argv[]) {
} }
#ifdef GTSAM_USE_TBB #ifdef GTSAM_USE_TBB
std::unique_ptr<tbb::task_scheduler_init> init;
if(nThreads > 0) { if(nThreads > 0) {
cout << "Using " << nThreads << " threads" << endl; cout << "Using " << nThreads << " threads" << endl;
init.reset(new tbb::task_scheduler_init(nThreads));
} else } else
cout << "Using threads for all processors" << endl; cout << "Using threads for all processors" << endl;
#else #else

View File

@ -28,9 +28,10 @@ using boost::assign::list_of;
#ifdef GTSAM_USE_TBB #ifdef GTSAM_USE_TBB
#include <tbb/tbb.h> #include <tbb/blocked_range.h> // tbb::blocked_range
#undef max // TBB seems to include windows.h and we don't want these macros #include <tbb/tick_count.h> // tbb::tick_count
#undef min #include <tbb/parallel_for.h> // tbb::parallel_for
#include <tbb/cache_aligned_allocator.h> // tbb::cache_aligned_allocator
static const DenseIndex numberOfProblems = 1000000; static const DenseIndex numberOfProblems = 1000000;
static const DenseIndex problemSize = 4; static const DenseIndex problemSize = 4;
@ -153,7 +154,6 @@ int main(int argc, char* argv[])
for(size_t n: numThreads) for(size_t n: numThreads)
{ {
cout << "With " << n << " threads:" << endl; cout << "With " << n << " threads:" << endl;
tbb::task_scheduler_init init((int)n);
results[(int)n].grainSizesWithoutAllocation = testWithoutMemoryAllocation(); results[(int)n].grainSizesWithoutAllocation = testWithoutMemoryAllocation();
results[(int)n].grainSizesWithAllocation = testWithMemoryAllocation(); results[(int)n].grainSizesWithAllocation = testWithMemoryAllocation();
cout << endl; cout << endl;

View File

@ -22,11 +22,8 @@
#include <boost/make_shared.hpp> #include <boost/make_shared.hpp>
#ifdef GTSAM_USE_TBB #ifdef GTSAM_USE_TBB
# include <tbb/tbb.h> #include <tbb/task.h> // tbb::task, tbb::task_list
# include <tbb/scalable_allocator.h> #include <tbb/scalable_allocator.h> // tbb::scalable_allocator
# undef max // TBB seems to include windows.h and we don't want these macros
# undef min
# undef ERROR
namespace gtsam { namespace gtsam {