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

online: Use dynamic scheduling for STS hit creation.

parent 4da2402d
No related branches found
No related tags found
1 merge request!1793online: Use dynamic scheduling for STS hit creation.
Pipeline #29171 passed
...@@ -108,6 +108,7 @@ namespace cbm::algo::sts ...@@ -108,6 +108,7 @@ namespace cbm::algo::sts
using block_size = xpu::block_size<kFindHitsBlockSize>; using block_size = xpu::block_size<kFindHitsBlockSize>;
using constants = xpu::cmem<TheHitfinder, Params>; using constants = xpu::cmem<TheHitfinder, Params>;
using context = xpu::kernel_context<shared_memory, constants>; using context = xpu::kernel_context<shared_memory, constants>;
using openmp = xpu::openmp_settings<xpu::schedule_dynamic, 128>;
XPU_D void operator()(context&); XPU_D void operator()(context&);
}; };
......
...@@ -234,10 +234,13 @@ sts::HitfinderChain::Result sts::HitfinderChain::operator()(gsl::span<const CbmS ...@@ -234,10 +234,13 @@ sts::HitfinderChain::Result sts::HitfinderChain::operator()(gsl::span<const CbmS
<< " hits were discarded!"; << " hits were discarded!";
for (size_t m = 0; m < nModules; m++) { for (size_t m = 0; m < nModules; m++) {
if (static_cast<size_t>(nHits[m]) > hfc.maxHitsPerModule) { const size_t nHitsModule = nHits[m];
L_(error) << "STS Hitfinder Chain: Hit bucket overflow in module " << m << " with " << *nHits[m] << " (of " const size_t nClustersModule = nClusters[m];
<< hfc.maxHitsPerModule << " max)" const float hitsPerCluster = nClustersModule > 0 ? nHitsModule / float(nClustersModule) : 0;
<< " hits!"; if (nHitsModule > hfc.maxHitsPerModule) {
L_(error) << "STS Hitfinder Chain: Hit bucket overflow in module " << m << " with " << nHitsModule << " (of "
<< hfc.maxHitsPerModule << " max) hits! "
<< "Module has " << nClustersModule << " clusters. " << hitsPerCluster << " hits per cluster.";
nHits[m] = hfc.maxHitsPerModule; nHits[m] = hfc.maxHitsPerModule;
} }
} }
...@@ -249,8 +252,8 @@ sts::HitfinderChain::Result sts::HitfinderChain::operator()(gsl::span<const CbmS ...@@ -249,8 +252,8 @@ sts::HitfinderChain::Result sts::HitfinderChain::operator()(gsl::span<const CbmS
size_t nHitsTotal = std::accumulate(nHits.begin(), nHits.end(), 0); size_t nHitsTotal = std::accumulate(nHits.begin(), nHits.end(), 0);
L_(info) << "Timeslice contains " << nHitsTotal << " STS hits and " << nClustersTotal << " STS clusters"; L_(info) << "Timeslice contains " << nHitsTotal << " STS hits and " << nClustersTotal << " STS clusters";
result.hits = std::move(hits); result.hits = std::move(hits);
result.clusters = std::move(clusters); result.clusters = std::move(clusters);
result.monitor.nClusterTotal = nClustersTotal; result.monitor.nClusterTotal = nClustersTotal;
result.monitor.nHitsTotal = result.hits.NElements(); result.monitor.nHitsTotal = result.hits.NElements();
result.monitor.SetDeviceMon(monitor[0]); result.monitor.SetDeviceMon(monitor[0]);
...@@ -336,6 +339,9 @@ void sts::HitfinderChain::AllocateDynamic(size_t maxNDigisPerModule, size_t nDig ...@@ -336,6 +339,9 @@ void sts::HitfinderChain::AllocateDynamic(size_t maxNDigisPerModule, size_t nDig
// TODO: some of these buffers have a constant size and can be allocated statically. // TODO: some of these buffers have a constant size and can be allocated statically.
// Just the data they contain is static. // Just the data they contain is static.
fPars->memory.maxNDigisPerModule = maxNDigisPerModule;
fPars->memory.maxNDigisPerTS = nDigisTotal;
// Shorthands for common constants // Shorthands for common constants
const int nChannels = fPars->setup.nChannels / 2; // Only count channels on one side of the module const int nChannels = fPars->setup.nChannels / 2; // Only count channels on one side of the module
const int nModules = fPars->setup.modules.size(); const int nModules = fPars->setup.modules.size();
...@@ -418,6 +424,8 @@ sts::HitfinderChain::DigiMap sts::HitfinderChain::CountDigisPerModules(gsl::span ...@@ -418,6 +424,8 @@ sts::HitfinderChain::DigiMap sts::HitfinderChain::CountDigisPerModules(gsl::span
u16 moduleIndex = digiMap.ModuleIndex(digi); u16 moduleIndex = digiMap.ModuleIndex(digi);
if (moduleIndex == InvalidModule) continue; if (moduleIndex == InvalidModule) continue;
// if (moduleIndex == InvalidModule || digi.GetAddress() == 0x10000002) continue;
bool isFront = digi.GetChannel() < nChannelsPerSide; bool isFront = digi.GetChannel() < nChannelsPerSide;
nDigis[moduleIndex + (isFront ? 0 : nModules)]++; nDigis[moduleIndex + (isFront ? 0 : nModules)]++;
......
...@@ -53,7 +53,7 @@ if(DOWNLOAD_EXTERNALS) ...@@ -53,7 +53,7 @@ if(DOWNLOAD_EXTERNALS)
if (NOT ${CBM_XPU_DEV}) if (NOT ${CBM_XPU_DEV})
download_project_if_needed(PROJECT xpu download_project_if_needed(PROJECT xpu
GIT_REPOSITORY "https://github.com/fweig/xpu.git" GIT_REPOSITORY "https://github.com/fweig/xpu.git"
GIT_TAG "5d00ebf33a33334bf6631aef6b545a2759f46816" # 2024-02-05 GIT_TAG "f444797545b010923688dcb364003b3e4e1e2275" # 2024-05-02
SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/xpu SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/xpu
CONFIGURE_COMMAND "" CONFIGURE_COMMAND ""
BUILD_COMMAND "" BUILD_COMMAND ""
......
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