change to more efficient call of threaded functions

release/4.3a0
acxz 2020-05-06 16:47:16 -04:00
parent df9cf86cb0
commit e0cbc76456
2 changed files with 3 additions and 5 deletions

View File

@ -221,7 +221,7 @@ int main(int argc, char *argv[]) {
#ifdef GTSAM_USE_TBB
arena.execute([&]{
tg.run([&]{
tg.run_and_wait([&]{
#endif
// Run mode
if(incremental)

View File

@ -89,10 +89,9 @@ map<int, double> testWithoutMemoryAllocation(int num_threads)
// Run parallel code (as a task group) inside of task arena
arena.execute([&]{
tg.run([&]{
tg.run_and_wait([&]{
tbb::parallel_for(tbb::blocked_range<size_t>(0, numberOfProblems), WorkerWithoutAllocation(results));
});
tg.wait();
});
tbb::tick_count t1 = tbb::tick_count::now();
@ -154,10 +153,9 @@ map<int, double> testWithMemoryAllocation(int num_threads)
// Run parallel code (as a task group) inside of task arena
arena.execute([&]{
tg.run([&]{
tg.run_and_wait([&]{
tbb::parallel_for(tbb::blocked_range<size_t>(0, numberOfProblems), WorkerWithAllocation(results));
});
tg.wait();
});
tbb::tick_count t1 = tbb::tick_count::now();