Skip to content

Commit 19acaa2

Browse files
committed
GPU: For spawning a single task, no need to go through TBB
1 parent 7217376 commit 19acaa2

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

GPU/GPUTracking/Base/GPUReconstructionProcessing.cxx

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -45,9 +45,14 @@ void GPUReconstructionProcessing::SetNActiveThreads(int32_t n)
4545

4646
void GPUReconstructionProcessing::runParallelOuterLoop(bool doGPU, uint32_t nThreads, std::function<void(uint32_t)> lambda)
4747
{
48-
tbb::task_arena(SetAndGetNActiveThreadsOuterLoop(!doGPU, nThreads)).execute([&] {
49-
tbb::parallel_for<uint32_t>(0, nThreads, lambda, tbb::simple_partitioner());
50-
});
48+
uint32_t nThreadsAdjusted = SetAndGetNActiveThreadsOuterLoop(!doGPU, nThreads);
49+
if (nThreadsAdjusted > 1) {
50+
tbb::task_arena(nThreadsAdjusted).execute([&] {
51+
tbb::parallel_for<uint32_t>(0, nThreads, lambda, tbb::simple_partitioner());
52+
});
53+
} else {
54+
lambda(0);
55+
}
5156
}
5257

5358
namespace o2::gpu

0 commit comments

Comments
 (0)