From b0659da6070a7ace8a7193f2427d991eec01c576 Mon Sep 17 00:00:00 2001 From: Richard Roberts Date: Wed, 14 Aug 2013 19:47:29 +0000 Subject: [PATCH] Enabled multithreaded elimination by default --- gtsam/inference/JunctionTree-inst.h | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/gtsam/inference/JunctionTree-inst.h b/gtsam/inference/JunctionTree-inst.h index 92cd40665..f805b4859 100644 --- a/gtsam/inference/JunctionTree-inst.h +++ b/gtsam/inference/JunctionTree-inst.h @@ -291,9 +291,12 @@ namespace gtsam { boost::shared_ptr result = boost::make_shared(); EliminationData rootsContainer(0, roots_.size()); EliminationPostOrderVisitor visitorPost(function, result->nodes_); - //tbb::task_scheduler_init init(1); - treeTraversal::DepthFirstForest/*Parallel*/(*this, rootsContainer, - eliminationPreOrderVisitor, visitorPost/*, 10*/); +#ifdef ENABLE_TIMING + // In timing mode, use a single thread only, timing outline is not thread-safe. + tbb::task_scheduler_init init(1); +#endif + treeTraversal::DepthFirstForestParallel(*this, rootsContainer, + eliminationPreOrderVisitor, visitorPost, 10); // Create BayesTree from roots stored in the dummy BayesTree node. result->roots_.insert(result->roots_.end(), rootsContainer.bayesTreeNode->children.begin(), rootsContainer.bayesTreeNode->children.end());