Skip to content
Snippets Groups Projects
Commit 7aab8d24 authored by Felix Weiglhofer's avatar Felix Weiglhofer
Browse files

alg::sts::Hitfinder: Use more efficient parallelization on CPU.

parent 6cbfa7cb
No related branches found
No related tags found
1 merge request!1244algo: Add protection against monster events in Sts Hitfinder.
......@@ -496,7 +496,7 @@ XPU_D void sts::Hitfinder::FindHits(FindHits::context& ctx) const
// On GPU process all front clusters in parallel instead (one thread per cluster)
// to fully utilize the GPU.
// Currently use option 2 for both as it is faster on CPU as well.
#if XPU_IS_CPU
#if 0
int iModule = ctx.block_idx_x();
#else
int iModule = 0;
......@@ -545,7 +545,7 @@ XPU_D void sts::Hitfinder::FindHits(FindHits::context& ctx) const
float maxSigmaBoth = 4.f * xpu::sqrt(maxTerrF * maxTerrF + maxTerrB * maxTerrB);
int startB = 0;
#if XPU_IS_CPU
#if 0
for (int iClusterF = ctx.thread_idx_x(); iClusterF < nClustersF; iClusterF += ctx.block_dim_x()) {
#else
int iClusterF = iThread;
......
......@@ -134,7 +134,12 @@ void sts::HitfinderChain::operator()(gsl::span<const CbmStsDigi> digis)
queue.wait();
xpu::h_view nClusters {hfc.nClustersPerModule};
size_t nClustersFront = std::accumulate(nClusters.begin(), nClusters.begin() + nModules, 0);
bool isCpu = xpu::device::active().backend() == xpu::cpu;
// FindHits supports to modes of parallelization: One thread per cluster or one block per module
// Currently we use method one for CPU and GPU.
// See sts::Hitfinder::FindHits() for details.
// bool isCpu = xpu::device::active().backend() == xpu::cpu;
bool isCpu = false;
xpu::grid findHitsG = isCpu ? xpu::n_blocks(nModules) : xpu::n_threads(nClustersFront);
queue.launch<FindHits>(findHitsG);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment