fix when TBB is disabled
parent
c6cf4d2dab
commit
f3156d4717
|
@ -34,9 +34,11 @@
|
|||
#include <boost/range/algorithm/set_algorithm.hpp>
|
||||
#include <boost/random.hpp>
|
||||
|
||||
#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 gtsam;
|
||||
|
@ -185,12 +187,19 @@ int main(int argc, char *argv[]) {
|
|||
}
|
||||
}
|
||||
|
||||
#ifdef GTSAM_USE_TBB
|
||||
std::auto_ptr<tbb::task_scheduler_init> 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
|
||||
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
|
||||
if(incremental)
|
||||
|
|
Loading…
Reference in New Issue