diff --git a/algo/base/compat/OpenMP.h b/algo/base/compat/OpenMP.h index 84d57489debaee5f18e43976d85f8628a99dd8db..b535e43b37525438c8bc1b7defde529cd23a19c9 100644 --- a/algo/base/compat/OpenMP.h +++ b/algo/base/compat/OpenMP.h @@ -45,10 +45,12 @@ namespace cbm::algo::openmp #ifndef HAVE_OMP inline int GetMaxThreads() { return 1; } inline int GetThreadNum() { return 0; } + inline int GetNumThreads() { return 1; } inline void SetNumThreads(int) {} #else inline int GetMaxThreads() { return omp_get_max_threads(); } inline int GetThreadNum() { return omp_get_thread_num(); } + inline int GetNumThreads() { return omp_get_num_threads(); } inline void SetNumThreads(int n) { omp_set_num_threads(n); } #endif diff --git a/algo/detectors/tof/Hitfind.cxx b/algo/detectors/tof/Hitfind.cxx index 02f3e3098956898f756ca2094d7e18e2db0230b9..be317d82f942a551dcd930f3d19f6642da8a5e3e 100644 --- a/algo/detectors/tof/Hitfind.cxx +++ b/algo/detectors/tof/Hitfind.cxx @@ -97,9 +97,9 @@ namespace cbm::algo::tof } monitor.fSortTime = xpu::pop_timer(); - std::vector<Hit> clustersFlat; // cluster storage - std::vector<size_t> chanSizes; // nClusters per channel - std::vector<u32> chanAddresses; // channel addresses + PODVector<Hit> clustersFlat; // cluster storage + PODVector<size_t> chanSizes; // nClusters per channel + PODVector<u32> chanAddresses; // channel addresses // Prefix arrays for parallelization std::vector<size_t> cluPrefix; @@ -111,14 +111,8 @@ namespace cbm::algo::tof xpu::t_add_bytes(digiIn.size_bytes()); #pragma omp parallel { - -#ifdef _OPENMP - int ithread = omp_get_thread_num(); - int nthreads = omp_get_num_threads(); -#else - int ithread = 0; - int nthreads = 1; -#endif + const int ithread = openmp::GetThreadNum(); + const int nthreads = openmp::GetNumThreads(); #pragma omp single { diff --git a/algo/detectors/tof/Hitfind.h b/algo/detectors/tof/Hitfind.h index 23d40eeda5e07f234550ba5b8362a0e6c815d65c..b9b11c8a2becf5235d31b0e0013951c312743171 100644 --- a/algo/detectors/tof/Hitfind.h +++ b/algo/detectors/tof/Hitfind.h @@ -17,8 +17,10 @@ #include <xpu/host.h> +#include "PODVector.h" #include "PartitionedVector.h" + namespace cbm::algo::tof { @@ -52,7 +54,7 @@ namespace cbm::algo::tof class Hitfind { public: - typedef std::tuple<PartitionedVector<Hit>, HitfindMonitorData, std::vector<i32>> resultType; + typedef std::tuple<PartitionedVector<Hit>, HitfindMonitorData, PODVector<i32>> resultType; /** @brief Algorithm execution ** @param fles timeslice to hitfind