Skip to content
Snippets Groups Projects
Commit cdc6c061 authored by Felix Weiglhofer's avatar Felix Weiglhofer Committed by Dominik Smith
Browse files

algo::Unpack: Add timers.

parent d214378f
No related branches found
No related tags found
1 merge request!1219algo: Unpack TOF and STS in parallel.
......@@ -7,6 +7,8 @@
#include <chrono>
#include <xpu/host.h>
#include "compat/Algorithm.h"
#include "log.hpp"
......@@ -17,6 +19,8 @@ namespace cbm::algo
// ----- Execution -------------------------------------------------------
Unpack::resultType Unpack::operator()(const fles::Timeslice* timeslice)
{
xpu::scoped_timer t0("Unpack");
// --- Output data
resultType result = {};
CbmDigiTimeslice& digiTs = result.first;
......@@ -25,6 +29,7 @@ namespace cbm::algo
ParallelInit(*timeslice);
if (DetectorEnabled(fles::SubsystemIdentifier::STS)) {
xpu::scoped_timer t1("STS");
ParallelMsLoop(digiTs.fData.fSts.fDigis, monitor.fSts, *timeslice, 0x20);
}
......@@ -36,6 +41,8 @@ namespace cbm::algo
if (!DetectorEnabled(systemId)) continue;
xpu::scoped_timer t1(fles::to_string(systemId));
// Equipment ID of current component
const uint16_t equipmentId = timeslice->descriptor(comp, 0).eq_id;
......@@ -68,6 +75,8 @@ namespace cbm::algo
} //# component
// --- Sorting of output digis. Is required by both digi trigger and event builder.
xpu::scoped_timer t2("Sort");
Sort(digiTs.fData.fSts.fDigis.begin(), digiTs.fData.fSts.fDigis.end(),
[](CbmStsDigi digi1, CbmStsDigi digi2) { return digi1.GetTime() < digi2.GetTime(); });
Sort(digiTs.fData.fMuch.fDigis.begin(), digiTs.fData.fMuch.fDigis.end(),
......@@ -305,6 +314,8 @@ namespace cbm::algo
// ----------------------------------------------------------------------------
void Unpack::ParallelInit(const fles::Timeslice& timeslice)
{
xpu::scoped_timer t("ParallelInit");
fParallelStsSetup = {};
size_t numMs = 0;
......@@ -341,19 +352,25 @@ namespace cbm::algo
auto& msDigis = fParallelStsSetup.msDigis;
size_t numMs = msDigis.size();
xpu::push_timer("Unpack");
#pragma omp parallel for schedule(dynamic)
for (size_t i = 0; i < numMs; i++) {
auto result = fAlgoSts.at(msEqIds[i])(msContent[i], msDesc[i], ts.start_time());
msDigis[i] = std::move(result.first);
monitor[i] = std::move(result.second);
}
xpu::pop_timer();
size_t nDigisTotal = 0;
for (const auto& digis : msDigis) {
nDigisTotal += digis.size();
}
xpu::push_timer("Resize");
digisOut.resize(nDigisTotal);
xpu::pop_timer();
xpu::push_timer("Merge");
#pragma omp parallel for schedule(dynamic)
for (unsigned int i = 0; i < numMs; i++) {
unsigned int offset = 0;
......@@ -361,6 +378,7 @@ namespace cbm::algo
offset += msDigis[x].size();
std::copy(msDigis[i].begin(), msDigis[i].end(), digisOut.begin() + offset);
}
xpu::pop_timer();
monitorOut = std::move(monitor);
......
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