fix when TBB is disabled
parent
c6cf4d2dab
commit
f3156d4717
|
@ -34,9 +34,11 @@
|
||||||
#include <boost/range/algorithm/set_algorithm.hpp>
|
#include <boost/range/algorithm/set_algorithm.hpp>
|
||||||
#include <boost/random.hpp>
|
#include <boost/random.hpp>
|
||||||
|
|
||||||
|
#ifdef GTSAM_USE_TBB
|
||||||
#include <tbb/tbb.h>
|
#include <tbb/tbb.h>
|
||||||
#undef max // TBB seems to include windows.h and we don't want these macros
|
#undef max // TBB seems to include windows.h and we don't want these macros
|
||||||
#undef min
|
#undef min
|
||||||
|
#endif
|
||||||
|
|
||||||
using namespace std;
|
using namespace std;
|
||||||
using namespace gtsam;
|
using namespace gtsam;
|
||||||
|
@ -185,12 +187,19 @@ int main(int argc, char *argv[]) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef GTSAM_USE_TBB
|
||||||
std::auto_ptr<tbb::task_scheduler_init> init;
|
std::auto_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));
|
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
|
||||||
|
if(nThreads > 0) {
|
||||||
|
std::cout << "GTSAM is not compiled with TBB, so threading is disabled and the --threads option cannot be used." << endl;
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
// Run mode
|
// Run mode
|
||||||
if(incremental)
|
if(incremental)
|
||||||
|
|
Loading…
Reference in New Issue