diff --git a/reco/detectors/sts/CbmRecoSts.cxx b/reco/detectors/sts/CbmRecoSts.cxx index 49be2bf19dd6cc9b4100a0ea81f9fb0a779a1a49..1405fbf130935875d7c05968038fbfb2bb1d2499 100644 --- a/reco/detectors/sts/CbmRecoSts.cxx +++ b/reco/detectors/sts/CbmRecoSts.cxx @@ -33,6 +33,8 @@ #include <iomanip> +#include <xpu/host.h> + #if __has_include(<omp.h>) #include <omp.h> #endif @@ -334,6 +336,14 @@ InitStatus CbmRecoSts::Init() LOG(info) << "=========================================================="; LOG(info) << GetName() << ": Initialising "; + // Initialize xpu. + // TODO: This call can be relatively expensive. + // We need a way to ensure this happens only once at the beginning. + if (fUseGpuReco) { + setenv("XPU_PROFILE", "1", 1); // Always enable profiling in xpu + xpu::initialize(); + } + // --- Check IO-Manager FairRootManager* ioman = FairRootManager::Instance(); assert(ioman); diff --git a/reco/detectors/sts/experimental/CbmGpuRecoSts.cxx b/reco/detectors/sts/experimental/CbmGpuRecoSts.cxx index 923cb2ce6d758f237feed2e9b656bd1d9077e420..1001a5ba8b15cf1fe3dde9508adfcf35654c9be0 100644 --- a/reco/detectors/sts/experimental/CbmGpuRecoSts.cxx +++ b/reco/detectors/sts/experimental/CbmGpuRecoSts.cxx @@ -190,9 +190,6 @@ void CbmGpuRecoSts::Setup(size_t maxDigisPerModule, size_t nDigitsTotal) void CbmGpuRecoSts::RunHitFinder() { - setenv("XPU_PROFILE", "1", 1); - xpu::initialize(); - auto& hfc = fHitfinderCpu; // ROCm bug: Mi100 name is an emtpy string... @@ -368,6 +365,10 @@ void CbmGpuRecoSts::FetchDigis(size_t& maxDigisPerModule, size_t& nDigisTotal) CbmDigiManager* digis = CbmDigiManager::Instance(); auto& hfc = fHitfinderCpu; + // Remove digis from previous timeslice + fDigisByModuleB.clear(); + fDigisByModuleF.clear(); + // FIXME: GPU reco should use regular digi class too nDigis = digis->GetNofDigis(ECbmModuleId::kSts); nDigisTotal = 0;