From b3f055c3291680fcd4d0544e791533be0ef56929 Mon Sep 17 00:00:00 2001 From: Jan de Cuveland <cuveland@compeng.uni-frankfurt.de> Date: Sun, 12 May 2024 00:26:09 +0200 Subject: [PATCH] Implement experimental timeslice copy/release mode for cbmreco --- algo/base/Options.cxx | 2 ++ algo/base/Options.h | 2 ++ reco/app/cbmreco/main.cxx | 11 ++++++++++- 3 files changed, 14 insertions(+), 1 deletion(-) diff --git a/algo/base/Options.cxx b/algo/base/Options.cxx index 25285bceef..448a074e7d 100644 --- a/algo/base/Options.cxx +++ b/algo/base/Options.cxx @@ -99,6 +99,8 @@ Options::Options(int argc, char** argv) "Write profiling times to yaml file (only when '-t' is set)") ("dump-archive", po::bool_switch(&fDumpArchive)->default_value(false), "Dump archive content to stdout and exit. Provide archive with '-i'. (This is a hack to quick check archive content until we have proper tooling.)") + ("release-mode,R",po::value<bool>(&fReleaseMode)->implicit_value(true), + "Copy and release each timeslice immediately after receiving it") ("help,h", "produce help message") ; diff --git a/algo/base/Options.h b/algo/base/Options.h index 61b6516675..2d580a9e28 100644 --- a/algo/base/Options.h +++ b/algo/base/Options.h @@ -46,6 +46,7 @@ namespace cbm::algo const std::string& ChildId() const { return fChildId; } uint64_t RunId() const { return fRunId; } bool DumpArchive() const { return fDumpArchive; } + bool ReleaseMode() const { return fReleaseMode; } const std::vector<Step>& Steps() const { return fRecoSteps; } @@ -71,6 +72,7 @@ namespace cbm::algo std::string fHistogramUri; int32_t fHistogramHwm; bool fDumpArchive = false; + bool fReleaseMode = false; ProfilingLevel fProfilingLevel = ProfilingNone; std::string fTimingsFile; int fNumTimeslices = -1; diff --git a/reco/app/cbmreco/main.cxx b/reco/app/cbmreco/main.cxx index 524141472e..d5283904f4 100644 --- a/reco/app/cbmreco/main.cxx +++ b/reco/app/cbmreco/main.cxx @@ -14,6 +14,7 @@ #include "gpu/DeviceImage.h" #include "util/MemoryLogger.h" +#include <StorableTimeslice.hpp> #include <TimesliceAutoSource.hpp> #include <log.hpp> @@ -190,12 +191,20 @@ int main(int argc, char** argv) L_(debug) << "Starting to fetch timeslices from source..."; auto startFetchTS = std::chrono::high_resolution_clock::now(); - while (auto ts = source.get()) { + while (auto timeslice = source.get()) { if (tsIdx < opts.SkipTimeslices()) { tsIdx++; continue; } + std::unique_ptr<fles::Timeslice> ts; + if (opts.ReleaseMode()) { + ts = std::make_unique<fles::StorableTimeslice>(*timeslice); + timeslice.reset(); + } else { + ts = std::move(timeslice); + } + auto endFetchTS = std::chrono::high_resolution_clock::now(); auto durationFetchTS = endFetchTS - startFetchTS; extraMonitor.timeIdle += -- GitLab