From 64a7bf13bcb0c0a1cf2ea57c30386061d5de088d Mon Sep 17 00:00:00 2001 From: Andres Rios Tascon Date: Wed, 17 Jul 2024 10:41:54 -0700 Subject: [PATCH] Moved more things out of the alpaka directory --- .../plugins/alpaka/LSTModulesDevESProducer.cc | 4 +- RecoTracker/LST/plugins/alpaka/LSTProducer.cc | 4 +- RecoTracker/LST/src/ES_ModulesDev.cc | 5 + RecoTracker/LST/src/alpaka/ES_ModulesDev.cc | 7 +- RecoTracker/LSTCore/interface/Constants.h | 27 ++ .../{alpaka => }/EndcapGeometryBuffer.h | 10 +- .../LSTCore/interface/{alpaka => }/LST.h | 21 +- .../interface/{alpaka => }/LSTESData.h | 28 +- .../LSTCore/interface/{alpaka => }/Module.h | 12 +- .../LSTCore/interface/alpaka/Constants.h | 51 +-- .../{alpaka/LSTESData.dev.cc => LSTESData.cc} | 36 +- .../LSTCore/src/{alpaka => }/ModuleMethods.h | 48 +-- RecoTracker/LSTCore/src/alpaka/Event.dev.cc | 208 +++++----- RecoTracker/LSTCore/src/alpaka/Event.h | 94 ++--- RecoTracker/LSTCore/src/alpaka/Hit.h | 4 +- RecoTracker/LSTCore/src/alpaka/Kernels.h | 84 ++-- RecoTracker/LSTCore/src/alpaka/LST.dev.cc | 373 +++++++++--------- RecoTracker/LSTCore/src/alpaka/MiniDoublet.h | 4 +- .../LSTCore/src/alpaka/NeuralNetwork.h | 4 +- .../LSTCore/src/alpaka/NeuralNetworkWeights.h | 2 +- RecoTracker/LSTCore/src/alpaka/PixelTriplet.h | 270 ++++++------- RecoTracker/LSTCore/src/alpaka/Quintuplet.h | 98 ++--- RecoTracker/LSTCore/src/alpaka/Segment.h | 8 +- .../LSTCore/src/alpaka/TrackCandidate.h | 62 +-- RecoTracker/LSTCore/src/alpaka/Triplet.h | 34 +- 25 files changed, 747 insertions(+), 751 deletions(-) create mode 100644 RecoTracker/LST/src/ES_ModulesDev.cc rename RecoTracker/LSTCore/interface/{alpaka => }/EndcapGeometryBuffer.h (82%) rename RecoTracker/LSTCore/interface/{alpaka => }/LST.h (90%) rename RecoTracker/LSTCore/interface/{alpaka => }/LSTESData.h (63%) rename RecoTracker/LSTCore/interface/{alpaka => }/Module.h (97%) rename RecoTracker/LSTCore/src/{alpaka/LSTESData.dev.cc => LSTESData.cc} (73%) rename RecoTracker/LSTCore/src/{alpaka => }/ModuleMethods.h (91%) diff --git a/RecoTracker/LST/plugins/alpaka/LSTModulesDevESProducer.cc b/RecoTracker/LST/plugins/alpaka/LSTModulesDevESProducer.cc index fb2c2235bf0bb..e4c4e7d01d629 100644 --- a/RecoTracker/LST/plugins/alpaka/LSTModulesDevESProducer.cc +++ b/RecoTracker/LST/plugins/alpaka/LSTModulesDevESProducer.cc @@ -8,8 +8,8 @@ #include "RecoTracker/Record/interface/TrackerRecoGeometryRecord.h" // LST includes -#include "RecoTracker/LSTCore/interface/alpaka/Module.h" -#include "RecoTracker/LSTCore/interface/alpaka/LST.h" +#include "RecoTracker/LSTCore/interface/Module.h" +#include "RecoTracker/LSTCore/interface/LST.h" namespace ALPAKA_ACCELERATOR_NAMESPACE { diff --git a/RecoTracker/LST/plugins/alpaka/LSTProducer.cc b/RecoTracker/LST/plugins/alpaka/LSTProducer.cc index baa521e9cec15..b93580b0a9fa9 100644 --- a/RecoTracker/LST/plugins/alpaka/LSTProducer.cc +++ b/RecoTracker/LST/plugins/alpaka/LSTProducer.cc @@ -19,7 +19,7 @@ #include "RecoTracker/Record/interface/TrackerRecoGeometryRecord.h" -#include "RecoTracker/LSTCore/interface/alpaka/LST.h" +#include "RecoTracker/LSTCore/interface/LST.h" namespace ALPAKA_ACCELERATOR_NAMESPACE { @@ -91,7 +91,7 @@ namespace ALPAKA_ACCELERATOR_NAMESPACE { const bool verbose_, nopLSDupClean_, tcpLSTriplets_; edm::EDPutTokenT lstOutputToken_; - SDL::LST lst_; + SDL::LST lst_; }; } // namespace ALPAKA_ACCELERATOR_NAMESPACE diff --git a/RecoTracker/LST/src/ES_ModulesDev.cc b/RecoTracker/LST/src/ES_ModulesDev.cc new file mode 100644 index 0000000000000..1c341f798246e --- /dev/null +++ b/RecoTracker/LST/src/ES_ModulesDev.cc @@ -0,0 +1,5 @@ +#include "RecoTracker/LSTCore/interface/LSTESData.h" +#include "HeterogeneousCore/AlpakaInterface/interface/config.h" +#include "FWCore/Utilities/interface/typelookup.h" + +TYPELOOKUP_DATA_REG(SDL::LSTESData); diff --git a/RecoTracker/LST/src/alpaka/ES_ModulesDev.cc b/RecoTracker/LST/src/alpaka/ES_ModulesDev.cc index 8545fe76f4f41..a6736c698103b 100644 --- a/RecoTracker/LST/src/alpaka/ES_ModulesDev.cc +++ b/RecoTracker/LST/src/alpaka/ES_ModulesDev.cc @@ -1,7 +1,4 @@ -#include "RecoTracker/LSTCore/interface/alpaka/LST.h" +#include "RecoTracker/LSTCore/interface/LSTESData.h" #include "HeterogeneousCore/AlpakaCore/interface/alpaka/typelookup.h" -// Temporary hack: The DevHost instantiation is needed in both CPU and GPU plugins, -// whereas the (non-host-)Device instantiation only in the GPU plugin -TYPELOOKUP_DATA_REG(ALPAKA_ACCELERATOR_NAMESPACE::SDL::LSTESData); -TYPELOOKUP_ALPAKA_TEMPLATED_DATA_REG(ALPAKA_ACCELERATOR_NAMESPACE::SDL::LSTESData); +TYPELOOKUP_ALPAKA_TEMPLATED_DATA_REG(SDL::LSTESData); diff --git a/RecoTracker/LSTCore/interface/Constants.h b/RecoTracker/LSTCore/interface/Constants.h index b7e98ad32e1bc..3632297c3f9c2 100644 --- a/RecoTracker/LSTCore/interface/Constants.h +++ b/RecoTracker/LSTCore/interface/Constants.h @@ -1,9 +1,36 @@ #ifndef RecoTracker_LSTCore_interface_Constants_h #define RecoTracker_LSTCore_interface_Constants_h +#include "HeterogeneousCore/AlpakaInterface/interface/config.h" + +#ifdef CACHE_ALLOC +#include "HeterogeneousCore/AlpakaInterface/interface/CachedBufAlloc.h" +#endif namespace SDL { + // Buffer type for allocations where auto type can't be used. + template + using Buf = alpaka::Buf; + + // Allocation wrapper function to make integration of the caching allocator easier and reduce code boilerplate. + template + ALPAKA_FN_HOST ALPAKA_FN_INLINE Buf, T> allocBufWrapper(TAcc const& devAccIn, + TSize nElements, + TQueue queue) { +#ifdef CACHE_ALLOC + return cms::alpakatools::allocCachedBuf(devAccIn, queue, alpaka_common::Vec1D(static_cast(nElements))); +#else + return alpaka::allocBuf(devAccIn, alpaka_common::Vec1D(static_cast(nElements))); +#endif + } + + // Second allocation wrapper function when queue is not given. Reduces code boilerplate. + template + ALPAKA_FN_HOST ALPAKA_FN_INLINE Buf, T> allocBufWrapper(TAcc const& devAccIn, TSize nElements) { + return alpaka::allocBuf(devAccIn, alpaka_common::Vec1D(static_cast(nElements))); + } + // If a compile time flag does not define PT_CUT, default to 0.8 (GeV) #ifndef PT_CUT constexpr float PT_CUT = 0.8f; diff --git a/RecoTracker/LSTCore/interface/alpaka/EndcapGeometryBuffer.h b/RecoTracker/LSTCore/interface/EndcapGeometryBuffer.h similarity index 82% rename from RecoTracker/LSTCore/interface/alpaka/EndcapGeometryBuffer.h rename to RecoTracker/LSTCore/interface/EndcapGeometryBuffer.h index af03720bbd8d7..005d2a7a32d75 100644 --- a/RecoTracker/LSTCore/interface/alpaka/EndcapGeometryBuffer.h +++ b/RecoTracker/LSTCore/interface/EndcapGeometryBuffer.h @@ -1,5 +1,5 @@ -#ifndef RecoTracker_LSTCore_interface_alpaka_EndcapGeometryBuffers_h -#define RecoTracker_LSTCore_interface_alpaka_EndcapGeometryBuffers_h +#ifndef RecoTracker_LSTCore_interface_EndcapGeometryBuffers_h +#define RecoTracker_LSTCore_interface_EndcapGeometryBuffers_h #include #include @@ -9,11 +9,9 @@ #include #include -#include "HeterogeneousCore/AlpakaInterface/interface/host.h" +#include "RecoTracker/LSTCore/interface/Constants.h" -#include "RecoTracker/LSTCore/interface/alpaka/Constants.h" - -namespace ALPAKA_ACCELERATOR_NAMESPACE::SDL { +namespace SDL { struct EndcapGeometryDev { const unsigned int* geoMapDetId; diff --git a/RecoTracker/LSTCore/interface/alpaka/LST.h b/RecoTracker/LSTCore/interface/LST.h similarity index 90% rename from RecoTracker/LSTCore/interface/alpaka/LST.h rename to RecoTracker/LSTCore/interface/LST.h index 1f7d3cca05ccb..13aa2ec9896aa 100644 --- a/RecoTracker/LSTCore/interface/alpaka/LST.h +++ b/RecoTracker/LSTCore/interface/LST.h @@ -1,29 +1,30 @@ -#ifndef RecoTracker_LSTCore_interface_alpaka_LST_h -#define RecoTracker_LSTCore_interface_alpaka_LST_h +#ifndef RecoTracker_LSTCore_interface_LST_h +#define RecoTracker_LSTCore_interface_LST_h -#include "RecoTracker/LSTCore/interface/alpaka/Constants.h" -#include "RecoTracker/LSTCore/interface/alpaka/LSTESData.h" +#include "RecoTracker/LSTCore/interface/Constants.h" +#include "RecoTracker/LSTCore/interface/LSTESData.h" #include #include #include #include -namespace ALPAKA_ACCELERATOR_NAMESPACE::SDL { +namespace SDL { template class Event; template class LST; - template <> - class LST { + template + class LST { public: LST() = default; - void run(Queue& queue, + template + void run(TQueue& queue, bool verbose, - const LSTESData* deviceESData, + const LSTESData* deviceESData, const std::vector see_px, const std::vector see_py, const std::vector see_pz, @@ -71,7 +72,7 @@ namespace ALPAKA_ACCELERATOR_NAMESPACE::SDL { const std::vector ph2_y, const std::vector ph2_z); - void getOutput(SDL::Event& event); + void getOutput(SDL::Event& event); std::vector getHitIdxs(const short trackCandidateType, const unsigned int TCIdx, const unsigned int* TCHitIndices, diff --git a/RecoTracker/LSTCore/interface/alpaka/LSTESData.h b/RecoTracker/LSTCore/interface/LSTESData.h similarity index 63% rename from RecoTracker/LSTCore/interface/alpaka/LSTESData.h rename to RecoTracker/LSTCore/interface/LSTESData.h index 8a39f646a08f7..c2a0a92bb668a 100644 --- a/RecoTracker/LSTCore/interface/alpaka/LSTESData.h +++ b/RecoTracker/LSTCore/interface/LSTESData.h @@ -1,9 +1,9 @@ -#ifndef RecoTracker_LSTCore_interface_alpaka_LSTESData_h -#define RecoTracker_LSTCore_interface_alpaka_LSTESData_h +#ifndef RecoTracker_LSTCore_interface_LSTESData_h +#define RecoTracker_LSTCore_interface_LSTESData_h -#include "RecoTracker/LSTCore/interface/alpaka/Constants.h" -#include "RecoTracker/LSTCore/interface/alpaka/EndcapGeometryBuffer.h" -#include "RecoTracker/LSTCore/interface/alpaka/Module.h" +#include "RecoTracker/LSTCore/interface/Constants.h" +#include "RecoTracker/LSTCore/interface/EndcapGeometryBuffer.h" +#include "RecoTracker/LSTCore/interface/Module.h" #include "RecoTracker/LSTCore/interface/PixelMap.h" #include "HeterogeneousCore/AlpakaInterface/interface/CopyToDevice.h" @@ -11,7 +11,7 @@ #include #include -namespace ALPAKA_ACCELERATOR_NAMESPACE::SDL { +namespace SDL { template struct LSTESData { @@ -21,7 +21,7 @@ namespace ALPAKA_ACCELERATOR_NAMESPACE::SDL { unsigned int nEndCapMap; std::shared_ptr> modulesBuffers; std::shared_ptr> endcapGeometryBuffers; - std::shared_ptr pixelMapping; + std::shared_ptr pixelMapping; LSTESData(uint16_t const& nModulesIn, uint16_t const& nLowerModulesIn, @@ -29,7 +29,7 @@ namespace ALPAKA_ACCELERATOR_NAMESPACE::SDL { unsigned int const& nEndCapMapIn, std::shared_ptr> const& modulesBuffersIn, std::shared_ptr> const& endcapGeometryBuffersIn, - std::shared_ptr const& pixelMappingIn) + std::shared_ptr const& pixelMappingIn) : nModules(nModulesIn), nLowerModules(nLowerModulesIn), nPixels(nPixelsIn), @@ -45,18 +45,18 @@ namespace ALPAKA_ACCELERATOR_NAMESPACE::SDL { namespace cms::alpakatools { template <> - struct CopyToDevice> { + struct CopyToDevice> { template - static ALPAKA_ACCELERATOR_NAMESPACE::SDL::LSTESData> copyAsync(TQueue& queue, - ALPAKA_ACCELERATOR_NAMESPACE::SDL::LSTESData const& srcData) { - auto deviceModulesBuffers = std::make_shared>>( + static SDL::LSTESData> copyAsync(TQueue& queue, + SDL::LSTESData const& srcData) { + auto deviceModulesBuffers = std::make_shared>>( alpaka::getDev(queue), srcData.nModules, srcData.nPixels); deviceModulesBuffers->copyFromSrc(queue, *srcData.modulesBuffers); auto deviceEndcapGeometryBuffers = - std::make_shared>>(alpaka::getDev(queue), srcData.nEndCapMap); + std::make_shared>>(alpaka::getDev(queue), srcData.nEndCapMap); deviceEndcapGeometryBuffers->copyFromSrc(queue, *srcData.endcapGeometryBuffers); - return ALPAKA_ACCELERATOR_NAMESPACE::SDL::LSTESData>(srcData.nModules, + return SDL::LSTESData>(srcData.nModules, srcData.nLowerModules, srcData.nPixels, srcData.nEndCapMap, diff --git a/RecoTracker/LSTCore/interface/alpaka/Module.h b/RecoTracker/LSTCore/interface/Module.h similarity index 97% rename from RecoTracker/LSTCore/interface/alpaka/Module.h rename to RecoTracker/LSTCore/interface/Module.h index 206caeaa6d6a4..62ef8a630400a 100644 --- a/RecoTracker/LSTCore/interface/alpaka/Module.h +++ b/RecoTracker/LSTCore/interface/Module.h @@ -1,11 +1,9 @@ -#ifndef RecoTracker_LSTCore_interface_alpaka_Module_h -#define RecoTracker_LSTCore_interface_alpaka_Module_h +#ifndef RecoTracker_LSTCore_interface_Module_h +#define RecoTracker_LSTCore_interface_Module_h -#include +#include "RecoTracker/LSTCore/interface/Constants.h" -#include "RecoTracker/LSTCore/interface/alpaka/Constants.h" - -namespace ALPAKA_ACCELERATOR_NAMESPACE::SDL { +namespace SDL { enum SubDet { InnerPixel = 0, Barrel = 5, Endcap = 4 }; enum Side { NegZ = 1, PosZ = 2, Center = 3 }; @@ -286,7 +284,7 @@ namespace ALPAKA_ACCELERATOR_NAMESPACE::SDL { modulesBuffer(TDev const& dev, unsigned int nMod, unsigned int nPixs) : detIds_buf(allocBufWrapper(dev, nMod)), - moduleMap_buf(allocBufWrapper(dev, nMod * ::SDL::MAX_CONNECTED_MODULES)), + moduleMap_buf(allocBufWrapper(dev, nMod * MAX_CONNECTED_MODULES)), mapdetId_buf(allocBufWrapper(dev, nMod)), mapIdx_buf(allocBufWrapper(dev, nMod)), nConnectedModules_buf(allocBufWrapper(dev, nMod)), diff --git a/RecoTracker/LSTCore/interface/alpaka/Constants.h b/RecoTracker/LSTCore/interface/alpaka/Constants.h index 239a564584fbc..e5189914d4c4d 100644 --- a/RecoTracker/LSTCore/interface/alpaka/Constants.h +++ b/RecoTracker/LSTCore/interface/alpaka/Constants.h @@ -1,20 +1,13 @@ #ifndef RecoTracker_LSTCore_interface_alpaka_Constants_h #define RecoTracker_LSTCore_interface_alpaka_Constants_h -#include - #include "RecoTracker/LSTCore/interface/Constants.h" -#include "HeterogeneousCore/AlpakaInterface/interface/config.h" - -#ifdef CACHE_ALLOC -#include "HeterogeneousCore/AlpakaInterface/interface/CachedBufAlloc.h" -#endif #ifdef ALPAKA_ACC_GPU_CUDA_ENABLED #include #endif -namespace ALPAKA_ACCELERATOR_NAMESPACE::SDL { +namespace SDL { // Half precision wrapper functions. #if defined(FP16_Base) #define __F2H __float2half @@ -26,7 +19,7 @@ namespace ALPAKA_ACCELERATOR_NAMESPACE::SDL { typedef float FPX; #endif - alpaka_common::Vec3D const elementsPerThread(alpaka_common::Vec3D::all(static_cast(1))); + alpaka_common::Vec3D const elementsPerThread(alpaka_common::Vec3D::all(static_cast(1))); // Needed for files that are compiled by g++ to not throw an error. // uint4 is defined only for CUDA, so we will have to revisit this soon when running on other backends. @@ -39,36 +32,14 @@ namespace ALPAKA_ACCELERATOR_NAMESPACE::SDL { }; #endif - // Buffer type for allocations where auto type can't be used. - template - using Buf = alpaka::Buf; - - // Allocation wrapper function to make integration of the caching allocator easier and reduce code boilerplate. - template - ALPAKA_FN_HOST ALPAKA_FN_INLINE Buf, T> allocBufWrapper(TAcc const& devAccIn, - TSize nElements, - TQueue queue) { -#ifdef CACHE_ALLOC - return cms::alpakatools::allocCachedBuf(devAccIn, queue, Vec1D(static_cast(nElements))); -#else - return alpaka::allocBuf(devAccIn, Vec1D(static_cast(nElements))); -#endif - } - - // Second allocation wrapper function when queue is not given. Reduces code boilerplate. - template - ALPAKA_FN_HOST ALPAKA_FN_INLINE Buf, T> allocBufWrapper(TAcc const& devAccIn, TSize nElements) { - return alpaka::allocBuf(devAccIn, Vec1D(static_cast(nElements))); - } - // Wrapper function to reduce code boilerplate for defining grid/block sizes. ALPAKA_FN_HOST ALPAKA_FN_INLINE alpaka_common::Vec3D createVec(int x, int y, int z) { - return alpaka_common::Vec3D(static_cast(x), static_cast(y), static_cast(z)); + return alpaka_common::Vec3D(static_cast(x), static_cast(y), static_cast(z)); } // Adjust grid and block sizes based on backend configuration template - ALPAKA_FN_HOST ALPAKA_FN_INLINE WorkDiv3D createWorkDiv(const Vec& blocksPerGrid, + ALPAKA_FN_HOST ALPAKA_FN_INLINE alpaka_common::WorkDiv3D createWorkDiv(const Vec& blocksPerGrid, const Vec& threadsPerBlock, const Vec& elementsPerThreadArg) { Vec adjustedBlocks = blocksPerGrid; @@ -76,16 +47,16 @@ namespace ALPAKA_ACCELERATOR_NAMESPACE::SDL { // Serial execution, so all launch parameters set to 1. #if defined(ALPAKA_ACC_CPU_B_SEQ_T_SEQ_ENABLED) - adjustedBlocks = Vec::all(static_cast(1)); - adjustedThreads = Vec::all(static_cast(1)); + adjustedBlocks = Vec::all(static_cast(1)); + adjustedThreads = Vec::all(static_cast(1)); #endif // Threads enabled, set number of blocks to 1. #if defined(ALPAKA_ACC_CPU_B_SEQ_T_THREADS_ENABLED) - adjustedBlocks = Vec::all(static_cast(1)); + adjustedBlocks = Vec::all(static_cast(1)); #endif - return WorkDiv3D(adjustedBlocks, adjustedThreads, elementsPerThreadArg); + return alpaka_common::WorkDiv3D(adjustedBlocks, adjustedThreads, elementsPerThreadArg); } // 15 MeV constant from the approximate Bethe-Bloch formula @@ -100,11 +71,7 @@ namespace ALPAKA_ACCELERATOR_NAMESPACE::SDL { ALPAKA_STATIC_ACC_MEM_GLOBAL constexpr float k2Rinv1GeVf = (2.99792458e-3 * 3.8) / 2; ALPAKA_STATIC_ACC_MEM_GLOBAL constexpr float kR1GeVf = 1. / (2.99792458e-3 * 3.8); ALPAKA_STATIC_ACC_MEM_GLOBAL constexpr float sinAlphaMax = 0.95; -#ifdef PT_CUT ALPAKA_STATIC_ACC_MEM_GLOBAL constexpr float ptCut = PT_CUT; -#else - ALPAKA_STATIC_ACC_MEM_GLOBAL constexpr float ptCut = ::SDL::PT_CUT; -#endif ALPAKA_STATIC_ACC_MEM_GLOBAL constexpr float deltaZLum = 15.0; ALPAKA_STATIC_ACC_MEM_GLOBAL constexpr float pixelPSZpitch = 0.15; ALPAKA_STATIC_ACC_MEM_GLOBAL constexpr float stripPSZpitch = 2.4; @@ -117,7 +84,7 @@ namespace ALPAKA_ACCELERATOR_NAMESPACE::SDL { ALPAKA_STATIC_ACC_MEM_GLOBAL constexpr float SDL_INF = 123456789.0; } //namespace SDL -namespace ALPAKA_ACCELERATOR_NAMESPACE::T5DNN { +namespace T5DNN { // Working points matching LST fake rate (43.9%) or signal acceptance (82.0%) ALPAKA_STATIC_ACC_MEM_GLOBAL constexpr float LSTWP1 = 0.3418833f; // 94.0% TPR, 43.9% FPR ALPAKA_STATIC_ACC_MEM_GLOBAL constexpr float LSTWP2 = 0.6177366f; // 82.0% TPR, 20.0% FPR diff --git a/RecoTracker/LSTCore/src/alpaka/LSTESData.dev.cc b/RecoTracker/LSTCore/src/LSTESData.cc similarity index 73% rename from RecoTracker/LSTCore/src/alpaka/LSTESData.dev.cc rename to RecoTracker/LSTCore/src/LSTESData.cc index e22572ecf071d..1950b43259a64 100644 --- a/RecoTracker/LSTCore/src/alpaka/LSTESData.dev.cc +++ b/RecoTracker/LSTCore/src/LSTESData.cc @@ -1,4 +1,4 @@ -#include "RecoTracker/LSTCore/interface/alpaka/LSTESData.h" +#include "RecoTracker/LSTCore/interface/LSTESData.h" #include "RecoTracker/LSTCore/interface/EndcapGeometry.h" #include "RecoTracker/LSTCore/interface/ModuleConnectionMap.h" #include "RecoTracker/LSTCore/interface/TiltedGeometry.h" @@ -6,8 +6,6 @@ #include "ModuleMethods.h" -using namespace ALPAKA_ACCELERATOR_NAMESPACE; - namespace { std::string trackLooperDir() { const char* path_lst_base = std::getenv("LST_BASE"); @@ -41,10 +39,10 @@ namespace { return fullpath.string(); } - void loadMapsHost(::SDL::MapPLStoLayer& pLStoLayer, - std::shared_ptr<::SDL::EndcapGeometry> endcapGeometry, - std::shared_ptr<::SDL::TiltedGeometry> tiltedGeometry, - std::shared_ptr<::SDL::ModuleConnectionMap> moduleConnectionMap) { + void loadMapsHost(SDL::MapPLStoLayer& pLStoLayer, + std::shared_ptr endcapGeometry, + std::shared_ptr tiltedGeometry, + std::shared_ptr moduleConnectionMap) { // Module orientation information (DrDz or phi angles) auto endcap_geom = get_absolute_path_after_check_file_exists(trackLooperDir() + "/data/OT800_IT615_pt0.8/endcap_orientation.bin"); @@ -68,31 +66,31 @@ namespace { auto connectData = connects[i].data(); path = pLSMapDir + connectData + ".bin"; - pLStoLayer[0][i] = ::SDL::ModuleConnectionMap(get_absolute_path_after_check_file_exists(path)); + pLStoLayer[0][i] = SDL::ModuleConnectionMap(get_absolute_path_after_check_file_exists(path)); path = pLSMapDir + "_pos" + connectData + ".bin"; - pLStoLayer[1][i] = ::SDL::ModuleConnectionMap(get_absolute_path_after_check_file_exists(path)); + pLStoLayer[1][i] = SDL::ModuleConnectionMap(get_absolute_path_after_check_file_exists(path)); path = pLSMapDir + "_neg" + connectData + ".bin"; - pLStoLayer[2][i] = ::SDL::ModuleConnectionMap(get_absolute_path_after_check_file_exists(path)); + pLStoLayer[2][i] = SDL::ModuleConnectionMap(get_absolute_path_after_check_file_exists(path)); } } } // namespace -std::unique_ptr> ALPAKA_ACCELERATOR_NAMESPACE::SDL::loadAndFillESHost() { +std::unique_ptr> SDL::loadAndFillESHost() { uint16_t nModules; uint16_t nLowerModules; unsigned int nPixels; - std::shared_ptr> modulesBuffers = nullptr; - auto pLStoLayer = std::make_shared<::SDL::MapPLStoLayer>(); - auto endcapGeometry = std::make_shared<::SDL::EndcapGeometry>(); - auto tiltedGeometry = std::make_shared<::SDL::TiltedGeometry>(); - auto pixelMapping = std::make_shared<::SDL::pixelMap>(); - auto moduleConnectionMap = std::make_shared<::SDL::ModuleConnectionMap>(); + std::shared_ptr> modulesBuffers = nullptr; + auto pLStoLayer = std::make_shared(); + auto endcapGeometry = std::make_shared(); + auto tiltedGeometry = std::make_shared(); + auto pixelMapping = std::make_shared(); + auto moduleConnectionMap = std::make_shared(); ::loadMapsHost(*pLStoLayer, endcapGeometry, tiltedGeometry, moduleConnectionMap); auto endcapGeometryBuffers = - std::make_shared>(cms::alpakatools::host(), endcapGeometry->nEndCapMap); + std::make_shared>(cms::alpakatools::host(), endcapGeometry->nEndCapMap); alpaka::QueueCpuBlocking queue(cms::alpakatools::host()); alpaka::memcpy( queue, endcapGeometryBuffers->geoMapDetId_buf, endcapGeometry->geoMapDetId_buf, endcapGeometry->nEndCapMap); @@ -111,6 +109,6 @@ std::unique_ptr> ALPAKA_AC endcapGeometry.get(), tiltedGeometry.get(), moduleConnectionMap.get()); - return std::make_unique>( + return std::make_unique>( nModules, nLowerModules, nPixels, endcapGeometry->nEndCapMap, modulesBuffers, endcapGeometryBuffers, pixelMapping); } diff --git a/RecoTracker/LSTCore/src/alpaka/ModuleMethods.h b/RecoTracker/LSTCore/src/ModuleMethods.h similarity index 91% rename from RecoTracker/LSTCore/src/alpaka/ModuleMethods.h rename to RecoTracker/LSTCore/src/ModuleMethods.h index 419e21a0f09b7..fe333e7598a8e 100644 --- a/RecoTracker/LSTCore/src/alpaka/ModuleMethods.h +++ b/RecoTracker/LSTCore/src/ModuleMethods.h @@ -4,8 +4,8 @@ #include #include -#include "RecoTracker/LSTCore/interface/alpaka/Constants.h" -#include "RecoTracker/LSTCore/interface/alpaka/Module.h" +#include "RecoTracker/LSTCore/interface/Constants.h" +#include "RecoTracker/LSTCore/interface/Module.h" #include "RecoTracker/LSTCore/interface/TiltedGeometry.h" #include "RecoTracker/LSTCore/interface/EndcapGeometry.h" #include "RecoTracker/LSTCore/interface/ModuleConnectionMap.h" @@ -13,7 +13,7 @@ #include "HeterogeneousCore/AlpakaInterface/interface/host.h" -namespace ALPAKA_ACCELERATOR_NAMESPACE::SDL { +namespace SDL { struct ModuleMetaData { std::map detIdToIndex; std::map module_x; @@ -24,12 +24,12 @@ namespace ALPAKA_ACCELERATOR_NAMESPACE::SDL { }; template - inline void fillPixelMap(std::shared_ptr>& modulesBuf, + inline void fillPixelMap(std::shared_ptr>& modulesBuf, uint16_t nModules, unsigned int& nPixels, - ::SDL::pixelMap& pixelMapping, + pixelMap& pixelMapping, TQueue queue, - const ::SDL::MapPLStoLayer& pLStoLayer, + const MapPLStoLayer& pLStoLayer, struct ModuleMetaData& mmd) { pixelMapping.pixelModuleIndex = mmd.detIdToIndex[1]; @@ -40,11 +40,11 @@ namespace ALPAKA_ACCELERATOR_NAMESPACE::SDL { unsigned int totalSizes = 0; unsigned int totalSizes_pos = 0; unsigned int totalSizes_neg = 0; - for (unsigned int isuperbin = 0; isuperbin < ::SDL::size_superbins; isuperbin++) { + for (unsigned int isuperbin = 0; isuperbin < size_superbins; isuperbin++) { int sizes = 0; for (auto const& mCM_pLS : pLStoLayer[0]) { std::vector connectedModuleDetIds_pLS = - mCM_pLS.getConnectedModuleDetIds(isuperbin + ::SDL::size_superbins); + mCM_pLS.getConnectedModuleDetIds(isuperbin + size_superbins); connectedModuleDetIds.insert( connectedModuleDetIds.end(), connectedModuleDetIds_pLS.begin(), connectedModuleDetIds_pLS.end()); sizes += connectedModuleDetIds_pLS.size(); @@ -82,9 +82,9 @@ namespace ALPAKA_ACCELERATOR_NAMESPACE::SDL { nPixels = connectedPix_size; // Now we can initialize modulesBuf - DevHost const& devHost = cms::alpakatools::host(); + alpaka_common::DevHost const& devHost = cms::alpakatools::host(); if (modulesBuf == nullptr) { - modulesBuf = std::make_shared>(devHost, nModules, nPixels); + modulesBuf = std::make_shared>(devHost, nModules, nPixels); } auto connectedPixels_buf = allocBufWrapper(devHost, connectedPix_size); @@ -109,9 +109,9 @@ namespace ALPAKA_ACCELERATOR_NAMESPACE::SDL { unsigned int nMod, TQueue queue, struct ModuleMetaData& mmd, - const ::SDL::ModuleConnectionMap* moduleConnectionMap) { - DevHost const& devHost = cms::alpakatools::host(); - auto moduleMap_buf = allocBufWrapper(devHost, nMod * ::SDL::MAX_CONNECTED_MODULES); + const ModuleConnectionMap* moduleConnectionMap) { + alpaka_common::DevHost const& devHost = cms::alpakatools::host(); + auto moduleMap_buf = allocBufWrapper(devHost, nMod * MAX_CONNECTED_MODULES); uint16_t* moduleMap = alpaka::getPtrNative(moduleMap_buf); auto nConnectedModules_buf = allocBufWrapper(devHost, nMod); @@ -123,7 +123,7 @@ namespace ALPAKA_ACCELERATOR_NAMESPACE::SDL { auto& connectedModules = moduleConnectionMap->getConnectedModuleDetIds(detId); nConnectedModules[index] = connectedModules.size(); for (uint16_t i = 0; i < nConnectedModules[index]; i++) { - moduleMap[index * ::SDL::MAX_CONNECTED_MODULES + i] = mmd.detIdToIndex[connectedModules[i]]; + moduleMap[index * MAX_CONNECTED_MODULES + i] = mmd.detIdToIndex[connectedModules[i]]; } } @@ -137,7 +137,7 @@ namespace ALPAKA_ACCELERATOR_NAMESPACE::SDL { unsigned int nMod, TQueue queue, struct ModuleMetaData& mmd) { - DevHost const& devHost = cms::alpakatools::host(); + alpaka_common::DevHost const& devHost = cms::alpakatools::host(); auto mapIdx_buf = allocBufWrapper(devHost, nMod); uint16_t* mapIdx = alpaka::getPtrNative(mapIdx_buf); @@ -218,21 +218,21 @@ namespace ALPAKA_ACCELERATOR_NAMESPACE::SDL { nModules = counter; }; - inline void loadModulesFromFile(const ::SDL::MapPLStoLayer* pLStoLayer, + inline void loadModulesFromFile(const MapPLStoLayer* pLStoLayer, const char* moduleMetaDataFilePath, uint16_t& nModules, uint16_t& nLowerModules, unsigned int& nPixels, - std::shared_ptr>& modulesBuf, - ::SDL::pixelMap* pixelMapping, - const ::SDL::EndcapGeometry* endcapGeometry, - const ::SDL::TiltedGeometry* tiltedGeometry, - const ::SDL::ModuleConnectionMap* moduleConnectionMap) { + std::shared_ptr>& modulesBuf, + pixelMap* pixelMapping, + const EndcapGeometry* endcapGeometry, + const TiltedGeometry* tiltedGeometry, + const ModuleConnectionMap* moduleConnectionMap) { ModuleMetaData mmd; loadCentroidsFromFile(moduleMetaDataFilePath, mmd, nModules); - DevHost const& devHost = cms::alpakatools::host(); + alpaka_common::DevHost const& devHost = cms::alpakatools::host(); auto detIds_buf = allocBufWrapper(devHost, nModules); auto layers_buf = allocBufWrapper(devHost, nModules); auto rings_buf = allocBufWrapper(devHost, nModules); @@ -378,10 +378,10 @@ namespace ALPAKA_ACCELERATOR_NAMESPACE::SDL { // modulesBuf is initialized in fillPixelMap since both nModules and nPix will be known fillPixelMap(modulesBuf, nModules, nPixels, *pixelMapping, queue, *pLStoLayer, mmd); - auto src_view_nModules = alpaka::createView(devHost, &nModules, (Idx)1u); + auto src_view_nModules = alpaka::createView(devHost, &nModules, (alpaka_common::Idx)1u); alpaka::memcpy(queue, modulesBuf->nModules_buf, src_view_nModules); - auto src_view_nLowerModules = alpaka::createView(devHost, &nLowerModules, (Idx)1u); + auto src_view_nLowerModules = alpaka::createView(devHost, &nLowerModules, (alpaka_common::Idx)1u); alpaka::memcpy(queue, modulesBuf->nLowerModules_buf, src_view_nLowerModules); alpaka::memcpy(queue, modulesBuf->moduleType_buf, moduleType_buf); diff --git a/RecoTracker/LSTCore/src/alpaka/Event.dev.cc b/RecoTracker/LSTCore/src/alpaka/Event.dev.cc index 2d0d2551eeb2d..462b7ea85f54e 100644 --- a/RecoTracker/LSTCore/src/alpaka/Event.dev.cc +++ b/RecoTracker/LSTCore/src/alpaka/Event.dev.cc @@ -2,7 +2,7 @@ using namespace ALPAKA_ACCELERATOR_NAMESPACE; -void ALPAKA_ACCELERATOR_NAMESPACE::SDL::Event::init(bool verbose) { +void SDL::Event::init(bool verbose) { addObjects = verbose; hitsInGPU = nullptr; mdsInGPU = nullptr; @@ -44,7 +44,7 @@ void ALPAKA_ACCELERATOR_NAMESPACE::SDL::Event::init(bool verbose) { } } -void ALPAKA_ACCELERATOR_NAMESPACE::SDL::Event::resetEvent() { +void SDL::Event::resetEvent() { //reset the arrays for (int i = 0; i < 6; i++) { n_hits_by_layer_barrel_[i] = 0; @@ -150,7 +150,7 @@ void ALPAKA_ACCELERATOR_NAMESPACE::SDL::Event::resetEvent() { } } -void ALPAKA_ACCELERATOR_NAMESPACE::SDL::Event::addHitToEvent(std::vector x, +void SDL::Event::addHitToEvent(std::vector x, std::vector y, std::vector z, std::vector detId, @@ -184,7 +184,7 @@ void ALPAKA_ACCELERATOR_NAMESPACE::SDL::Event::addHitToEvent(std::vector< alpaka::wait(queue); Vec3D const threadsPerBlock1 = createVec(1, 1, 256); - Vec3D const blocksPerGrid1 = createVec(1, 1, ::SDL::MAX_BLOCKS); + Vec3D const blocksPerGrid1 = createVec(1, 1, MAX_BLOCKS); WorkDiv3D const hit_loop_workdiv = createWorkDiv(blocksPerGrid1, threadsPerBlock1, elementsPerThread); hitLoopKernel hit_loop_kernel; @@ -203,7 +203,7 @@ void ALPAKA_ACCELERATOR_NAMESPACE::SDL::Event::addHitToEvent(std::vector< alpaka::enqueue(queue, hit_loop_task); Vec3D const threadsPerBlock2 = createVec(1, 1, 256); - Vec3D const blocksPerGrid2 = createVec(1, 1, ::SDL::MAX_BLOCKS); + Vec3D const blocksPerGrid2 = createVec(1, 1, MAX_BLOCKS); WorkDiv3D const module_ranges_workdiv = createWorkDiv(blocksPerGrid2, threadsPerBlock2, elementsPerThread); moduleRangesKernel module_ranges_kernel; @@ -216,7 +216,7 @@ void ALPAKA_ACCELERATOR_NAMESPACE::SDL::Event::addHitToEvent(std::vector< alpaka::enqueue(queue, module_ranges_task); } -void ALPAKA_ACCELERATOR_NAMESPACE::SDL::Event::addPixelSegmentToEvent(std::vector hitIndices0, +void SDL::Event::addPixelSegmentToEvent(std::vector hitIndices0, std::vector hitIndices1, std::vector hitIndices2, std::vector hitIndices3, @@ -236,13 +236,13 @@ void ALPAKA_ACCELERATOR_NAMESPACE::SDL::Event::addPixelSegmentToEvent(std std::vector isQuad) { unsigned int size = ptIn.size(); - if (size > ::SDL::N_MAX_PIXEL_SEGMENTS_PER_MODULE) { + if (size > N_MAX_PIXEL_SEGMENTS_PER_MODULE) { printf( "*********************************************************\n" "* Warning: Pixel line segments will be truncated. *\n" "* You need to increase N_MAX_PIXEL_SEGMENTS_PER_MODULE. *\n" "*********************************************************\n"); - size = ::SDL::N_MAX_PIXEL_SEGMENTS_PER_MODULE; + size = N_MAX_PIXEL_SEGMENTS_PER_MODULE; } unsigned int mdSize = 2 * size; @@ -254,7 +254,7 @@ void ALPAKA_ACCELERATOR_NAMESPACE::SDL::Event::addPixelSegmentToEvent(std alpaka::createSubView(rangesBuffers->miniDoubletModuleOccupancy_buf, (Idx)1u, (Idx)nLowerModules_); // Create a source view for the value to be set - int value = ::SDL::N_MAX_PIXEL_MD_PER_MODULES; + int value = N_MAX_PIXEL_MD_PER_MODULES; auto src_view_value = alpaka::createView(devHost, &value, (Idx)1u); alpaka::memcpy(queue, dst_view_miniDoubletModuleOccupancy, src_view_value); @@ -278,7 +278,7 @@ void ALPAKA_ACCELERATOR_NAMESPACE::SDL::Event::addPixelSegmentToEvent(std alpaka::memcpy(queue, nTotalMDs_view, rangesBuffers->device_nTotalMDs_buf); alpaka::wait(queue); - nTotalMDs += ::SDL::N_MAX_PIXEL_MD_PER_MODULES; + nTotalMDs += N_MAX_PIXEL_MD_PER_MODULES; mdsInGPU = new SDL::miniDoublets(); miniDoubletsBuffers = new SDL::miniDoubletsBuffer(nTotalMDs, nLowerModules_, devAcc, queue); @@ -311,11 +311,11 @@ void ALPAKA_ACCELERATOR_NAMESPACE::SDL::Event::addPixelSegmentToEvent(std alpaka::memcpy(queue, nTotalSegments_view, rangesBuffers->device_nTotalSegs_buf); alpaka::wait(queue); - nTotalSegments += ::SDL::N_MAX_PIXEL_SEGMENTS_PER_MODULE; + nTotalSegments += N_MAX_PIXEL_SEGMENTS_PER_MODULE; segmentsInGPU = new SDL::segments(); segmentsBuffers = - new SDL::segmentsBuffer(nTotalSegments, nLowerModules_, ::SDL::N_MAX_PIXEL_SEGMENTS_PER_MODULE, devAcc, queue); + new SDL::segmentsBuffer(nTotalSegments, nLowerModules_, N_MAX_PIXEL_SEGMENTS_PER_MODULE, devAcc, queue); segmentsInGPU->setData(*segmentsBuffers); alpaka::memcpy(queue, segmentsBuffers->nMemoryLocations_buf, nTotalSegments_view); @@ -369,7 +369,7 @@ void ALPAKA_ACCELERATOR_NAMESPACE::SDL::Event::addPixelSegmentToEvent(std alpaka::wait(queue); Vec3D const threadsPerBlock = createVec(1, 1, 256); - Vec3D const blocksPerGrid = createVec(1, 1, ::SDL::MAX_BLOCKS); + Vec3D const blocksPerGrid = createVec(1, 1, MAX_BLOCKS); WorkDiv3D const addPixelSegmentToEvent_workdiv = createWorkDiv(blocksPerGrid, threadsPerBlock, elementsPerThread); addPixelSegmentToEventKernel addPixelSegmentToEvent_kernel; @@ -392,13 +392,13 @@ void ALPAKA_ACCELERATOR_NAMESPACE::SDL::Event::addPixelSegmentToEvent(std alpaka::wait(queue); } -void ALPAKA_ACCELERATOR_NAMESPACE::SDL::Event::createMiniDoublets() { +void SDL::Event::createMiniDoublets() { // Create a view for the element nLowerModules_ inside rangesBuffers->miniDoubletModuleOccupancy auto dst_view_miniDoubletModuleOccupancy = alpaka::createSubView(rangesBuffers->miniDoubletModuleOccupancy_buf, (Idx)1u, (Idx)nLowerModules_); // Create a source view for the value to be set - int value = ::SDL::N_MAX_PIXEL_MD_PER_MODULES; + int value = N_MAX_PIXEL_MD_PER_MODULES; auto src_view_value = alpaka::createView(devHost, &value, (Idx)1u); alpaka::memcpy(queue, dst_view_miniDoubletModuleOccupancy, src_view_value); @@ -423,7 +423,7 @@ void ALPAKA_ACCELERATOR_NAMESPACE::SDL::Event::createMiniDoublets() { unsigned int nTotalMDs = *alpaka::getPtrNative(nTotalMDs_buf); - nTotalMDs += ::SDL::N_MAX_PIXEL_MD_PER_MODULES; + nTotalMDs += N_MAX_PIXEL_MD_PER_MODULES; if (mdsInGPU == nullptr) { mdsInGPU = new SDL::miniDoublets(); @@ -468,11 +468,11 @@ void ALPAKA_ACCELERATOR_NAMESPACE::SDL::Event::createMiniDoublets() { } } -void ALPAKA_ACCELERATOR_NAMESPACE::SDL::Event::createSegmentsWithModuleMap() { +void SDL::Event::createSegmentsWithModuleMap() { if (segmentsInGPU == nullptr) { segmentsInGPU = new SDL::segments(); segmentsBuffers = - new SDL::segmentsBuffer(nTotalSegments, nLowerModules_, ::SDL::N_MAX_PIXEL_SEGMENTS_PER_MODULE, devAcc, queue); + new SDL::segmentsBuffer(nTotalSegments, nLowerModules_, N_MAX_PIXEL_SEGMENTS_PER_MODULE, devAcc, queue); segmentsInGPU->setData(*segmentsBuffers); } @@ -511,7 +511,7 @@ void ALPAKA_ACCELERATOR_NAMESPACE::SDL::Event::createSegmentsWithModuleMa } } -void ALPAKA_ACCELERATOR_NAMESPACE::SDL::Event::createTriplets() { +void SDL::Event::createTriplets() { if (tripletsInGPU == nullptr) { Vec3D const threadsPerBlockCreateTrip = createVec(1, 1, 1024); Vec3D const blocksPerGridCreateTrip = createVec(1, 1, 1); @@ -582,7 +582,7 @@ void ALPAKA_ACCELERATOR_NAMESPACE::SDL::Event::createTriplets() { alpaka::wait(queue); Vec3D const threadsPerBlockCreateTrip = createVec(1, 16, 16); - Vec3D const blocksPerGridCreateTrip = createVec(::SDL::MAX_BLOCKS, 1, 1); + Vec3D const blocksPerGridCreateTrip = createVec(MAX_BLOCKS, 1, 1); WorkDiv3D const createTripletsInGPUv2_workDiv = createWorkDiv(blocksPerGridCreateTrip, threadsPerBlockCreateTrip, elementsPerThread); @@ -619,11 +619,11 @@ void ALPAKA_ACCELERATOR_NAMESPACE::SDL::Event::createTriplets() { } } -void ALPAKA_ACCELERATOR_NAMESPACE::SDL::Event::createTrackCandidates(bool no_pls_dupclean, bool tc_pls_triplets) { +void SDL::Event::createTrackCandidates(bool no_pls_dupclean, bool tc_pls_triplets) { if (trackCandidatesInGPU == nullptr) { trackCandidatesInGPU = new SDL::trackCandidates(); trackCandidatesBuffers = new SDL::trackCandidatesBuffer( - ::SDL::N_MAX_NONPIXEL_TRACK_CANDIDATES + ::SDL::N_MAX_PIXEL_TRACK_CANDIDATES, devAcc, queue); + N_MAX_NONPIXEL_TRACK_CANDIDATES + N_MAX_PIXEL_TRACK_CANDIDATES, devAcc, queue); trackCandidatesInGPU->setData(*trackCandidatesBuffers); } @@ -681,7 +681,7 @@ void ALPAKA_ACCELERATOR_NAMESPACE::SDL::Event::createTrackCandidates(bool alpaka::enqueue(queue, removeDupQuintupletsInGPUBeforeTCTask); Vec3D const threadsPerBlock_crossCleanT5 = createVec(32, 1, 32); - Vec3D const blocksPerGrid_crossCleanT5 = createVec((13296 / 32) + 1, 1, ::SDL::MAX_BLOCKS); + Vec3D const blocksPerGrid_crossCleanT5 = createVec((13296 / 32) + 1, 1, MAX_BLOCKS); WorkDiv3D const crossCleanT5_workDiv = createWorkDiv(blocksPerGrid_crossCleanT5, threadsPerBlock_crossCleanT5, elementsPerThread); @@ -713,7 +713,7 @@ void ALPAKA_ACCELERATOR_NAMESPACE::SDL::Event::createTrackCandidates(bool if (!no_pls_dupclean) { Vec3D const threadsPerBlockCheckHitspLS = createVec(1, 16, 16); - Vec3D const blocksPerGridCheckHitspLS = createVec(1, ::SDL::MAX_BLOCKS * 4, ::SDL::MAX_BLOCKS / 4); + Vec3D const blocksPerGridCheckHitspLS = createVec(1, MAX_BLOCKS * 4, MAX_BLOCKS / 4); WorkDiv3D const checkHitspLS_workDiv = createWorkDiv(blocksPerGridCheckHitspLS, threadsPerBlockCheckHitspLS, elementsPerThread); @@ -744,7 +744,7 @@ void ALPAKA_ACCELERATOR_NAMESPACE::SDL::Event::createTrackCandidates(bool alpaka::enqueue(queue, crossCleanpLSTask); Vec3D const threadsPerBlock_addpLSasTrackCandidateInGPU = createVec(1, 1, 384); - Vec3D const blocksPerGrid_addpLSasTrackCandidateInGPU = createVec(1, 1, ::SDL::MAX_BLOCKS); + Vec3D const blocksPerGrid_addpLSasTrackCandidateInGPU = createVec(1, 1, MAX_BLOCKS); WorkDiv3D const addpLSasTrackCandidateInGPU_workDiv = createWorkDiv( blocksPerGrid_addpLSasTrackCandidateInGPU, threadsPerBlock_addpLSasTrackCandidateInGPU, elementsPerThread); @@ -758,7 +758,7 @@ void ALPAKA_ACCELERATOR_NAMESPACE::SDL::Event::createTrackCandidates(bool alpaka::enqueue(queue, addpLSasTrackCandidateInGPUTask); - // Check if either ::SDL::N_MAX_PIXEL_TRACK_CANDIDATES or ::SDL::N_MAX_NONPIXEL_TRACK_CANDIDATES was reached + // Check if either N_MAX_PIXEL_TRACK_CANDIDATES or N_MAX_NONPIXEL_TRACK_CANDIDATES was reached auto nTrackCanpT5Host_buf = allocBufWrapper(devHost, 1, queue); auto nTrackCanpT3Host_buf = allocBufWrapper(devHost, 1, queue); auto nTrackCanpLSHost_buf = allocBufWrapper(devHost, 1, queue); @@ -773,8 +773,8 @@ void ALPAKA_ACCELERATOR_NAMESPACE::SDL::Event::createTrackCandidates(bool int nTrackCandidatespT3 = *alpaka::getPtrNative(nTrackCanpT3Host_buf); int nTrackCandidatespLS = *alpaka::getPtrNative(nTrackCanpLSHost_buf); int nTrackCandidatesT5 = *alpaka::getPtrNative(nTrackCanT5Host_buf); - if ((nTrackCandidatespT5 + nTrackCandidatespT3 + nTrackCandidatespLS == ::SDL::N_MAX_PIXEL_TRACK_CANDIDATES) || - (nTrackCandidatesT5 == ::SDL::N_MAX_NONPIXEL_TRACK_CANDIDATES)) { + if ((nTrackCandidatespT5 + nTrackCandidatespT3 + nTrackCandidatespLS == N_MAX_PIXEL_TRACK_CANDIDATES) || + (nTrackCandidatesT5 == N_MAX_NONPIXEL_TRACK_CANDIDATES)) { printf( "****************************************************************************************************\n" "* Warning: Track candidates were possibly truncated. *\n" @@ -784,10 +784,10 @@ void ALPAKA_ACCELERATOR_NAMESPACE::SDL::Event::createTrackCandidates(bool } } -void ALPAKA_ACCELERATOR_NAMESPACE::SDL::Event::createPixelTriplets() { +void SDL::Event::createPixelTriplets() { if (pixelTripletsInGPU == nullptr) { pixelTripletsInGPU = new SDL::pixelTriplets(); - pixelTripletsBuffers = new SDL::pixelTripletsBuffer(::SDL::N_MAX_PIXEL_TRIPLETS, devAcc, queue); + pixelTripletsBuffers = new SDL::pixelTripletsBuffer(N_MAX_PIXEL_TRIPLETS, devAcc, queue); pixelTripletsInGPU->setData(*pixelTripletsBuffers); } @@ -799,8 +799,8 @@ void ALPAKA_ACCELERATOR_NAMESPACE::SDL::Event::createPixelTriplets() { alpaka::memcpy(queue, nInnerSegments_src_view, dev_view_nSegments); alpaka::wait(queue); - auto superbins_buf = allocBufWrapper(devHost, ::SDL::N_MAX_PIXEL_SEGMENTS_PER_MODULE, queue); - auto pixelTypes_buf = allocBufWrapper(devHost, ::SDL::N_MAX_PIXEL_SEGMENTS_PER_MODULE, queue); + auto superbins_buf = allocBufWrapper(devHost, N_MAX_PIXEL_SEGMENTS_PER_MODULE, queue); + auto pixelTypes_buf = allocBufWrapper(devHost, N_MAX_PIXEL_SEGMENTS_PER_MODULE, queue); alpaka::memcpy(queue, superbins_buf, segmentsBuffers->superbin_buf); alpaka::memcpy(queue, pixelTypes_buf, segmentsBuffers->pixelType_buf); @@ -818,16 +818,16 @@ void ALPAKA_ACCELERATOR_NAMESPACE::SDL::Event::createPixelTriplets() { alpaka::wait(queue); int pixelIndexOffsetPos = - pixelMapping_->connectedPixelsIndex[::SDL::size_superbins - 1] + pixelMapping_->connectedPixelsSizes[::SDL::size_superbins - 1]; - int pixelIndexOffsetNeg = pixelMapping_->connectedPixelsIndexPos[::SDL::size_superbins - 1] + - pixelMapping_->connectedPixelsSizesPos[::SDL::size_superbins - 1] + pixelIndexOffsetPos; + pixelMapping_->connectedPixelsIndex[size_superbins - 1] + pixelMapping_->connectedPixelsSizes[size_superbins - 1]; + int pixelIndexOffsetNeg = pixelMapping_->connectedPixelsIndexPos[size_superbins - 1] + + pixelMapping_->connectedPixelsSizesPos[size_superbins - 1] + pixelIndexOffsetPos; // TODO: check if a map/reduction to just eligible pLSs would speed up the kernel // the current selection still leaves a significant fraction of unmatchable pLSs for (unsigned int i = 0; i < nInnerSegments; i++) { // loop over # pLS int8_t pixelType = pixelTypes[i]; // Get pixel type for this pLS int superbin = superbins[i]; // Get superbin for this pixel - if ((superbin < 0) or (superbin >= (int)::SDL::size_superbins) or (pixelType > 2) or (pixelType < 0)) { + if ((superbin < 0) or (superbin >= (int)size_superbins) or (pixelType > 2) or (pixelType < 0)) { connectedPixelSize_host[i] = 0; connectedPixelIndex_host[i] = 0; continue; @@ -903,7 +903,7 @@ void ALPAKA_ACCELERATOR_NAMESPACE::SDL::Event::createPixelTriplets() { alpaka::wait(queue); } -void ALPAKA_ACCELERATOR_NAMESPACE::SDL::Event::createQuintuplets() { +void SDL::Event::createQuintuplets() { Vec3D const threadsPerBlockCreateQuints = createVec(1, 1, 1024); Vec3D const blocksPerGridCreateQuints = createVec(1, 1, 1); WorkDiv3D const createEligibleModulesListForQuintupletsGPU_workDiv = @@ -958,7 +958,7 @@ void ALPAKA_ACCELERATOR_NAMESPACE::SDL::Event::createQuintuplets() { alpaka::enqueue(queue, createQuintupletsInGPUv2Task); Vec3D const threadsPerBlockDupQuint = createVec(1, 16, 16); - Vec3D const blocksPerGridDupQuint = createVec(::SDL::MAX_BLOCKS, 1, 1); + Vec3D const blocksPerGridDupQuint = createVec(MAX_BLOCKS, 1, 1); WorkDiv3D const removeDupQuintupletsInGPUAfterBuild_workDiv = createWorkDiv(blocksPerGridDupQuint, threadsPerBlockDupQuint, elementsPerThread); @@ -993,10 +993,10 @@ void ALPAKA_ACCELERATOR_NAMESPACE::SDL::Event::createQuintuplets() { } } -void ALPAKA_ACCELERATOR_NAMESPACE::SDL::Event::pixelLineSegmentCleaning(bool no_pls_dupclean) { +void SDL::Event::pixelLineSegmentCleaning(bool no_pls_dupclean) { if (!no_pls_dupclean) { Vec3D const threadsPerBlockCheckHitspLS = createVec(1, 16, 16); - Vec3D const blocksPerGridCheckHitspLS = createVec(1, ::SDL::MAX_BLOCKS * 4, ::SDL::MAX_BLOCKS / 4); + Vec3D const blocksPerGridCheckHitspLS = createVec(1, MAX_BLOCKS * 4, MAX_BLOCKS / 4); WorkDiv3D const checkHitspLS_workDiv = createWorkDiv(blocksPerGridCheckHitspLS, threadsPerBlockCheckHitspLS, elementsPerThread); @@ -1009,16 +1009,16 @@ void ALPAKA_ACCELERATOR_NAMESPACE::SDL::Event::pixelLineSegmentCleaning(b } } -void ALPAKA_ACCELERATOR_NAMESPACE::SDL::Event::createPixelQuintuplets() { +void SDL::Event::createPixelQuintuplets() { if (pixelQuintupletsInGPU == nullptr) { pixelQuintupletsInGPU = new SDL::pixelQuintuplets(); - pixelQuintupletsBuffers = new SDL::pixelQuintupletsBuffer(::SDL::N_MAX_PIXEL_QUINTUPLETS, devAcc, queue); + pixelQuintupletsBuffers = new SDL::pixelQuintupletsBuffer(N_MAX_PIXEL_QUINTUPLETS, devAcc, queue); pixelQuintupletsInGPU->setData(*pixelQuintupletsBuffers); } if (trackCandidatesInGPU == nullptr) { trackCandidatesInGPU = new SDL::trackCandidates(); trackCandidatesBuffers = new SDL::trackCandidatesBuffer( - ::SDL::N_MAX_NONPIXEL_TRACK_CANDIDATES + ::SDL::N_MAX_PIXEL_TRACK_CANDIDATES, devAcc, queue); + N_MAX_NONPIXEL_TRACK_CANDIDATES + N_MAX_PIXEL_TRACK_CANDIDATES, devAcc, queue); trackCandidatesInGPU->setData(*trackCandidatesBuffers); } @@ -1031,8 +1031,8 @@ void ALPAKA_ACCELERATOR_NAMESPACE::SDL::Event::createPixelQuintuplets() { alpaka::memcpy(queue, nInnerSegments_src_view, dev_view_nSegments); alpaka::wait(queue); - auto superbins_buf = allocBufWrapper(devHost, ::SDL::N_MAX_PIXEL_SEGMENTS_PER_MODULE, queue); - auto pixelTypes_buf = allocBufWrapper(devHost, ::SDL::N_MAX_PIXEL_SEGMENTS_PER_MODULE, queue); + auto superbins_buf = allocBufWrapper(devHost, N_MAX_PIXEL_SEGMENTS_PER_MODULE, queue); + auto pixelTypes_buf = allocBufWrapper(devHost, N_MAX_PIXEL_SEGMENTS_PER_MODULE, queue); alpaka::memcpy(queue, superbins_buf, segmentsBuffers->superbin_buf); alpaka::memcpy(queue, pixelTypes_buf, segmentsBuffers->pixelType_buf); @@ -1050,15 +1050,15 @@ void ALPAKA_ACCELERATOR_NAMESPACE::SDL::Event::createPixelQuintuplets() { alpaka::wait(queue); int pixelIndexOffsetPos = - pixelMapping_->connectedPixelsIndex[::SDL::size_superbins - 1] + pixelMapping_->connectedPixelsSizes[::SDL::size_superbins - 1]; - int pixelIndexOffsetNeg = pixelMapping_->connectedPixelsIndexPos[::SDL::size_superbins - 1] + - pixelMapping_->connectedPixelsSizesPos[::SDL::size_superbins - 1] + pixelIndexOffsetPos; + pixelMapping_->connectedPixelsIndex[size_superbins - 1] + pixelMapping_->connectedPixelsSizes[size_superbins - 1]; + int pixelIndexOffsetNeg = pixelMapping_->connectedPixelsIndexPos[size_superbins - 1] + + pixelMapping_->connectedPixelsSizesPos[size_superbins - 1] + pixelIndexOffsetPos; // Loop over # pLS for (unsigned int i = 0; i < nInnerSegments; i++) { int8_t pixelType = pixelTypes[i]; // Get pixel type for this pLS int superbin = superbins[i]; // Get superbin for this pixel - if ((superbin < 0) or (superbin >= (int)::SDL::size_superbins) or (pixelType > 2) or (pixelType < 0)) { + if ((superbin < 0) or (superbin >= (int)size_superbins) or (pixelType > 2) or (pixelType < 0)) { connectedPixelIndex_host[i] = 0; connectedPixelSize_host[i] = 0; continue; @@ -1087,7 +1087,7 @@ void ALPAKA_ACCELERATOR_NAMESPACE::SDL::Event::createPixelQuintuplets() { alpaka::wait(queue); Vec3D const threadsPerBlockCreatePixQuints = createVec(1, 16, 16); - Vec3D const blocksPerGridCreatePixQuints = createVec(16, ::SDL::MAX_BLOCKS, 1); + Vec3D const blocksPerGridCreatePixQuints = createVec(16, MAX_BLOCKS, 1); WorkDiv3D const createPixelQuintupletsInGPUFromMapv2_workDiv = createWorkDiv(blocksPerGridCreatePixQuints, threadsPerBlockCreatePixQuints, elementsPerThread); @@ -1109,7 +1109,7 @@ void ALPAKA_ACCELERATOR_NAMESPACE::SDL::Event::createPixelQuintuplets() { alpaka::enqueue(queue, createPixelQuintupletsInGPUFromMapv2Task); Vec3D const threadsPerBlockDupPix = createVec(1, 16, 16); - Vec3D const blocksPerGridDupPix = createVec(1, ::SDL::MAX_BLOCKS, 1); + Vec3D const blocksPerGridDupPix = createVec(1, MAX_BLOCKS, 1); WorkDiv3D const removeDupPixelQuintupletsInGPUFromMap_workDiv = createWorkDiv(blocksPerGridDupPix, threadsPerBlockDupPix, elementsPerThread); @@ -1148,7 +1148,7 @@ void ALPAKA_ACCELERATOR_NAMESPACE::SDL::Event::createPixelQuintuplets() { #endif } -void ALPAKA_ACCELERATOR_NAMESPACE::SDL::Event::addMiniDoubletsToEventExplicit() { +void SDL::Event::addMiniDoubletsToEventExplicit() { auto nMDsCPU_buf = allocBufWrapper(devHost, nLowerModules_, queue); alpaka::memcpy(queue, nMDsCPU_buf, miniDoubletsBuffers->nMDs_buf, nLowerModules_); @@ -1179,7 +1179,7 @@ void ALPAKA_ACCELERATOR_NAMESPACE::SDL::Event::addMiniDoubletsToEventExpl } } -void ALPAKA_ACCELERATOR_NAMESPACE::SDL::Event::addSegmentsToEventExplicit() { +void SDL::Event::addSegmentsToEventExplicit() { auto nSegmentsCPU_buf = allocBufWrapper(devHost, nLowerModules_, queue); alpaka::memcpy(queue, nSegmentsCPU_buf, segmentsBuffers->nSegments_buf, nLowerModules_); @@ -1206,7 +1206,7 @@ void ALPAKA_ACCELERATOR_NAMESPACE::SDL::Event::addSegmentsToEventExplicit } } -void ALPAKA_ACCELERATOR_NAMESPACE::SDL::Event::addQuintupletsToEventExplicit() { +void SDL::Event::addQuintupletsToEventExplicit() { auto nQuintupletsCPU_buf = allocBufWrapper(devHost, nLowerModules_, queue); alpaka::memcpy(queue, nQuintupletsCPU_buf, quintupletsBuffers->nQuintuplets_buf); @@ -1237,7 +1237,7 @@ void ALPAKA_ACCELERATOR_NAMESPACE::SDL::Event::addQuintupletsToEventExpli } } -void ALPAKA_ACCELERATOR_NAMESPACE::SDL::Event::addTripletsToEventExplicit() { +void SDL::Event::addTripletsToEventExplicit() { auto nTripletsCPU_buf = allocBufWrapper(devHost, nLowerModules_, queue); alpaka::memcpy(queue, nTripletsCPU_buf, tripletsBuffers->nTriplets_buf); @@ -1263,7 +1263,7 @@ void ALPAKA_ACCELERATOR_NAMESPACE::SDL::Event::addTripletsToEventExplicit } } -unsigned int ALPAKA_ACCELERATOR_NAMESPACE::SDL::Event::getNumberOfHits() { +unsigned int SDL::Event::getNumberOfHits() { unsigned int hits = 0; for (auto& it : n_hits_by_layer_barrel_) { hits += it; @@ -1275,22 +1275,22 @@ unsigned int ALPAKA_ACCELERATOR_NAMESPACE::SDL::Event::getNumberOfHits() return hits; } -unsigned int ALPAKA_ACCELERATOR_NAMESPACE::SDL::Event::getNumberOfHitsByLayer(unsigned int layer) { +unsigned int SDL::Event::getNumberOfHitsByLayer(unsigned int layer) { if (layer == 6) return n_hits_by_layer_barrel_[layer]; else return n_hits_by_layer_barrel_[layer] + n_hits_by_layer_endcap_[layer]; } -unsigned int ALPAKA_ACCELERATOR_NAMESPACE::SDL::Event::getNumberOfHitsByLayerBarrel(unsigned int layer) { +unsigned int SDL::Event::getNumberOfHitsByLayerBarrel(unsigned int layer) { return n_hits_by_layer_barrel_[layer]; } -unsigned int ALPAKA_ACCELERATOR_NAMESPACE::SDL::Event::getNumberOfHitsByLayerEndcap(unsigned int layer) { +unsigned int SDL::Event::getNumberOfHitsByLayerEndcap(unsigned int layer) { return n_hits_by_layer_endcap_[layer]; } -unsigned int ALPAKA_ACCELERATOR_NAMESPACE::SDL::Event::getNumberOfMiniDoublets() { +unsigned int SDL::Event::getNumberOfMiniDoublets() { unsigned int miniDoublets = 0; for (auto& it : n_minidoublets_by_layer_barrel_) { miniDoublets += it; @@ -1302,22 +1302,22 @@ unsigned int ALPAKA_ACCELERATOR_NAMESPACE::SDL::Event::getNumberOfMiniDou return miniDoublets; } -unsigned int ALPAKA_ACCELERATOR_NAMESPACE::SDL::Event::getNumberOfMiniDoubletsByLayer(unsigned int layer) { +unsigned int SDL::Event::getNumberOfMiniDoubletsByLayer(unsigned int layer) { if (layer == 6) return n_minidoublets_by_layer_barrel_[layer]; else return n_minidoublets_by_layer_barrel_[layer] + n_minidoublets_by_layer_endcap_[layer]; } -unsigned int ALPAKA_ACCELERATOR_NAMESPACE::SDL::Event::getNumberOfMiniDoubletsByLayerBarrel(unsigned int layer) { +unsigned int SDL::Event::getNumberOfMiniDoubletsByLayerBarrel(unsigned int layer) { return n_minidoublets_by_layer_barrel_[layer]; } -unsigned int ALPAKA_ACCELERATOR_NAMESPACE::SDL::Event::getNumberOfMiniDoubletsByLayerEndcap(unsigned int layer) { +unsigned int SDL::Event::getNumberOfMiniDoubletsByLayerEndcap(unsigned int layer) { return n_minidoublets_by_layer_endcap_[layer]; } -unsigned int ALPAKA_ACCELERATOR_NAMESPACE::SDL::Event::getNumberOfSegments() { +unsigned int SDL::Event::getNumberOfSegments() { unsigned int segments = 0; for (auto& it : n_segments_by_layer_barrel_) { segments += it; @@ -1329,22 +1329,22 @@ unsigned int ALPAKA_ACCELERATOR_NAMESPACE::SDL::Event::getNumberOfSegment return segments; } -unsigned int ALPAKA_ACCELERATOR_NAMESPACE::SDL::Event::getNumberOfSegmentsByLayer(unsigned int layer) { +unsigned int SDL::Event::getNumberOfSegmentsByLayer(unsigned int layer) { if (layer == 6) return n_segments_by_layer_barrel_[layer]; else return n_segments_by_layer_barrel_[layer] + n_segments_by_layer_endcap_[layer]; } -unsigned int ALPAKA_ACCELERATOR_NAMESPACE::SDL::Event::getNumberOfSegmentsByLayerBarrel(unsigned int layer) { +unsigned int SDL::Event::getNumberOfSegmentsByLayerBarrel(unsigned int layer) { return n_segments_by_layer_barrel_[layer]; } -unsigned int ALPAKA_ACCELERATOR_NAMESPACE::SDL::Event::getNumberOfSegmentsByLayerEndcap(unsigned int layer) { +unsigned int SDL::Event::getNumberOfSegmentsByLayerEndcap(unsigned int layer) { return n_segments_by_layer_endcap_[layer]; } -unsigned int ALPAKA_ACCELERATOR_NAMESPACE::SDL::Event::getNumberOfTriplets() { +unsigned int SDL::Event::getNumberOfTriplets() { unsigned int triplets = 0; for (auto& it : n_triplets_by_layer_barrel_) { triplets += it; @@ -1356,22 +1356,22 @@ unsigned int ALPAKA_ACCELERATOR_NAMESPACE::SDL::Event::getNumberOfTriplet return triplets; } -unsigned int ALPAKA_ACCELERATOR_NAMESPACE::SDL::Event::getNumberOfTripletsByLayer(unsigned int layer) { +unsigned int SDL::Event::getNumberOfTripletsByLayer(unsigned int layer) { if (layer == 6) return n_triplets_by_layer_barrel_[layer]; else return n_triplets_by_layer_barrel_[layer] + n_triplets_by_layer_endcap_[layer]; } -unsigned int ALPAKA_ACCELERATOR_NAMESPACE::SDL::Event::getNumberOfTripletsByLayerBarrel(unsigned int layer) { +unsigned int SDL::Event::getNumberOfTripletsByLayerBarrel(unsigned int layer) { return n_triplets_by_layer_barrel_[layer]; } -unsigned int ALPAKA_ACCELERATOR_NAMESPACE::SDL::Event::getNumberOfTripletsByLayerEndcap(unsigned int layer) { +unsigned int SDL::Event::getNumberOfTripletsByLayerEndcap(unsigned int layer) { return n_triplets_by_layer_endcap_[layer]; } -int ALPAKA_ACCELERATOR_NAMESPACE::SDL::Event::getNumberOfPixelTriplets() { +int SDL::Event::getNumberOfPixelTriplets() { auto nPixelTriplets_buf = allocBufWrapper(devHost, 1, queue); alpaka::memcpy(queue, nPixelTriplets_buf, pixelTripletsBuffers->nPixelTriplets_buf); @@ -1382,7 +1382,7 @@ int ALPAKA_ACCELERATOR_NAMESPACE::SDL::Event::getNumberOfPixelTriplets() return nPixelTriplets; } -int ALPAKA_ACCELERATOR_NAMESPACE::SDL::Event::getNumberOfPixelQuintuplets() { +int SDL::Event::getNumberOfPixelQuintuplets() { auto nPixelQuintuplets_buf = allocBufWrapper(devHost, 1, queue); alpaka::memcpy(queue, nPixelQuintuplets_buf, pixelQuintupletsBuffers->nPixelQuintuplets_buf); @@ -1393,7 +1393,7 @@ int ALPAKA_ACCELERATOR_NAMESPACE::SDL::Event::getNumberOfPixelQuintuplets return nPixelQuintuplets; } -unsigned int ALPAKA_ACCELERATOR_NAMESPACE::SDL::Event::getNumberOfQuintuplets() { +unsigned int SDL::Event::getNumberOfQuintuplets() { unsigned int quintuplets = 0; for (auto& it : n_quintuplets_by_layer_barrel_) { quintuplets += it; @@ -1405,22 +1405,22 @@ unsigned int ALPAKA_ACCELERATOR_NAMESPACE::SDL::Event::getNumberOfQuintup return quintuplets; } -unsigned int ALPAKA_ACCELERATOR_NAMESPACE::SDL::Event::getNumberOfQuintupletsByLayer(unsigned int layer) { +unsigned int SDL::Event::getNumberOfQuintupletsByLayer(unsigned int layer) { if (layer == 6) return n_quintuplets_by_layer_barrel_[layer]; else return n_quintuplets_by_layer_barrel_[layer] + n_quintuplets_by_layer_endcap_[layer]; } -unsigned int ALPAKA_ACCELERATOR_NAMESPACE::SDL::Event::getNumberOfQuintupletsByLayerBarrel(unsigned int layer) { +unsigned int SDL::Event::getNumberOfQuintupletsByLayerBarrel(unsigned int layer) { return n_quintuplets_by_layer_barrel_[layer]; } -unsigned int ALPAKA_ACCELERATOR_NAMESPACE::SDL::Event::getNumberOfQuintupletsByLayerEndcap(unsigned int layer) { +unsigned int SDL::Event::getNumberOfQuintupletsByLayerEndcap(unsigned int layer) { return n_quintuplets_by_layer_endcap_[layer]; } -int ALPAKA_ACCELERATOR_NAMESPACE::SDL::Event::getNumberOfTrackCandidates() { +int SDL::Event::getNumberOfTrackCandidates() { auto nTrackCandidates_buf = allocBufWrapper(devHost, 1, queue); alpaka::memcpy(queue, nTrackCandidates_buf, trackCandidatesBuffers->nTrackCandidates_buf); @@ -1431,7 +1431,7 @@ int ALPAKA_ACCELERATOR_NAMESPACE::SDL::Event::getNumberOfTrackCandidates( return nTrackCandidates; } -int ALPAKA_ACCELERATOR_NAMESPACE::SDL::Event::getNumberOfPT5TrackCandidates() { +int SDL::Event::getNumberOfPT5TrackCandidates() { auto nTrackCandidatesPT5_buf = allocBufWrapper(devHost, 1, queue); alpaka::memcpy(queue, nTrackCandidatesPT5_buf, trackCandidatesBuffers->nTrackCandidatespT5_buf); @@ -1442,7 +1442,7 @@ int ALPAKA_ACCELERATOR_NAMESPACE::SDL::Event::getNumberOfPT5TrackCandidat return nTrackCandidatesPT5; } -int ALPAKA_ACCELERATOR_NAMESPACE::SDL::Event::getNumberOfPT3TrackCandidates() { +int SDL::Event::getNumberOfPT3TrackCandidates() { auto nTrackCandidatesPT3_buf = allocBufWrapper(devHost, 1, queue); alpaka::memcpy(queue, nTrackCandidatesPT3_buf, trackCandidatesBuffers->nTrackCandidatespT3_buf); @@ -1453,7 +1453,7 @@ int ALPAKA_ACCELERATOR_NAMESPACE::SDL::Event::getNumberOfPT3TrackCandidat return nTrackCandidatesPT3; } -int ALPAKA_ACCELERATOR_NAMESPACE::SDL::Event::getNumberOfPLSTrackCandidates() { +int SDL::Event::getNumberOfPLSTrackCandidates() { auto nTrackCandidatesPLS_buf = allocBufWrapper(devHost, 1, queue); alpaka::memcpy(queue, nTrackCandidatesPLS_buf, trackCandidatesBuffers->nTrackCandidatespLS_buf); @@ -1464,7 +1464,7 @@ int ALPAKA_ACCELERATOR_NAMESPACE::SDL::Event::getNumberOfPLSTrackCandidat return nTrackCandidatesPLS; } -int ALPAKA_ACCELERATOR_NAMESPACE::SDL::Event::getNumberOfPixelTrackCandidates() { +int SDL::Event::getNumberOfPixelTrackCandidates() { auto nTrackCandidates_buf = allocBufWrapper(devHost, 1, queue); auto nTrackCandidatesT5_buf = allocBufWrapper(devHost, 1, queue); @@ -1478,7 +1478,7 @@ int ALPAKA_ACCELERATOR_NAMESPACE::SDL::Event::getNumberOfPixelTrackCandid return nTrackCandidates - nTrackCandidatesT5; } -int ALPAKA_ACCELERATOR_NAMESPACE::SDL::Event::getNumberOfT5TrackCandidates() { +int SDL::Event::getNumberOfT5TrackCandidates() { auto nTrackCandidatesT5_buf = allocBufWrapper(devHost, 1, queue); alpaka::memcpy(queue, nTrackCandidatesT5_buf, trackCandidatesBuffers->nTrackCandidatesT5_buf); @@ -1489,7 +1489,7 @@ int ALPAKA_ACCELERATOR_NAMESPACE::SDL::Event::getNumberOfT5TrackCandidate return nTrackCandidatesT5; } -ALPAKA_ACCELERATOR_NAMESPACE::SDL::hitsBuffer* ALPAKA_ACCELERATOR_NAMESPACE::SDL::Event::getHits() //std::shared_ptr should take care of garbage collection +SDL::hitsBuffer* SDL::Event::getHits() //std::shared_ptr should take care of garbage collection { if (hitsInCPU == nullptr) { auto nHits_buf = allocBufWrapper(devHost, 1, queue); @@ -1512,7 +1512,7 @@ ALPAKA_ACCELERATOR_NAMESPACE::SDL::hitsBuffer* ALPAKA_ACCELERATOR_NAMES return hitsInCPU; } -ALPAKA_ACCELERATOR_NAMESPACE::SDL::hitsBuffer* ALPAKA_ACCELERATOR_NAMESPACE::SDL::Event::getHitsInCMSSW() { +SDL::hitsBuffer* SDL::Event::getHitsInCMSSW() { if (hitsInCPU == nullptr) { auto nHits_buf = allocBufWrapper(devHost, 1, queue); alpaka::memcpy(queue, nHits_buf, hitsBuffers->nHits_buf); @@ -1529,7 +1529,7 @@ ALPAKA_ACCELERATOR_NAMESPACE::SDL::hitsBuffer* ALPAKA_ACCELERATOR_NAMES return hitsInCPU; } -ALPAKA_ACCELERATOR_NAMESPACE::SDL::objectRangesBuffer* ALPAKA_ACCELERATOR_NAMESPACE::SDL::Event::getRanges() { +SDL::objectRangesBuffer* SDL::Event::getRanges() { if (rangesInCPU == nullptr) { rangesInCPU = new SDL::objectRangesBuffer(nModules_, nLowerModules_, devHost, queue); rangesInCPU->setData(*rangesInCPU); @@ -1544,7 +1544,7 @@ ALPAKA_ACCELERATOR_NAMESPACE::SDL::objectRangesBuffer* ALPAKA_ACCELERAT return rangesInCPU; } -ALPAKA_ACCELERATOR_NAMESPACE::SDL::miniDoubletsBuffer* ALPAKA_ACCELERATOR_NAMESPACE::SDL::Event::getMiniDoublets() { +SDL::miniDoubletsBuffer* SDL::Event::getMiniDoublets() { if (mdsInCPU == nullptr) { // Get nMemoryLocations parameter to initialize host based mdsInCPU auto nMemHost_buf = allocBufWrapper(devHost, 1, queue); @@ -1566,7 +1566,7 @@ ALPAKA_ACCELERATOR_NAMESPACE::SDL::miniDoubletsBuffer* ALPAKA_ACCELERAT return mdsInCPU; } -ALPAKA_ACCELERATOR_NAMESPACE::SDL::segmentsBuffer* ALPAKA_ACCELERATOR_NAMESPACE::SDL::Event::getSegments() { +SDL::segmentsBuffer* SDL::Event::getSegments() { if (segmentsInCPU == nullptr) { // Get nMemoryLocations parameter to initialize host based segmentsInCPU auto nMemHost_buf = allocBufWrapper(devHost, 1, queue); @@ -1575,7 +1575,7 @@ ALPAKA_ACCELERATOR_NAMESPACE::SDL::segmentsBuffer* ALPAKA_ACCELERATOR_N unsigned int nMemHost = *alpaka::getPtrNative(nMemHost_buf); segmentsInCPU = new SDL::segmentsBuffer( - nMemHost, nLowerModules_, ::SDL::N_MAX_PIXEL_SEGMENTS_PER_MODULE, devHost, queue); + nMemHost, nLowerModules_, N_MAX_PIXEL_SEGMENTS_PER_MODULE, devHost, queue); segmentsInCPU->setData(*segmentsInCPU); *alpaka::getPtrNative(segmentsInCPU->nMemoryLocations_buf) = nMemHost; @@ -1602,7 +1602,7 @@ ALPAKA_ACCELERATOR_NAMESPACE::SDL::segmentsBuffer* ALPAKA_ACCELERATOR_N return segmentsInCPU; } -ALPAKA_ACCELERATOR_NAMESPACE::SDL::tripletsBuffer* ALPAKA_ACCELERATOR_NAMESPACE::SDL::Event::getTriplets() { +SDL::tripletsBuffer* SDL::Event::getTriplets() { if (tripletsInCPU == nullptr) { // Get nMemoryLocations parameter to initialize host based tripletsInCPU auto nMemHost_buf = allocBufWrapper(devHost, 1, queue); @@ -1625,9 +1625,9 @@ ALPAKA_ACCELERATOR_NAMESPACE::SDL::tripletsBuffer* ALPAKA_ACCELERATOR_N alpaka::memcpy(queue, tripletsInCPU->rtLo_buf, tripletsBuffers->rtLo_buf, nMemHost); alpaka::memcpy(queue, tripletsInCPU->rtHi_buf, tripletsBuffers->rtHi_buf, nMemHost); #endif - alpaka::memcpy(queue, tripletsInCPU->hitIndices_buf, tripletsBuffers->hitIndices_buf, ::SDL::Params_T3::kHits * nMemHost); + alpaka::memcpy(queue, tripletsInCPU->hitIndices_buf, tripletsBuffers->hitIndices_buf, Params_T3::kHits * nMemHost); alpaka::memcpy( - queue, tripletsInCPU->logicalLayers_buf, tripletsBuffers->logicalLayers_buf, ::SDL::Params_T3::kLayers * nMemHost); + queue, tripletsInCPU->logicalLayers_buf, tripletsBuffers->logicalLayers_buf, Params_T3::kLayers * nMemHost); alpaka::memcpy(queue, tripletsInCPU->segmentIndices_buf, tripletsBuffers->segmentIndices_buf, 2 * nMemHost); alpaka::memcpy(queue, tripletsInCPU->betaIn_buf, tripletsBuffers->betaIn_buf, nMemHost); alpaka::memcpy(queue, tripletsInCPU->circleRadius_buf, tripletsBuffers->circleRadius_buf, nMemHost); @@ -1638,7 +1638,7 @@ ALPAKA_ACCELERATOR_NAMESPACE::SDL::tripletsBuffer* ALPAKA_ACCELERATOR_N return tripletsInCPU; } -ALPAKA_ACCELERATOR_NAMESPACE::SDL::quintupletsBuffer* ALPAKA_ACCELERATOR_NAMESPACE::SDL::Event::getQuintuplets() { +SDL::quintupletsBuffer* SDL::Event::getQuintuplets() { if (quintupletsInCPU == nullptr) { // Get nMemoryLocations parameter to initialize host based quintupletsInCPU auto nMemHost_buf = allocBufWrapper(devHost, 1, queue); @@ -1657,7 +1657,7 @@ ALPAKA_ACCELERATOR_NAMESPACE::SDL::quintupletsBuffer* ALPAKA_ACCELERATO alpaka::memcpy(queue, quintupletsInCPU->lowerModuleIndices_buf, quintupletsBuffers->lowerModuleIndices_buf, - ::SDL::Params_T5::kLayers * nMemHost); + Params_T5::kLayers * nMemHost); alpaka::memcpy(queue, quintupletsInCPU->innerRadius_buf, quintupletsBuffers->innerRadius_buf, nMemHost); alpaka::memcpy(queue, quintupletsInCPU->bridgeRadius_buf, quintupletsBuffers->bridgeRadius_buf, nMemHost); alpaka::memcpy(queue, quintupletsInCPU->outerRadius_buf, quintupletsBuffers->outerRadius_buf, nMemHost); @@ -1674,7 +1674,7 @@ ALPAKA_ACCELERATOR_NAMESPACE::SDL::quintupletsBuffer* ALPAKA_ACCELERATO return quintupletsInCPU; } -ALPAKA_ACCELERATOR_NAMESPACE::SDL::pixelTripletsBuffer* ALPAKA_ACCELERATOR_NAMESPACE::SDL::Event::getPixelTriplets() { +SDL::pixelTripletsBuffer* SDL::Event::getPixelTriplets() { if (pixelTripletsInCPU == nullptr) { // Get nPixelTriplets parameter to initialize host based quintupletsInCPU auto nPixelTriplets_buf = allocBufWrapper(devHost, 1, queue); @@ -1713,7 +1713,7 @@ ALPAKA_ACCELERATOR_NAMESPACE::SDL::pixelTripletsBuffer* ALPAKA_ACCELERA return pixelTripletsInCPU; } -ALPAKA_ACCELERATOR_NAMESPACE::SDL::pixelQuintupletsBuffer* ALPAKA_ACCELERATOR_NAMESPACE::SDL::Event::getPixelQuintuplets() { +SDL::pixelQuintupletsBuffer* SDL::Event::getPixelQuintuplets() { if (pixelQuintupletsInCPU == nullptr) { // Get nPixelQuintuplets parameter to initialize host based quintupletsInCPU auto nPixelQuintuplets_buf = allocBufWrapper(devHost, 1, queue); @@ -1749,7 +1749,7 @@ ALPAKA_ACCELERATOR_NAMESPACE::SDL::pixelQuintupletsBuffer* ALPAKA_ACCEL return pixelQuintupletsInCPU; } -ALPAKA_ACCELERATOR_NAMESPACE::SDL::trackCandidatesBuffer* ALPAKA_ACCELERATOR_NAMESPACE::SDL::Event::getTrackCandidates() { +SDL::trackCandidatesBuffer* SDL::Event::getTrackCandidates() { if (trackCandidatesInCPU == nullptr) { // Get nTrackCanHost parameter to initialize host based trackCandidatesInCPU auto nTrackCanHost_buf = allocBufWrapper(devHost, 1, queue); @@ -1758,20 +1758,20 @@ ALPAKA_ACCELERATOR_NAMESPACE::SDL::trackCandidatesBuffer* ALPAKA_ACCELE unsigned int nTrackCanHost = *alpaka::getPtrNative(nTrackCanHost_buf); trackCandidatesInCPU = new SDL::trackCandidatesBuffer( - ::SDL::N_MAX_NONPIXEL_TRACK_CANDIDATES + ::SDL::N_MAX_PIXEL_TRACK_CANDIDATES, devHost, queue); + N_MAX_NONPIXEL_TRACK_CANDIDATES + N_MAX_PIXEL_TRACK_CANDIDATES, devHost, queue); trackCandidatesInCPU->setData(*trackCandidatesInCPU); *alpaka::getPtrNative(trackCandidatesInCPU->nTrackCandidates_buf) = nTrackCanHost; alpaka::memcpy(queue, trackCandidatesInCPU->hitIndices_buf, trackCandidatesBuffers->hitIndices_buf, - ::SDL::Params_pT5::kHits * nTrackCanHost); + Params_pT5::kHits * nTrackCanHost); alpaka::memcpy( queue, trackCandidatesInCPU->pixelSeedIndex_buf, trackCandidatesBuffers->pixelSeedIndex_buf, nTrackCanHost); alpaka::memcpy(queue, trackCandidatesInCPU->logicalLayers_buf, trackCandidatesBuffers->logicalLayers_buf, - ::SDL::Params_pT5::kLayers * nTrackCanHost); + Params_pT5::kLayers * nTrackCanHost); alpaka::memcpy(queue, trackCandidatesInCPU->directObjectIndices_buf, trackCandidatesBuffers->directObjectIndices_buf, @@ -1787,7 +1787,7 @@ ALPAKA_ACCELERATOR_NAMESPACE::SDL::trackCandidatesBuffer* ALPAKA_ACCELE return trackCandidatesInCPU; } -ALPAKA_ACCELERATOR_NAMESPACE::SDL::trackCandidatesBuffer* ALPAKA_ACCELERATOR_NAMESPACE::SDL::Event::getTrackCandidatesInCMSSW() { +SDL::trackCandidatesBuffer* SDL::Event::getTrackCandidatesInCMSSW() { if (trackCandidatesInCPU == nullptr) { // Get nTrackCanHost parameter to initialize host based trackCandidatesInCPU auto nTrackCanHost_buf = allocBufWrapper(devHost, 1, queue); @@ -1796,14 +1796,14 @@ ALPAKA_ACCELERATOR_NAMESPACE::SDL::trackCandidatesBuffer* ALPAKA_ACCELE unsigned int nTrackCanHost = *alpaka::getPtrNative(nTrackCanHost_buf); trackCandidatesInCPU = new SDL::trackCandidatesBuffer( - ::SDL::N_MAX_NONPIXEL_TRACK_CANDIDATES + ::SDL::N_MAX_PIXEL_TRACK_CANDIDATES, devHost, queue); + N_MAX_NONPIXEL_TRACK_CANDIDATES + N_MAX_PIXEL_TRACK_CANDIDATES, devHost, queue); trackCandidatesInCPU->setData(*trackCandidatesInCPU); *alpaka::getPtrNative(trackCandidatesInCPU->nTrackCandidates_buf) = nTrackCanHost; alpaka::memcpy(queue, trackCandidatesInCPU->hitIndices_buf, trackCandidatesBuffers->hitIndices_buf, - ::SDL::Params_pT5::kHits * nTrackCanHost); + Params_pT5::kHits * nTrackCanHost); alpaka::memcpy( queue, trackCandidatesInCPU->pixelSeedIndex_buf, trackCandidatesBuffers->pixelSeedIndex_buf, nTrackCanHost); alpaka::memcpy(queue, @@ -1815,7 +1815,7 @@ ALPAKA_ACCELERATOR_NAMESPACE::SDL::trackCandidatesBuffer* ALPAKA_ACCELE return trackCandidatesInCPU; } -ALPAKA_ACCELERATOR_NAMESPACE::SDL::modulesBuffer* ALPAKA_ACCELERATOR_NAMESPACE::SDL::Event::getModules(bool isFull) { +SDL::modulesBuffer* SDL::Event::getModules(bool isFull) { if (modulesInCPU == nullptr) { // The last input here is just a small placeholder for the allocation. modulesInCPU = new SDL::modulesBuffer(devHost, nModules_, nPixels_); diff --git a/RecoTracker/LSTCore/src/alpaka/Event.h b/RecoTracker/LSTCore/src/alpaka/Event.h index bd4d03e28c6d2..cb81cabeed0c0 100644 --- a/RecoTracker/LSTCore/src/alpaka/Event.h +++ b/RecoTracker/LSTCore/src/alpaka/Event.h @@ -1,12 +1,11 @@ -#ifndef Event_cuh -#define Event_cuh +#ifndef RecoTracker_LSTCore_src_Event_h +#define RecoTracker_LSTCore_src_Event_h #include "RecoTracker/LSTCore/interface/alpaka/Constants.h" -#include "RecoTracker/LSTCore/interface/alpaka/Module.h" -#include "RecoTracker/LSTCore/interface/alpaka/LST.h" +#include "RecoTracker/LSTCore/interface/Module.h" +#include "RecoTracker/LSTCore/interface/LST.h" #include "Hit.h" -#include "ModuleMethods.h" #include "Segment.h" #include "Triplet.h" #include "Kernels.h" @@ -17,16 +16,17 @@ #include "HeterogeneousCore/AlpakaInterface/interface/host.h" -namespace ALPAKA_ACCELERATOR_NAMESPACE::SDL { - template - class Event {}; +namespace SDL { + + template + class Event; template <> - class Event { + class Event { private: - Queue queue; - Device devAcc; - DevHost devHost; + ALPAKA_ACCELERATOR_NAMESPACE::Queue queue; + ALPAKA_ACCELERATOR_NAMESPACE::Device devAcc; + alpaka_common::DevHost devHost; bool addObjects; std::array n_hits_by_layer_barrel_; @@ -45,35 +45,35 @@ namespace ALPAKA_ACCELERATOR_NAMESPACE::SDL { //Device stuff unsigned int nTotalSegments; struct objectRanges* rangesInGPU; - struct objectRangesBuffer* rangesBuffers; + struct objectRangesBuffer* rangesBuffers; struct hits* hitsInGPU; - struct hitsBuffer* hitsBuffers; + struct hitsBuffer* hitsBuffers; struct miniDoublets* mdsInGPU; - struct miniDoubletsBuffer* miniDoubletsBuffers; + struct miniDoubletsBuffer* miniDoubletsBuffers; struct segments* segmentsInGPU; - struct segmentsBuffer* segmentsBuffers; + struct segmentsBuffer* segmentsBuffers; struct triplets* tripletsInGPU; - struct tripletsBuffer* tripletsBuffers; + struct tripletsBuffer* tripletsBuffers; struct quintuplets* quintupletsInGPU; - struct quintupletsBuffer* quintupletsBuffers; + struct quintupletsBuffer* quintupletsBuffers; struct trackCandidates* trackCandidatesInGPU; - struct trackCandidatesBuffer* trackCandidatesBuffers; + struct trackCandidatesBuffer* trackCandidatesBuffers; struct pixelTriplets* pixelTripletsInGPU; - struct pixelTripletsBuffer* pixelTripletsBuffers; + struct pixelTripletsBuffer* pixelTripletsBuffers; struct pixelQuintuplets* pixelQuintupletsInGPU; - struct pixelQuintupletsBuffer* pixelQuintupletsBuffers; + struct pixelQuintupletsBuffer* pixelQuintupletsBuffers; //CPU interface stuff - objectRangesBuffer* rangesInCPU; - hitsBuffer* hitsInCPU; - miniDoubletsBuffer* mdsInCPU; - segmentsBuffer* segmentsInCPU; - tripletsBuffer* tripletsInCPU; - trackCandidatesBuffer* trackCandidatesInCPU; - modulesBuffer* modulesInCPU; - quintupletsBuffer* quintupletsInCPU; - pixelTripletsBuffer* pixelTripletsInCPU; - pixelQuintupletsBuffer* pixelQuintupletsInCPU; + objectRangesBuffer* rangesInCPU; + hitsBuffer* hitsInCPU; + miniDoubletsBuffer* mdsInCPU; + segmentsBuffer* segmentsInCPU; + tripletsBuffer* tripletsInCPU; + trackCandidatesBuffer* trackCandidatesInCPU; + modulesBuffer* modulesInCPU; + quintupletsBuffer* quintupletsInCPU; + pixelTripletsBuffer* pixelTripletsInCPU; + pixelQuintupletsBuffer* pixelQuintupletsInCPU; void init(bool verbose); @@ -85,14 +85,14 @@ namespace ALPAKA_ACCELERATOR_NAMESPACE::SDL { const uint16_t nLowerModules_; const unsigned int nPixels_; const unsigned int nEndCapMap_; - const std::shared_ptr> modulesBuffers_; - const std::shared_ptr pixelMapping_; - const std::shared_ptr> endcapGeometryBuffers_; + const std::shared_ptr> modulesBuffers_; + const std::shared_ptr pixelMapping_; + const std::shared_ptr> endcapGeometryBuffers_; public: // Constructor used for CMSSW integration. Uses an external queue. template - Event(bool verbose, TQueue const& q, const LSTESData* deviceESData) + Event(bool verbose, TQueue const& q, const LSTESData* deviceESData) : queue(q), devAcc(alpaka::getDev(q)), devHost(cms::alpakatools::host()), @@ -186,18 +186,18 @@ namespace ALPAKA_ACCELERATOR_NAMESPACE::SDL { int getNumberOfPixelTriplets(); int getNumberOfPixelQuintuplets(); - objectRangesBuffer* getRanges(); - hitsBuffer* getHits(); - hitsBuffer* getHitsInCMSSW(); - miniDoubletsBuffer* getMiniDoublets(); - segmentsBuffer* getSegments(); - tripletsBuffer* getTriplets(); - quintupletsBuffer* getQuintuplets(); - trackCandidatesBuffer* getTrackCandidates(); - trackCandidatesBuffer* getTrackCandidatesInCMSSW(); - pixelTripletsBuffer* getPixelTriplets(); - pixelQuintupletsBuffer* getPixelQuintuplets(); - modulesBuffer* getModules(bool isFull = false); + objectRangesBuffer* getRanges(); + hitsBuffer* getHits(); + hitsBuffer* getHitsInCMSSW(); + miniDoubletsBuffer* getMiniDoublets(); + segmentsBuffer* getSegments(); + tripletsBuffer* getTriplets(); + quintupletsBuffer* getQuintuplets(); + trackCandidatesBuffer* getTrackCandidates(); + trackCandidatesBuffer* getTrackCandidatesInCMSSW(); + pixelTripletsBuffer* getPixelTriplets(); + pixelQuintupletsBuffer* getPixelQuintuplets(); + modulesBuffer* getModules(bool isFull = false); }; } // namespace SDL diff --git a/RecoTracker/LSTCore/src/alpaka/Hit.h b/RecoTracker/LSTCore/src/alpaka/Hit.h index a18c4788f2d15..d524dd93d3e8d 100644 --- a/RecoTracker/LSTCore/src/alpaka/Hit.h +++ b/RecoTracker/LSTCore/src/alpaka/Hit.h @@ -2,9 +2,9 @@ #define Hit_cuh #include "RecoTracker/LSTCore/interface/alpaka/Constants.h" -#include "RecoTracker/LSTCore/interface/alpaka/Module.h" +#include "RecoTracker/LSTCore/interface/Module.h" -namespace ALPAKA_ACCELERATOR_NAMESPACE::SDL { +namespace SDL { struct hits { unsigned int* nHits; float* xs; diff --git a/RecoTracker/LSTCore/src/alpaka/Kernels.h b/RecoTracker/LSTCore/src/alpaka/Kernels.h index 6acc3ddb70bad..96cc6ecf89a79 100644 --- a/RecoTracker/LSTCore/src/alpaka/Kernels.h +++ b/RecoTracker/LSTCore/src/alpaka/Kernels.h @@ -2,7 +2,7 @@ #define Kernels_cuh #include "RecoTracker/LSTCore/interface/alpaka/Constants.h" -#include "RecoTracker/LSTCore/interface/alpaka/Module.h" +#include "RecoTracker/LSTCore/interface/Module.h" #include "Hit.h" #include "MiniDoublet.h" @@ -11,7 +11,7 @@ #include "Quintuplet.h" #include "PixelTriplet.h" -namespace ALPAKA_ACCELERATOR_NAMESPACE::SDL { +namespace SDL { ALPAKA_FN_ACC ALPAKA_FN_INLINE void rmQuintupletFromMemory(struct SDL::quintuplets& quintupletsInGPU, unsigned int quintupletIndex, bool secondpass = false) { @@ -37,18 +37,18 @@ namespace ALPAKA_ACCELERATOR_NAMESPACE::SDL { ALPAKA_FN_ACC ALPAKA_FN_INLINE int checkHitsT5(unsigned int ix, unsigned int jx, struct SDL::quintuplets& quintupletsInGPU) { - unsigned int hits1[::SDL::Params_T5::kHits]; - unsigned int hits2[::SDL::Params_T5::kHits]; + unsigned int hits1[Params_T5::kHits]; + unsigned int hits2[Params_T5::kHits]; - for (int i = 0; i < ::SDL::Params_T5::kHits; i++) { - hits1[i] = quintupletsInGPU.hitIndices[::SDL::Params_T5::kHits * ix + i]; - hits2[i] = quintupletsInGPU.hitIndices[::SDL::Params_T5::kHits * jx + i]; + for (int i = 0; i < Params_T5::kHits; i++) { + hits1[i] = quintupletsInGPU.hitIndices[Params_T5::kHits * ix + i]; + hits2[i] = quintupletsInGPU.hitIndices[Params_T5::kHits * jx + i]; } int nMatched = 0; - for (int i = 0; i < ::SDL::Params_T5::kHits; i++) { + for (int i = 0; i < Params_T5::kHits; i++) { bool matched = false; - for (int j = 0; j < ::SDL::Params_T5::kHits; j++) { + for (int j = 0; j < Params_T5::kHits; j++) { if (hits1[i] == hits2[j]) { matched = true; break; @@ -64,18 +64,18 @@ namespace ALPAKA_ACCELERATOR_NAMESPACE::SDL { ALPAKA_FN_ACC ALPAKA_FN_INLINE int checkHitspT5(unsigned int ix, unsigned int jx, struct SDL::pixelQuintuplets& pixelQuintupletsInGPU) { - unsigned int hits1[::SDL::Params_pT5::kHits]; - unsigned int hits2[::SDL::Params_pT5::kHits]; + unsigned int hits1[Params_pT5::kHits]; + unsigned int hits2[Params_pT5::kHits]; - for (int i = 0; i < ::SDL::Params_pT5::kHits; i++) { - hits1[i] = pixelQuintupletsInGPU.hitIndices[::SDL::Params_pT5::kHits * ix + i]; - hits2[i] = pixelQuintupletsInGPU.hitIndices[::SDL::Params_pT5::kHits * jx + i]; + for (int i = 0; i < Params_pT5::kHits; i++) { + hits1[i] = pixelQuintupletsInGPU.hitIndices[Params_pT5::kHits * ix + i]; + hits2[i] = pixelQuintupletsInGPU.hitIndices[Params_pT5::kHits * jx + i]; } int nMatched = 0; - for (int i = 0; i < ::SDL::Params_pT5::kHits; i++) { + for (int i = 0; i < Params_pT5::kHits; i++) { bool matched = false; - for (int j = 0; j < ::SDL::Params_pT5::kHits; j++) { + for (int j = 0; j < Params_pT5::kHits; j++) { if (hits1[i] == hits2[j]) { matched = true; break; @@ -92,18 +92,18 @@ namespace ALPAKA_ACCELERATOR_NAMESPACE::SDL { unsigned int jx, struct SDL::pixelTriplets& pixelTripletsInGPU, int* matched) { - int phits1[::SDL::Params_pLS::kHits]; - int phits2[::SDL::Params_pLS::kHits]; + int phits1[Params_pLS::kHits]; + int phits2[Params_pLS::kHits]; - for (int i = 0; i < ::SDL::Params_pLS::kHits; i++) { - phits1[i] = pixelTripletsInGPU.hitIndices[::SDL::Params_pT3::kHits * ix + i]; - phits2[i] = pixelTripletsInGPU.hitIndices[::SDL::Params_pT3::kHits * jx + i]; + for (int i = 0; i < Params_pLS::kHits; i++) { + phits1[i] = pixelTripletsInGPU.hitIndices[Params_pT3::kHits * ix + i]; + phits2[i] = pixelTripletsInGPU.hitIndices[Params_pT3::kHits * jx + i]; } int npMatched = 0; - for (int i = 0; i < ::SDL::Params_pLS::kHits; i++) { + for (int i = 0; i < Params_pLS::kHits; i++) { bool pmatched = false; - for (int j = 0; j < ::SDL::Params_pLS::kHits; j++) { + for (int j = 0; j < Params_pLS::kHits; j++) { if (phits1[i] == phits2[j]) { pmatched = true; break; @@ -114,18 +114,18 @@ namespace ALPAKA_ACCELERATOR_NAMESPACE::SDL { } } - int hits1[::SDL::Params_T3::kHits]; - int hits2[::SDL::Params_T3::kHits]; + int hits1[Params_T3::kHits]; + int hits2[Params_T3::kHits]; - for (int i = 0; i < ::SDL::Params_pLS::kHits; i++) { - hits1[i] = pixelTripletsInGPU.hitIndices[::SDL::Params_pT3::kHits * ix + i + 4]; // Omitting the pLS hits - hits2[i] = pixelTripletsInGPU.hitIndices[::SDL::Params_pT3::kHits * jx + i + 4]; // Omitting the pLS hits + for (int i = 0; i < Params_pLS::kHits; i++) { + hits1[i] = pixelTripletsInGPU.hitIndices[Params_pT3::kHits * ix + i + 4]; // Omitting the pLS hits + hits2[i] = pixelTripletsInGPU.hitIndices[Params_pT3::kHits * jx + i + 4]; // Omitting the pLS hits } int nMatched = 0; - for (int i = 0; i < ::SDL::Params_T3::kHits; i++) { + for (int i = 0; i < Params_T3::kHits; i++) { bool tmatched = false; - for (int j = 0; j < ::SDL::Params_T3::kHits; j++) { + for (int j = 0; j < Params_T3::kHits; j++) { if (hits1[i] == hits2[j]) { tmatched = true; break; @@ -281,17 +281,17 @@ namespace ALPAKA_ACCELERATOR_NAMESPACE::SDL { const int minNHitsForDup_pT3 = 5; if ((nMatched[0] + nMatched[1]) >= minNHitsForDup_pT3) { // Check the layers - if (pixelTripletsInGPU.logicalLayers[::SDL::Params_pT3::kLayers * jx + 2] < - pixelTripletsInGPU.logicalLayers[::SDL::Params_pT3::kLayers * ix + 2]) { + if (pixelTripletsInGPU.logicalLayers[Params_pT3::kLayers * jx + 2] < + pixelTripletsInGPU.logicalLayers[Params_pT3::kLayers * ix + 2]) { rmPixelTripletFromMemory(pixelTripletsInGPU, ix); break; - } else if (pixelTripletsInGPU.logicalLayers[::SDL::Params_pT3::kLayers * ix + 2] == - pixelTripletsInGPU.logicalLayers[::SDL::Params_pT3::kLayers * jx + 2] && + } else if (pixelTripletsInGPU.logicalLayers[Params_pT3::kLayers * ix + 2] == + pixelTripletsInGPU.logicalLayers[Params_pT3::kLayers * jx + 2] && __H2F(pixelTripletsInGPU.score[ix]) > __H2F(pixelTripletsInGPU.score[jx])) { rmPixelTripletFromMemory(pixelTripletsInGPU, ix); break; - } else if (pixelTripletsInGPU.logicalLayers[::SDL::Params_pT3::kLayers * ix + 2] == - pixelTripletsInGPU.logicalLayers[::SDL::Params_pT3::kLayers * jx + 2] && + } else if (pixelTripletsInGPU.logicalLayers[Params_pT3::kLayers * ix + 2] == + pixelTripletsInGPU.logicalLayers[Params_pT3::kLayers * jx + 2] && (__H2F(pixelTripletsInGPU.score[ix]) == __H2F(pixelTripletsInGPU.score[jx])) && (ix < jx)) { rmPixelTripletFromMemory(pixelTripletsInGPU, ix); break; @@ -341,14 +341,14 @@ namespace ALPAKA_ACCELERATOR_NAMESPACE::SDL { int pixelModuleIndex = *modulesInGPU.nLowerModules; unsigned int nPixelSegments = segmentsInGPU.nSegments[pixelModuleIndex]; - if (nPixelSegments > ::SDL::N_MAX_PIXEL_SEGMENTS_PER_MODULE) - nPixelSegments = ::SDL::N_MAX_PIXEL_SEGMENTS_PER_MODULE; + if (nPixelSegments > N_MAX_PIXEL_SEGMENTS_PER_MODULE) + nPixelSegments = N_MAX_PIXEL_SEGMENTS_PER_MODULE; for (unsigned int ix = globalThreadIdx[1]; ix < nPixelSegments; ix += gridThreadExtent[1]) { if (secondpass && (!segmentsInGPU.isQuad[ix] || (segmentsInGPU.isDup[ix] & 1))) continue; - unsigned int phits1[::SDL::Params_pLS::kHits]; + unsigned int phits1[Params_pLS::kHits]; phits1[0] = segmentsInGPU.pLSHitsIdxs[ix].x; phits1[1] = segmentsInGPU.pLSHitsIdxs[ix].y; phits1[2] = segmentsInGPU.pLSHitsIdxs[ix].z; @@ -381,16 +381,16 @@ namespace ALPAKA_ACCELERATOR_NAMESPACE::SDL { else idxToRemove = ix; - unsigned int phits2[::SDL::Params_pLS::kHits]; + unsigned int phits2[Params_pLS::kHits]; phits2[0] = segmentsInGPU.pLSHitsIdxs[jx].x; phits2[1] = segmentsInGPU.pLSHitsIdxs[jx].y; phits2[2] = segmentsInGPU.pLSHitsIdxs[jx].z; phits2[3] = segmentsInGPU.pLSHitsIdxs[jx].w; int npMatched = 0; - for (int i = 0; i < ::SDL::Params_pLS::kHits; i++) { + for (int i = 0; i < Params_pLS::kHits; i++) { bool pmatched = false; - for (int j = 0; j < ::SDL::Params_pLS::kHits; j++) { + for (int j = 0; j < Params_pLS::kHits; j++) { if (phits1[i] == phits2[j]) { pmatched = true; break; diff --git a/RecoTracker/LSTCore/src/alpaka/LST.dev.cc b/RecoTracker/LSTCore/src/alpaka/LST.dev.cc index d4ca300ed7302..ef028e5a2bca0 100644 --- a/RecoTracker/LSTCore/src/alpaka/LST.dev.cc +++ b/RecoTracker/LSTCore/src/alpaka/LST.dev.cc @@ -1,4 +1,4 @@ -#include "RecoTracker/LSTCore/interface/alpaka/LST.h" +#include "RecoTracker/LSTCore/interface/LST.h" #include "Event.h" @@ -7,159 +7,6 @@ using namespace ALPAKA_ACCELERATOR_NAMESPACE; #include "Math/Vector3D.h" using XYZVector = ROOT::Math::XYZVector; -void ALPAKA_ACCELERATOR_NAMESPACE::SDL::LST::run(Queue& queue, - bool verbose, - const LSTESData* deviceESData, - const std::vector see_px, - const std::vector see_py, - const std::vector see_pz, - const std::vector see_dxy, - const std::vector see_dz, - const std::vector see_ptErr, - const std::vector see_etaErr, - const std::vector see_stateTrajGlbX, - const std::vector see_stateTrajGlbY, - const std::vector see_stateTrajGlbZ, - const std::vector see_stateTrajGlbPx, - const std::vector see_stateTrajGlbPy, - const std::vector see_stateTrajGlbPz, - const std::vector see_q, - const std::vector> see_hitIdx, - const std::vector ph2_detId, - const std::vector ph2_x, - const std::vector ph2_y, - const std::vector ph2_z, - bool no_pls_dupclean, - bool tc_pls_triplets) { - auto event = SDL::Event(verbose, queue, deviceESData); - prepareInput(see_px, - see_py, - see_pz, - see_dxy, - see_dz, - see_ptErr, - see_etaErr, - see_stateTrajGlbX, - see_stateTrajGlbY, - see_stateTrajGlbZ, - see_stateTrajGlbPx, - see_stateTrajGlbPy, - see_stateTrajGlbPz, - see_q, - see_hitIdx, - ph2_detId, - ph2_x, - ph2_y, - ph2_z); - - event.addHitToEvent(in_trkX_, in_trkY_, in_trkZ_, in_hitId_, in_hitIdxs_); - event.addPixelSegmentToEvent(in_hitIndices_vec0_, - in_hitIndices_vec1_, - in_hitIndices_vec2_, - in_hitIndices_vec3_, - in_deltaPhi_vec_, - in_ptIn_vec_, - in_ptErr_vec_, - in_px_vec_, - in_py_vec_, - in_pz_vec_, - in_eta_vec_, - in_etaErr_vec_, - in_phi_vec_, - in_charge_vec_, - in_seedIdx_vec_, - in_superbin_vec_, - in_pixelType_vec_, - in_isQuad_vec_); - event.createMiniDoublets(); - if (verbose) { - printf("# of Mini-doublets produced: %d\n", event.getNumberOfMiniDoublets()); - printf("# of Mini-doublets produced barrel layer 1: %d\n", event.getNumberOfMiniDoubletsByLayerBarrel(0)); - printf("# of Mini-doublets produced barrel layer 2: %d\n", event.getNumberOfMiniDoubletsByLayerBarrel(1)); - printf("# of Mini-doublets produced barrel layer 3: %d\n", event.getNumberOfMiniDoubletsByLayerBarrel(2)); - printf("# of Mini-doublets produced barrel layer 4: %d\n", event.getNumberOfMiniDoubletsByLayerBarrel(3)); - printf("# of Mini-doublets produced barrel layer 5: %d\n", event.getNumberOfMiniDoubletsByLayerBarrel(4)); - printf("# of Mini-doublets produced barrel layer 6: %d\n", event.getNumberOfMiniDoubletsByLayerBarrel(5)); - printf("# of Mini-doublets produced endcap layer 1: %d\n", event.getNumberOfMiniDoubletsByLayerEndcap(0)); - printf("# of Mini-doublets produced endcap layer 2: %d\n", event.getNumberOfMiniDoubletsByLayerEndcap(1)); - printf("# of Mini-doublets produced endcap layer 3: %d\n", event.getNumberOfMiniDoubletsByLayerEndcap(2)); - printf("# of Mini-doublets produced endcap layer 4: %d\n", event.getNumberOfMiniDoubletsByLayerEndcap(3)); - printf("# of Mini-doublets produced endcap layer 5: %d\n", event.getNumberOfMiniDoubletsByLayerEndcap(4)); - } - - event.createSegmentsWithModuleMap(); - if (verbose) { - printf("# of Segments produced: %d\n", event.getNumberOfSegments()); - printf("# of Segments produced layer 1-2: %d\n", event.getNumberOfSegmentsByLayerBarrel(0)); - printf("# of Segments produced layer 2-3: %d\n", event.getNumberOfSegmentsByLayerBarrel(1)); - printf("# of Segments produced layer 3-4: %d\n", event.getNumberOfSegmentsByLayerBarrel(2)); - printf("# of Segments produced layer 4-5: %d\n", event.getNumberOfSegmentsByLayerBarrel(3)); - printf("# of Segments produced layer 5-6: %d\n", event.getNumberOfSegmentsByLayerBarrel(4)); - printf("# of Segments produced endcap layer 1: %d\n", event.getNumberOfSegmentsByLayerEndcap(0)); - printf("# of Segments produced endcap layer 2: %d\n", event.getNumberOfSegmentsByLayerEndcap(1)); - printf("# of Segments produced endcap layer 3: %d\n", event.getNumberOfSegmentsByLayerEndcap(2)); - printf("# of Segments produced endcap layer 4: %d\n", event.getNumberOfSegmentsByLayerEndcap(3)); - printf("# of Segments produced endcap layer 5: %d\n", event.getNumberOfSegmentsByLayerEndcap(4)); - } - - event.createTriplets(); - if (verbose) { - printf("# of T3s produced: %d\n", event.getNumberOfTriplets()); - printf("# of T3s produced layer 1-2-3: %d\n", event.getNumberOfTripletsByLayerBarrel(0)); - printf("# of T3s produced layer 2-3-4: %d\n", event.getNumberOfTripletsByLayerBarrel(1)); - printf("# of T3s produced layer 3-4-5: %d\n", event.getNumberOfTripletsByLayerBarrel(2)); - printf("# of T3s produced layer 4-5-6: %d\n", event.getNumberOfTripletsByLayerBarrel(3)); - printf("# of T3s produced endcap layer 1-2-3: %d\n", event.getNumberOfTripletsByLayerEndcap(0)); - printf("# of T3s produced endcap layer 2-3-4: %d\n", event.getNumberOfTripletsByLayerEndcap(1)); - printf("# of T3s produced endcap layer 3-4-5: %d\n", event.getNumberOfTripletsByLayerEndcap(2)); - printf("# of T3s produced endcap layer 1: %d\n", event.getNumberOfTripletsByLayerEndcap(0)); - printf("# of T3s produced endcap layer 2: %d\n", event.getNumberOfTripletsByLayerEndcap(1)); - printf("# of T3s produced endcap layer 3: %d\n", event.getNumberOfTripletsByLayerEndcap(2)); - printf("# of T3s produced endcap layer 4: %d\n", event.getNumberOfTripletsByLayerEndcap(3)); - printf("# of T3s produced endcap layer 5: %d\n", event.getNumberOfTripletsByLayerEndcap(4)); - } - - event.createQuintuplets(); - if (verbose) { - printf("# of Quintuplets produced: %d\n", event.getNumberOfQuintuplets()); - printf("# of Quintuplets produced layer 1-2-3-4-5-6: %d\n", event.getNumberOfQuintupletsByLayerBarrel(0)); - printf("# of Quintuplets produced layer 2: %d\n", event.getNumberOfQuintupletsByLayerBarrel(1)); - printf("# of Quintuplets produced layer 3: %d\n", event.getNumberOfQuintupletsByLayerBarrel(2)); - printf("# of Quintuplets produced layer 4: %d\n", event.getNumberOfQuintupletsByLayerBarrel(3)); - printf("# of Quintuplets produced layer 5: %d\n", event.getNumberOfQuintupletsByLayerBarrel(4)); - printf("# of Quintuplets produced layer 6: %d\n", event.getNumberOfQuintupletsByLayerBarrel(5)); - printf("# of Quintuplets produced endcap layer 1: %d\n", event.getNumberOfQuintupletsByLayerEndcap(0)); - printf("# of Quintuplets produced endcap layer 2: %d\n", event.getNumberOfQuintupletsByLayerEndcap(1)); - printf("# of Quintuplets produced endcap layer 3: %d\n", event.getNumberOfQuintupletsByLayerEndcap(2)); - printf("# of Quintuplets produced endcap layer 4: %d\n", event.getNumberOfQuintupletsByLayerEndcap(3)); - printf("# of Quintuplets produced endcap layer 5: %d\n", event.getNumberOfQuintupletsByLayerEndcap(4)); - } - - event.pixelLineSegmentCleaning(no_pls_dupclean); - - event.createPixelQuintuplets(); - if (verbose) - printf("# of Pixel Quintuplets produced: %d\n", event.getNumberOfPixelQuintuplets()); - - event.createPixelTriplets(); - if (verbose) - printf("# of Pixel T3s produced: %d\n", event.getNumberOfPixelTriplets()); - - event.createTrackCandidates(no_pls_dupclean, tc_pls_triplets); - if (verbose) { - printf("# of TrackCandidates produced: %d\n", event.getNumberOfTrackCandidates()); - printf(" # of Pixel TrackCandidates produced: %d\n", event.getNumberOfPixelTrackCandidates()); - printf(" # of pT5 TrackCandidates produced: %d\n", event.getNumberOfPT5TrackCandidates()); - printf(" # of pT3 TrackCandidates produced: %d\n", event.getNumberOfPT3TrackCandidates()); - printf(" # of pLS TrackCandidates produced: %d\n", event.getNumberOfPLSTrackCandidates()); - printf(" # of T5 TrackCandidates produced: %d\n", event.getNumberOfT5TrackCandidates()); - } - - getOutput(event); - - event.resetEvent(); -} - namespace { XYZVector calculateR3FromPCA(const XYZVector& p3, const float dxy, const float dz) { const float pt = p3.rho(); @@ -172,7 +19,8 @@ namespace { } } // namespace -void ALPAKA_ACCELERATOR_NAMESPACE::SDL::LST::prepareInput(const std::vector see_px, +template <> +void SDL::LST::prepareInput(const std::vector see_px, const std::vector see_py, const std::vector see_pz, const std::vector see_dxy, @@ -364,7 +212,44 @@ void ALPAKA_ACCELERATOR_NAMESPACE::SDL::LST::prepareInput(const std::vect in_isQuad_vec_ = isQuad_vec; } -void ALPAKA_ACCELERATOR_NAMESPACE::SDL::LST::getOutput(SDL::Event& event) { +template<> +std::vector SDL::LST::getHitIdxs(const short trackCandidateType, + const unsigned int TCIdx, + const unsigned int* TCHitIndices, + const unsigned int* hitIndices) { + std::vector hits; + + unsigned int maxNHits = 0; + if (trackCandidateType == 7) + maxNHits = Params_pT5::kHits; // pT5 + else if (trackCandidateType == 5) + maxNHits = Params_pT3::kHits; // pT3 + else if (trackCandidateType == 4) + maxNHits = Params_T5::kHits; // T5 + else if (trackCandidateType == 8) + maxNHits = Params_pLS::kHits; // pLS + + for (unsigned int i = 0; i < maxNHits; i++) { + unsigned int hitIdxInGPU = TCHitIndices[Params_pT5::kHits * TCIdx + i]; + unsigned int hitIdx = + (trackCandidateType == 8) + ? hitIdxInGPU + : hitIndices[hitIdxInGPU]; // Hit indices are stored differently in the standalone for pLS. + + // For p objects, the 3rd and 4th hit maybe the same, + // due to the way pLS hits are stored in the standalone. + // This is because pixel seeds can be either triplets or quadruplets. + if (trackCandidateType != 4 && hits.size() == 3 && hits.back() == hitIdx) // Remove duplicate 4th hits. + continue; + + hits.push_back(hitIdx); + } + + return hits; +} + +template <> +void SDL::LST::getOutput(SDL::Event& event) { std::vector> tc_hitIdxs; std::vector tc_len; std::vector tc_seedIdx; @@ -391,37 +276,157 @@ void ALPAKA_ACCELERATOR_NAMESPACE::SDL::LST::getOutput(SDL::Event& out_tc_trackCandidateType_ = tc_trackCandidateType; } -std::vector ALPAKA_ACCELERATOR_NAMESPACE::SDL::LST::getHitIdxs(const short trackCandidateType, - const unsigned int TCIdx, - const unsigned int* TCHitIndices, - const unsigned int* hitIndices) { - std::vector hits; +template <> +template <> +void SDL::LST::run(Queue& queue, + bool verbose, + const LSTESData* deviceESData, + const std::vector see_px, + const std::vector see_py, + const std::vector see_pz, + const std::vector see_dxy, + const std::vector see_dz, + const std::vector see_ptErr, + const std::vector see_etaErr, + const std::vector see_stateTrajGlbX, + const std::vector see_stateTrajGlbY, + const std::vector see_stateTrajGlbZ, + const std::vector see_stateTrajGlbPx, + const std::vector see_stateTrajGlbPy, + const std::vector see_stateTrajGlbPz, + const std::vector see_q, + const std::vector> see_hitIdx, + const std::vector ph2_detId, + const std::vector ph2_x, + const std::vector ph2_y, + const std::vector ph2_z, + bool no_pls_dupclean, + bool tc_pls_triplets) { + auto event = SDL::Event(verbose, queue, deviceESData); + prepareInput(see_px, + see_py, + see_pz, + see_dxy, + see_dz, + see_ptErr, + see_etaErr, + see_stateTrajGlbX, + see_stateTrajGlbY, + see_stateTrajGlbZ, + see_stateTrajGlbPx, + see_stateTrajGlbPy, + see_stateTrajGlbPz, + see_q, + see_hitIdx, + ph2_detId, + ph2_x, + ph2_y, + ph2_z); - unsigned int maxNHits = 0; - if (trackCandidateType == 7) - maxNHits = ::SDL::Params_pT5::kHits; // pT5 - else if (trackCandidateType == 5) - maxNHits = ::SDL::Params_pT3::kHits; // pT3 - else if (trackCandidateType == 4) - maxNHits = ::SDL::Params_T5::kHits; // T5 - else if (trackCandidateType == 8) - maxNHits = ::SDL::Params_pLS::kHits; // pLS + event.addHitToEvent(in_trkX_, in_trkY_, in_trkZ_, in_hitId_, in_hitIdxs_); + event.addPixelSegmentToEvent(in_hitIndices_vec0_, + in_hitIndices_vec1_, + in_hitIndices_vec2_, + in_hitIndices_vec3_, + in_deltaPhi_vec_, + in_ptIn_vec_, + in_ptErr_vec_, + in_px_vec_, + in_py_vec_, + in_pz_vec_, + in_eta_vec_, + in_etaErr_vec_, + in_phi_vec_, + in_charge_vec_, + in_seedIdx_vec_, + in_superbin_vec_, + in_pixelType_vec_, + in_isQuad_vec_); + event.createMiniDoublets(); + if (verbose) { + printf("# of Mini-doublets produced: %d\n", event.getNumberOfMiniDoublets()); + printf("# of Mini-doublets produced barrel layer 1: %d\n", event.getNumberOfMiniDoubletsByLayerBarrel(0)); + printf("# of Mini-doublets produced barrel layer 2: %d\n", event.getNumberOfMiniDoubletsByLayerBarrel(1)); + printf("# of Mini-doublets produced barrel layer 3: %d\n", event.getNumberOfMiniDoubletsByLayerBarrel(2)); + printf("# of Mini-doublets produced barrel layer 4: %d\n", event.getNumberOfMiniDoubletsByLayerBarrel(3)); + printf("# of Mini-doublets produced barrel layer 5: %d\n", event.getNumberOfMiniDoubletsByLayerBarrel(4)); + printf("# of Mini-doublets produced barrel layer 6: %d\n", event.getNumberOfMiniDoubletsByLayerBarrel(5)); + printf("# of Mini-doublets produced endcap layer 1: %d\n", event.getNumberOfMiniDoubletsByLayerEndcap(0)); + printf("# of Mini-doublets produced endcap layer 2: %d\n", event.getNumberOfMiniDoubletsByLayerEndcap(1)); + printf("# of Mini-doublets produced endcap layer 3: %d\n", event.getNumberOfMiniDoubletsByLayerEndcap(2)); + printf("# of Mini-doublets produced endcap layer 4: %d\n", event.getNumberOfMiniDoubletsByLayerEndcap(3)); + printf("# of Mini-doublets produced endcap layer 5: %d\n", event.getNumberOfMiniDoubletsByLayerEndcap(4)); + } - for (unsigned int i = 0; i < maxNHits; i++) { - unsigned int hitIdxInGPU = TCHitIndices[::SDL::Params_pT5::kHits * TCIdx + i]; - unsigned int hitIdx = - (trackCandidateType == 8) - ? hitIdxInGPU - : hitIndices[hitIdxInGPU]; // Hit indices are stored differently in the standalone for pLS. + event.createSegmentsWithModuleMap(); + if (verbose) { + printf("# of Segments produced: %d\n", event.getNumberOfSegments()); + printf("# of Segments produced layer 1-2: %d\n", event.getNumberOfSegmentsByLayerBarrel(0)); + printf("# of Segments produced layer 2-3: %d\n", event.getNumberOfSegmentsByLayerBarrel(1)); + printf("# of Segments produced layer 3-4: %d\n", event.getNumberOfSegmentsByLayerBarrel(2)); + printf("# of Segments produced layer 4-5: %d\n", event.getNumberOfSegmentsByLayerBarrel(3)); + printf("# of Segments produced layer 5-6: %d\n", event.getNumberOfSegmentsByLayerBarrel(4)); + printf("# of Segments produced endcap layer 1: %d\n", event.getNumberOfSegmentsByLayerEndcap(0)); + printf("# of Segments produced endcap layer 2: %d\n", event.getNumberOfSegmentsByLayerEndcap(1)); + printf("# of Segments produced endcap layer 3: %d\n", event.getNumberOfSegmentsByLayerEndcap(2)); + printf("# of Segments produced endcap layer 4: %d\n", event.getNumberOfSegmentsByLayerEndcap(3)); + printf("# of Segments produced endcap layer 5: %d\n", event.getNumberOfSegmentsByLayerEndcap(4)); + } - // For p objects, the 3rd and 4th hit maybe the same, - // due to the way pLS hits are stored in the standalone. - // This is because pixel seeds can be either triplets or quadruplets. - if (trackCandidateType != 4 && hits.size() == 3 && hits.back() == hitIdx) // Remove duplicate 4th hits. - continue; + event.createTriplets(); + if (verbose) { + printf("# of T3s produced: %d\n", event.getNumberOfTriplets()); + printf("# of T3s produced layer 1-2-3: %d\n", event.getNumberOfTripletsByLayerBarrel(0)); + printf("# of T3s produced layer 2-3-4: %d\n", event.getNumberOfTripletsByLayerBarrel(1)); + printf("# of T3s produced layer 3-4-5: %d\n", event.getNumberOfTripletsByLayerBarrel(2)); + printf("# of T3s produced layer 4-5-6: %d\n", event.getNumberOfTripletsByLayerBarrel(3)); + printf("# of T3s produced endcap layer 1-2-3: %d\n", event.getNumberOfTripletsByLayerEndcap(0)); + printf("# of T3s produced endcap layer 2-3-4: %d\n", event.getNumberOfTripletsByLayerEndcap(1)); + printf("# of T3s produced endcap layer 3-4-5: %d\n", event.getNumberOfTripletsByLayerEndcap(2)); + printf("# of T3s produced endcap layer 1: %d\n", event.getNumberOfTripletsByLayerEndcap(0)); + printf("# of T3s produced endcap layer 2: %d\n", event.getNumberOfTripletsByLayerEndcap(1)); + printf("# of T3s produced endcap layer 3: %d\n", event.getNumberOfTripletsByLayerEndcap(2)); + printf("# of T3s produced endcap layer 4: %d\n", event.getNumberOfTripletsByLayerEndcap(3)); + printf("# of T3s produced endcap layer 5: %d\n", event.getNumberOfTripletsByLayerEndcap(4)); + } - hits.push_back(hitIdx); + event.createQuintuplets(); + if (verbose) { + printf("# of Quintuplets produced: %d\n", event.getNumberOfQuintuplets()); + printf("# of Quintuplets produced layer 1-2-3-4-5-6: %d\n", event.getNumberOfQuintupletsByLayerBarrel(0)); + printf("# of Quintuplets produced layer 2: %d\n", event.getNumberOfQuintupletsByLayerBarrel(1)); + printf("# of Quintuplets produced layer 3: %d\n", event.getNumberOfQuintupletsByLayerBarrel(2)); + printf("# of Quintuplets produced layer 4: %d\n", event.getNumberOfQuintupletsByLayerBarrel(3)); + printf("# of Quintuplets produced layer 5: %d\n", event.getNumberOfQuintupletsByLayerBarrel(4)); + printf("# of Quintuplets produced layer 6: %d\n", event.getNumberOfQuintupletsByLayerBarrel(5)); + printf("# of Quintuplets produced endcap layer 1: %d\n", event.getNumberOfQuintupletsByLayerEndcap(0)); + printf("# of Quintuplets produced endcap layer 2: %d\n", event.getNumberOfQuintupletsByLayerEndcap(1)); + printf("# of Quintuplets produced endcap layer 3: %d\n", event.getNumberOfQuintupletsByLayerEndcap(2)); + printf("# of Quintuplets produced endcap layer 4: %d\n", event.getNumberOfQuintupletsByLayerEndcap(3)); + printf("# of Quintuplets produced endcap layer 5: %d\n", event.getNumberOfQuintupletsByLayerEndcap(4)); } - return hits; -} + event.pixelLineSegmentCleaning(no_pls_dupclean); + + event.createPixelQuintuplets(); + if (verbose) + printf("# of Pixel Quintuplets produced: %d\n", event.getNumberOfPixelQuintuplets()); + + event.createPixelTriplets(); + if (verbose) + printf("# of Pixel T3s produced: %d\n", event.getNumberOfPixelTriplets()); + + event.createTrackCandidates(no_pls_dupclean, tc_pls_triplets); + if (verbose) { + printf("# of TrackCandidates produced: %d\n", event.getNumberOfTrackCandidates()); + printf(" # of Pixel TrackCandidates produced: %d\n", event.getNumberOfPixelTrackCandidates()); + printf(" # of pT5 TrackCandidates produced: %d\n", event.getNumberOfPT5TrackCandidates()); + printf(" # of pT3 TrackCandidates produced: %d\n", event.getNumberOfPT3TrackCandidates()); + printf(" # of pLS TrackCandidates produced: %d\n", event.getNumberOfPLSTrackCandidates()); + printf(" # of T5 TrackCandidates produced: %d\n", event.getNumberOfT5TrackCandidates()); + } + + getOutput(event); + + event.resetEvent(); +} \ No newline at end of file diff --git a/RecoTracker/LSTCore/src/alpaka/MiniDoublet.h b/RecoTracker/LSTCore/src/alpaka/MiniDoublet.h index b9c5e85245158..1f65d69cd535f 100644 --- a/RecoTracker/LSTCore/src/alpaka/MiniDoublet.h +++ b/RecoTracker/LSTCore/src/alpaka/MiniDoublet.h @@ -2,12 +2,12 @@ #define MiniDoublet_cuh #include "RecoTracker/LSTCore/interface/alpaka/Constants.h" -#include "RecoTracker/LSTCore/interface/alpaka/Module.h" +#include "RecoTracker/LSTCore/interface/Module.h" #include "RecoTracker/LSTCore/interface/EndcapGeometry.h" #include "Hit.h" -namespace ALPAKA_ACCELERATOR_NAMESPACE::SDL { +namespace SDL { struct miniDoublets { unsigned int* nMemoryLocations; diff --git a/RecoTracker/LSTCore/src/alpaka/NeuralNetwork.h b/RecoTracker/LSTCore/src/alpaka/NeuralNetwork.h index c1711caeb4b84..d04260ec2deb1 100644 --- a/RecoTracker/LSTCore/src/alpaka/NeuralNetwork.h +++ b/RecoTracker/LSTCore/src/alpaka/NeuralNetwork.h @@ -2,7 +2,7 @@ #define NeuralNetwork_cuh #include "RecoTracker/LSTCore/interface/alpaka/Constants.h" -#include "RecoTracker/LSTCore/interface/alpaka/Module.h" +#include "RecoTracker/LSTCore/interface/Module.h" #include "NeuralNetworkWeights.h" #include "Segment.h" @@ -10,7 +10,7 @@ #include "Hit.h" #include "Triplet.h" -namespace ALPAKA_ACCELERATOR_NAMESPACE::T5DNN { +namespace T5DNN { template ALPAKA_FN_ACC ALPAKA_FN_INLINE float runInference(TAcc const& acc, diff --git a/RecoTracker/LSTCore/src/alpaka/NeuralNetworkWeights.h b/RecoTracker/LSTCore/src/alpaka/NeuralNetworkWeights.h index 83078bb3ddd7f..90fb6b21ac7d4 100644 --- a/RecoTracker/LSTCore/src/alpaka/NeuralNetworkWeights.h +++ b/RecoTracker/LSTCore/src/alpaka/NeuralNetworkWeights.h @@ -3,7 +3,7 @@ #include -namespace ALPAKA_ACCELERATOR_NAMESPACE::T5DNN { +namespace T5DNN { ALPAKA_STATIC_ACC_MEM_GLOBAL const float bias_0[32] = { -4.5069356f, -5.8842053f, 1.0793180f, -0.1540973f, -0.4705772f, 6.4027028f, -0.6620818f, -7.0734525f, 0.6211641f, 4.9630723f, 3.4310920f, -0.8856288f, 4.5843782f, -6.0180559f, 0.0126438f, -1.5725276f, diff --git a/RecoTracker/LSTCore/src/alpaka/PixelTriplet.h b/RecoTracker/LSTCore/src/alpaka/PixelTriplet.h index 26306b8e2a40b..06b73403011ac 100644 --- a/RecoTracker/LSTCore/src/alpaka/PixelTriplet.h +++ b/RecoTracker/LSTCore/src/alpaka/PixelTriplet.h @@ -2,7 +2,7 @@ #define PixelTriplet_cuh #include "RecoTracker/LSTCore/interface/alpaka/Constants.h" -#include "RecoTracker/LSTCore/interface/alpaka/Module.h" +#include "RecoTracker/LSTCore/interface/Module.h" #include "Triplet.h" #include "Segment.h" @@ -10,7 +10,7 @@ #include "Hit.h" #include "Quintuplet.h" -namespace ALPAKA_ACCELERATOR_NAMESPACE::SDL { +namespace SDL { // One pixel segment, one outer tracker triplet! struct pixelTriplets { unsigned int* pixelSegmentIndices; @@ -110,9 +110,9 @@ namespace ALPAKA_ACCELERATOR_NAMESPACE::SDL { score_buf(allocBufWrapper(devAccIn, maxPixelTriplets, queue)), isDup_buf(allocBufWrapper(devAccIn, maxPixelTriplets, queue)), partOfPT5_buf(allocBufWrapper(devAccIn, maxPixelTriplets, queue)), - logicalLayers_buf(allocBufWrapper(devAccIn, maxPixelTriplets * ::SDL::Params_pT3::kLayers, queue)), - hitIndices_buf(allocBufWrapper(devAccIn, maxPixelTriplets * ::SDL::Params_pT3::kHits, queue)), - lowerModuleIndices_buf(allocBufWrapper(devAccIn, maxPixelTriplets * ::SDL::Params_pT3::kLayers, queue)), + logicalLayers_buf(allocBufWrapper(devAccIn, maxPixelTriplets * Params_pT3::kLayers, queue)), + hitIndices_buf(allocBufWrapper(devAccIn, maxPixelTriplets * Params_pT3::kHits, queue)), + lowerModuleIndices_buf(allocBufWrapper(devAccIn, maxPixelTriplets * Params_pT3::kLayers, queue)), centerX_buf(allocBufWrapper(devAccIn, maxPixelTriplets, queue)), centerY_buf(allocBufWrapper(devAccIn, maxPixelTriplets, queue)), pixelRadiusError_buf(allocBufWrapper(devAccIn, maxPixelTriplets, queue)), @@ -161,46 +161,46 @@ namespace ALPAKA_ACCELERATOR_NAMESPACE::SDL { pixelTripletsInGPU.centerX[pixelTripletIndex] = __F2H(centerX); pixelTripletsInGPU.centerY[pixelTripletIndex] = __F2H(centerY); - pixelTripletsInGPU.logicalLayers[::SDL::Params_pT3::kLayers * pixelTripletIndex] = 0; - pixelTripletsInGPU.logicalLayers[::SDL::Params_pT3::kLayers * pixelTripletIndex + 1] = 0; - pixelTripletsInGPU.logicalLayers[::SDL::Params_pT3::kLayers * pixelTripletIndex + 2] = - tripletsInGPU.logicalLayers[tripletIndex * ::SDL::Params_T3::kLayers]; - pixelTripletsInGPU.logicalLayers[::SDL::Params_pT3::kLayers * pixelTripletIndex + 3] = - tripletsInGPU.logicalLayers[tripletIndex * ::SDL::Params_T3::kLayers + 1]; - pixelTripletsInGPU.logicalLayers[::SDL::Params_pT3::kLayers * pixelTripletIndex + 4] = - tripletsInGPU.logicalLayers[tripletIndex * ::SDL::Params_T3::kLayers + 2]; - - pixelTripletsInGPU.lowerModuleIndices[::SDL::Params_pT3::kLayers * pixelTripletIndex] = + pixelTripletsInGPU.logicalLayers[Params_pT3::kLayers * pixelTripletIndex] = 0; + pixelTripletsInGPU.logicalLayers[Params_pT3::kLayers * pixelTripletIndex + 1] = 0; + pixelTripletsInGPU.logicalLayers[Params_pT3::kLayers * pixelTripletIndex + 2] = + tripletsInGPU.logicalLayers[tripletIndex * Params_T3::kLayers]; + pixelTripletsInGPU.logicalLayers[Params_pT3::kLayers * pixelTripletIndex + 3] = + tripletsInGPU.logicalLayers[tripletIndex * Params_T3::kLayers + 1]; + pixelTripletsInGPU.logicalLayers[Params_pT3::kLayers * pixelTripletIndex + 4] = + tripletsInGPU.logicalLayers[tripletIndex * Params_T3::kLayers + 2]; + + pixelTripletsInGPU.lowerModuleIndices[Params_pT3::kLayers * pixelTripletIndex] = segmentsInGPU.innerLowerModuleIndices[pixelSegmentIndex]; - pixelTripletsInGPU.lowerModuleIndices[::SDL::Params_pT3::kLayers * pixelTripletIndex + 1] = + pixelTripletsInGPU.lowerModuleIndices[Params_pT3::kLayers * pixelTripletIndex + 1] = segmentsInGPU.outerLowerModuleIndices[pixelSegmentIndex]; - pixelTripletsInGPU.lowerModuleIndices[::SDL::Params_pT3::kLayers * pixelTripletIndex + 2] = - tripletsInGPU.lowerModuleIndices[::SDL::Params_T3::kLayers * tripletIndex]; - pixelTripletsInGPU.lowerModuleIndices[::SDL::Params_pT3::kLayers * pixelTripletIndex + 3] = - tripletsInGPU.lowerModuleIndices[::SDL::Params_T3::kLayers * tripletIndex + 1]; - pixelTripletsInGPU.lowerModuleIndices[::SDL::Params_pT3::kLayers * pixelTripletIndex + 4] = - tripletsInGPU.lowerModuleIndices[::SDL::Params_T3::kLayers * tripletIndex + 2]; + pixelTripletsInGPU.lowerModuleIndices[Params_pT3::kLayers * pixelTripletIndex + 2] = + tripletsInGPU.lowerModuleIndices[Params_T3::kLayers * tripletIndex]; + pixelTripletsInGPU.lowerModuleIndices[Params_pT3::kLayers * pixelTripletIndex + 3] = + tripletsInGPU.lowerModuleIndices[Params_T3::kLayers * tripletIndex + 1]; + pixelTripletsInGPU.lowerModuleIndices[Params_pT3::kLayers * pixelTripletIndex + 4] = + tripletsInGPU.lowerModuleIndices[Params_T3::kLayers * tripletIndex + 2]; unsigned int pixelInnerMD = segmentsInGPU.mdIndices[2 * pixelSegmentIndex]; unsigned int pixelOuterMD = segmentsInGPU.mdIndices[2 * pixelSegmentIndex + 1]; - pixelTripletsInGPU.hitIndices[::SDL::Params_pT3::kHits * pixelTripletIndex] = mdsInGPU.anchorHitIndices[pixelInnerMD]; - pixelTripletsInGPU.hitIndices[::SDL::Params_pT3::kHits * pixelTripletIndex + 1] = mdsInGPU.outerHitIndices[pixelInnerMD]; - pixelTripletsInGPU.hitIndices[::SDL::Params_pT3::kHits * pixelTripletIndex + 2] = mdsInGPU.anchorHitIndices[pixelOuterMD]; - pixelTripletsInGPU.hitIndices[::SDL::Params_pT3::kHits * pixelTripletIndex + 3] = mdsInGPU.outerHitIndices[pixelOuterMD]; - - pixelTripletsInGPU.hitIndices[::SDL::Params_pT3::kHits * pixelTripletIndex + 4] = - tripletsInGPU.hitIndices[::SDL::Params_T3::kHits * tripletIndex]; - pixelTripletsInGPU.hitIndices[::SDL::Params_pT3::kHits * pixelTripletIndex + 5] = - tripletsInGPU.hitIndices[::SDL::Params_T3::kHits * tripletIndex + 1]; - pixelTripletsInGPU.hitIndices[::SDL::Params_pT3::kHits * pixelTripletIndex + 6] = - tripletsInGPU.hitIndices[::SDL::Params_T3::kHits * tripletIndex + 2]; - pixelTripletsInGPU.hitIndices[::SDL::Params_pT3::kHits * pixelTripletIndex + 7] = - tripletsInGPU.hitIndices[::SDL::Params_T3::kHits * tripletIndex + 3]; - pixelTripletsInGPU.hitIndices[::SDL::Params_pT3::kHits * pixelTripletIndex + 8] = - tripletsInGPU.hitIndices[::SDL::Params_T3::kHits * tripletIndex + 4]; - pixelTripletsInGPU.hitIndices[::SDL::Params_pT3::kHits * pixelTripletIndex + 9] = - tripletsInGPU.hitIndices[::SDL::Params_T3::kHits * tripletIndex + 5]; + pixelTripletsInGPU.hitIndices[Params_pT3::kHits * pixelTripletIndex] = mdsInGPU.anchorHitIndices[pixelInnerMD]; + pixelTripletsInGPU.hitIndices[Params_pT3::kHits * pixelTripletIndex + 1] = mdsInGPU.outerHitIndices[pixelInnerMD]; + pixelTripletsInGPU.hitIndices[Params_pT3::kHits * pixelTripletIndex + 2] = mdsInGPU.anchorHitIndices[pixelOuterMD]; + pixelTripletsInGPU.hitIndices[Params_pT3::kHits * pixelTripletIndex + 3] = mdsInGPU.outerHitIndices[pixelOuterMD]; + + pixelTripletsInGPU.hitIndices[Params_pT3::kHits * pixelTripletIndex + 4] = + tripletsInGPU.hitIndices[Params_T3::kHits * tripletIndex]; + pixelTripletsInGPU.hitIndices[Params_pT3::kHits * pixelTripletIndex + 5] = + tripletsInGPU.hitIndices[Params_T3::kHits * tripletIndex + 1]; + pixelTripletsInGPU.hitIndices[Params_pT3::kHits * pixelTripletIndex + 6] = + tripletsInGPU.hitIndices[Params_T3::kHits * tripletIndex + 2]; + pixelTripletsInGPU.hitIndices[Params_pT3::kHits * pixelTripletIndex + 7] = + tripletsInGPU.hitIndices[Params_T3::kHits * tripletIndex + 3]; + pixelTripletsInGPU.hitIndices[Params_pT3::kHits * pixelTripletIndex + 8] = + tripletsInGPU.hitIndices[Params_T3::kHits * tripletIndex + 4]; + pixelTripletsInGPU.hitIndices[Params_pT3::kHits * pixelTripletIndex + 9] = + tripletsInGPU.hitIndices[Params_T3::kHits * tripletIndex + 5]; pixelTripletsInGPU.rPhiChiSquared[pixelTripletIndex] = rPhiChiSquared; pixelTripletsInGPU.rPhiChiSquaredInwards[pixelTripletIndex] = rPhiChiSquaredInwards; pixelTripletsInGPU.rzChiSquared[pixelTripletIndex] = rzChiSquared; @@ -247,11 +247,11 @@ namespace ALPAKA_ACCELERATOR_NAMESPACE::SDL { short outerInnerLowerModuleSubdet = modulesInGPU.subdets[outerInnerLowerModuleIndex]; short outerOuterLowerModuleSubdet = modulesInGPU.subdets[outerOuterLowerModuleIndex]; - unsigned int firstMDIndex = segmentsInGPU.mdIndices[::SDL::Params_LS::kLayers * innerSegmentIndex]; - unsigned int secondMDIndex = segmentsInGPU.mdIndices[::SDL::Params_LS::kLayers * innerSegmentIndex + 1]; + unsigned int firstMDIndex = segmentsInGPU.mdIndices[Params_LS::kLayers * innerSegmentIndex]; + unsigned int secondMDIndex = segmentsInGPU.mdIndices[Params_LS::kLayers * innerSegmentIndex + 1]; - unsigned int thirdMDIndex = segmentsInGPU.mdIndices[::SDL::Params_LS::kLayers * outerSegmentIndex]; - unsigned int fourthMDIndex = segmentsInGPU.mdIndices[::SDL::Params_LS::kLayers * outerSegmentIndex + 1]; + unsigned int thirdMDIndex = segmentsInGPU.mdIndices[Params_LS::kLayers * outerSegmentIndex]; + unsigned int fourthMDIndex = segmentsInGPU.mdIndices[Params_LS::kLayers * outerSegmentIndex + 1]; if (outerInnerLowerModuleSubdet == SDL::Barrel and (outerOuterLowerModuleSubdet == SDL::Barrel or outerOuterLowerModuleSubdet == SDL::Endcap)) { @@ -765,7 +765,7 @@ namespace ALPAKA_ACCELERATOR_NAMESPACE::SDL { float a = -2.f * k2Rinv1GeVf * 100 * charge; // multiply by 100 to make the correct length units - for (size_t i = 0; i < ::SDL::Params_T3::kLayers; i++) { + for (size_t i = 0; i < Params_T3::kLayers; i++) { float zsi = zs[i] / 100; float rtsi = rts[i] / 100; uint16_t lowerModuleIndex = lowerModuleIndices[i]; @@ -845,9 +845,9 @@ namespace ALPAKA_ACCELERATOR_NAMESPACE::SDL { //run pT4 compatibility between the pixel segment and inner segment, and between the pixel and outer segment of the triplet uint16_t pixelModuleIndex = segmentsInGPU.innerLowerModuleIndices[pixelSegmentIndex]; - uint16_t lowerModuleIndex = tripletsInGPU.lowerModuleIndices[::SDL::Params_T3::kLayers * tripletIndex]; - uint16_t middleModuleIndex = tripletsInGPU.lowerModuleIndices[::SDL::Params_T3::kLayers * tripletIndex + 1]; - uint16_t upperModuleIndex = tripletsInGPU.lowerModuleIndices[::SDL::Params_T3::kLayers * tripletIndex + 2]; + uint16_t lowerModuleIndex = tripletsInGPU.lowerModuleIndices[Params_T3::kLayers * tripletIndex]; + uint16_t middleModuleIndex = tripletsInGPU.lowerModuleIndices[Params_T3::kLayers * tripletIndex + 1]; + uint16_t upperModuleIndex = tripletsInGPU.lowerModuleIndices[Params_T3::kLayers * tripletIndex + 2]; { //placeholder @@ -864,7 +864,7 @@ namespace ALPAKA_ACCELERATOR_NAMESPACE::SDL { lowerModuleIndex, middleModuleIndex, pixelSegmentIndex, - tripletsInGPU.segmentIndices[::SDL::Params_LS::kLayers * tripletIndex], + tripletsInGPU.segmentIndices[Params_LS::kLayers * tripletIndex], zOut, rtOut, deltaPhiPos, @@ -895,7 +895,7 @@ namespace ALPAKA_ACCELERATOR_NAMESPACE::SDL { middleModuleIndex, upperModuleIndex, pixelSegmentIndex, - tripletsInGPU.segmentIndices[::SDL::Params_LS::kLayers * tripletIndex + 1], + tripletsInGPU.segmentIndices[Params_LS::kLayers * tripletIndex + 1], zOut, rtOut, deltaPhiPos, @@ -930,8 +930,8 @@ namespace ALPAKA_ACCELERATOR_NAMESPACE::SDL { float pixelF = segmentsInGPU.circleCenterY[pixelSegmentArrayIndex]; float pixelRadiusPCA = segmentsInGPU.circleRadius[pixelSegmentArrayIndex]; - unsigned int pixelInnerMDIndex = segmentsInGPU.mdIndices[::SDL::Params_pLS::kLayers * pixelSegmentIndex]; - unsigned int pixelOuterMDIndex = segmentsInGPU.mdIndices[::SDL::Params_pLS::kLayers * pixelSegmentIndex + 1]; + unsigned int pixelInnerMDIndex = segmentsInGPU.mdIndices[Params_pLS::kLayers * pixelSegmentIndex]; + unsigned int pixelOuterMDIndex = segmentsInGPU.mdIndices[Params_pLS::kLayers * pixelSegmentIndex + 1]; pixelRadius = pixelSegmentPt * kR1GeVf; pixelRadiusError = pixelSegmentPtError * kR1GeVf; @@ -942,9 +942,9 @@ namespace ALPAKA_ACCELERATOR_NAMESPACE::SDL { unsigned int secondMDIndex = segmentsInGPU.mdIndices[2 * tripletInnerSegmentIndex + 1]; unsigned int thirdMDIndex = segmentsInGPU.mdIndices[2 * tripletOuterSegmentIndex + 1]; - float xs[::SDL::Params_T3::kLayers] = { + float xs[Params_T3::kLayers] = { mdsInGPU.anchorX[firstMDIndex], mdsInGPU.anchorX[secondMDIndex], mdsInGPU.anchorX[thirdMDIndex]}; - float ys[::SDL::Params_T3::kLayers] = { + float ys[Params_T3::kLayers] = { mdsInGPU.anchorY[firstMDIndex], mdsInGPU.anchorY[secondMDIndex], mdsInGPU.anchorY[thirdMDIndex]}; float g, f; @@ -962,17 +962,17 @@ namespace ALPAKA_ACCELERATOR_NAMESPACE::SDL { upperModuleIndex)) return false; - uint16_t lowerModuleIndices[::SDL::Params_T3::kLayers] = {lowerModuleIndex, middleModuleIndex, upperModuleIndex}; + uint16_t lowerModuleIndices[Params_T3::kLayers] = {lowerModuleIndex, middleModuleIndex, upperModuleIndex}; if (runChiSquaredCuts and pixelSegmentPt < 5.0f) { - float rts[::SDL::Params_T3::kLayers] = { + float rts[Params_T3::kLayers] = { mdsInGPU.anchorRt[firstMDIndex], mdsInGPU.anchorRt[secondMDIndex], mdsInGPU.anchorRt[thirdMDIndex]}; - float zs[::SDL::Params_T3::kLayers] = { + float zs[Params_T3::kLayers] = { mdsInGPU.anchorZ[firstMDIndex], mdsInGPU.anchorZ[secondMDIndex], mdsInGPU.anchorZ[thirdMDIndex]}; - float rtPix[::SDL::Params_pLS::kLayers] = {mdsInGPU.anchorRt[pixelInnerMDIndex], mdsInGPU.anchorRt[pixelOuterMDIndex]}; - float xPix[::SDL::Params_pLS::kLayers] = {mdsInGPU.anchorX[pixelInnerMDIndex], mdsInGPU.anchorX[pixelOuterMDIndex]}; - float yPix[::SDL::Params_pLS::kLayers] = {mdsInGPU.anchorY[pixelInnerMDIndex], mdsInGPU.anchorY[pixelOuterMDIndex]}; - float zPix[::SDL::Params_pLS::kLayers] = {mdsInGPU.anchorZ[pixelInnerMDIndex], mdsInGPU.anchorZ[pixelOuterMDIndex]}; + float rtPix[Params_pLS::kLayers] = {mdsInGPU.anchorRt[pixelInnerMDIndex], mdsInGPU.anchorRt[pixelOuterMDIndex]}; + float xPix[Params_pLS::kLayers] = {mdsInGPU.anchorX[pixelInnerMDIndex], mdsInGPU.anchorX[pixelOuterMDIndex]}; + float yPix[Params_pLS::kLayers] = {mdsInGPU.anchorY[pixelInnerMDIndex], mdsInGPU.anchorY[pixelOuterMDIndex]}; + float zPix[Params_pLS::kLayers] = {mdsInGPU.anchorZ[pixelInnerMDIndex], mdsInGPU.anchorZ[pixelOuterMDIndex]}; rzChiSquared = computePT3RZChiSquared(acc, modulesInGPU, @@ -1006,8 +1006,8 @@ namespace ALPAKA_ACCELERATOR_NAMESPACE::SDL { return false; } - float xPix[::SDL::Params_pLS::kLayers] = {mdsInGPU.anchorX[pixelInnerMDIndex], mdsInGPU.anchorX[pixelOuterMDIndex]}; - float yPix[::SDL::Params_pLS::kLayers] = {mdsInGPU.anchorY[pixelInnerMDIndex], mdsInGPU.anchorY[pixelOuterMDIndex]}; + float xPix[Params_pLS::kLayers] = {mdsInGPU.anchorX[pixelInnerMDIndex], mdsInGPU.anchorX[pixelOuterMDIndex]}; + float yPix[Params_pLS::kLayers] = {mdsInGPU.anchorY[pixelInnerMDIndex], mdsInGPU.anchorY[pixelOuterMDIndex]}; rPhiChiSquaredInwards = computePT3RPhiChiSquaredInwards(modulesInGPU, g, f, tripletRadius, xPix, yPix); if (runChiSquaredCuts and pixelSegmentPt < 5.0f) { @@ -1123,7 +1123,7 @@ namespace ALPAKA_ACCELERATOR_NAMESPACE::SDL { float score = rPhiChiSquared + rPhiChiSquaredInwards; unsigned int totOccupancyPixelTriplets = alpaka::atomicOp(acc, pixelTripletsInGPU.totOccupancyPixelTriplets, 1u); - if (totOccupancyPixelTriplets >= ::SDL::N_MAX_PIXEL_TRIPLETS) { + if (totOccupancyPixelTriplets >= N_MAX_PIXEL_TRIPLETS) { #ifdef Warnings printf("Pixel Triplet excess alert!\n"); #endif @@ -1828,7 +1828,7 @@ namespace ALPAKA_ACCELERATOR_NAMESPACE::SDL { #define PixelQuintuplet_cuh #include "RecoTracker/LSTCore/interface/alpaka/Constants.h" -#include "RecoTracker/LSTCore/interface/alpaka/Module.h" +#include "RecoTracker/LSTCore/interface/Module.h" #include "Segment.h" #include "MiniDoublet.h" @@ -1837,7 +1837,7 @@ namespace ALPAKA_ACCELERATOR_NAMESPACE::SDL { #include "Quintuplet.h" #include "PixelTriplet.h" -namespace ALPAKA_ACCELERATOR_NAMESPACE::SDL { +namespace SDL { struct pixelQuintuplets { unsigned int* pixelIndices; unsigned int* T5Indices; @@ -1912,9 +1912,9 @@ namespace ALPAKA_ACCELERATOR_NAMESPACE::SDL { score_buf(allocBufWrapper(devAccIn, maxPixelQuintuplets, queue)), eta_buf(allocBufWrapper(devAccIn, maxPixelQuintuplets, queue)), phi_buf(allocBufWrapper(devAccIn, maxPixelQuintuplets, queue)), - logicalLayers_buf(allocBufWrapper(devAccIn, maxPixelQuintuplets * ::SDL::Params_pT5::kLayers, queue)), - hitIndices_buf(allocBufWrapper(devAccIn, maxPixelQuintuplets * ::SDL::Params_pT5::kHits, queue)), - lowerModuleIndices_buf(allocBufWrapper(devAccIn, maxPixelQuintuplets * ::SDL::Params_pT5::kLayers, queue)), + logicalLayers_buf(allocBufWrapper(devAccIn, maxPixelQuintuplets * Params_pT5::kLayers, queue)), + hitIndices_buf(allocBufWrapper(devAccIn, maxPixelQuintuplets * Params_pT5::kHits, queue)), + lowerModuleIndices_buf(allocBufWrapper(devAccIn, maxPixelQuintuplets * Params_pT5::kLayers, queue)), pixelRadius_buf(allocBufWrapper(devAccIn, maxPixelQuintuplets, queue)), quintupletRadius_buf(allocBufWrapper(devAccIn, maxPixelQuintuplets, queue)), centerX_buf(allocBufWrapper(devAccIn, maxPixelQuintuplets, queue)), @@ -1958,66 +1958,66 @@ namespace ALPAKA_ACCELERATOR_NAMESPACE::SDL { pixelQuintupletsInGPU.centerX[pixelQuintupletIndex] = __F2H(centerX); pixelQuintupletsInGPU.centerY[pixelQuintupletIndex] = __F2H(centerY); - pixelQuintupletsInGPU.logicalLayers[::SDL::Params_pT5::kLayers * pixelQuintupletIndex] = 0; - pixelQuintupletsInGPU.logicalLayers[::SDL::Params_pT5::kLayers * pixelQuintupletIndex + 1] = 0; - pixelQuintupletsInGPU.logicalLayers[::SDL::Params_pT5::kLayers * pixelQuintupletIndex + 2] = - quintupletsInGPU.logicalLayers[T5Index * ::SDL::Params_T5::kLayers]; - pixelQuintupletsInGPU.logicalLayers[::SDL::Params_pT5::kLayers * pixelQuintupletIndex + 3] = - quintupletsInGPU.logicalLayers[T5Index * ::SDL::Params_T5::kLayers + 1]; - pixelQuintupletsInGPU.logicalLayers[::SDL::Params_pT5::kLayers * pixelQuintupletIndex + 4] = - quintupletsInGPU.logicalLayers[T5Index * ::SDL::Params_T5::kLayers + 2]; - pixelQuintupletsInGPU.logicalLayers[::SDL::Params_pT5::kLayers * pixelQuintupletIndex + 5] = - quintupletsInGPU.logicalLayers[T5Index * ::SDL::Params_T5::kLayers + 3]; - pixelQuintupletsInGPU.logicalLayers[::SDL::Params_pT5::kLayers * pixelQuintupletIndex + 6] = - quintupletsInGPU.logicalLayers[T5Index * ::SDL::Params_T5::kLayers + 4]; - - pixelQuintupletsInGPU.lowerModuleIndices[::SDL::Params_pT5::kLayers * pixelQuintupletIndex] = + pixelQuintupletsInGPU.logicalLayers[Params_pT5::kLayers * pixelQuintupletIndex] = 0; + pixelQuintupletsInGPU.logicalLayers[Params_pT5::kLayers * pixelQuintupletIndex + 1] = 0; + pixelQuintupletsInGPU.logicalLayers[Params_pT5::kLayers * pixelQuintupletIndex + 2] = + quintupletsInGPU.logicalLayers[T5Index * Params_T5::kLayers]; + pixelQuintupletsInGPU.logicalLayers[Params_pT5::kLayers * pixelQuintupletIndex + 3] = + quintupletsInGPU.logicalLayers[T5Index * Params_T5::kLayers + 1]; + pixelQuintupletsInGPU.logicalLayers[Params_pT5::kLayers * pixelQuintupletIndex + 4] = + quintupletsInGPU.logicalLayers[T5Index * Params_T5::kLayers + 2]; + pixelQuintupletsInGPU.logicalLayers[Params_pT5::kLayers * pixelQuintupletIndex + 5] = + quintupletsInGPU.logicalLayers[T5Index * Params_T5::kLayers + 3]; + pixelQuintupletsInGPU.logicalLayers[Params_pT5::kLayers * pixelQuintupletIndex + 6] = + quintupletsInGPU.logicalLayers[T5Index * Params_T5::kLayers + 4]; + + pixelQuintupletsInGPU.lowerModuleIndices[Params_pT5::kLayers * pixelQuintupletIndex] = segmentsInGPU.innerLowerModuleIndices[pixelIndex]; - pixelQuintupletsInGPU.lowerModuleIndices[::SDL::Params_pT5::kLayers * pixelQuintupletIndex + 1] = + pixelQuintupletsInGPU.lowerModuleIndices[Params_pT5::kLayers * pixelQuintupletIndex + 1] = segmentsInGPU.outerLowerModuleIndices[pixelIndex]; - pixelQuintupletsInGPU.lowerModuleIndices[::SDL::Params_pT5::kLayers * pixelQuintupletIndex + 2] = - quintupletsInGPU.lowerModuleIndices[T5Index * ::SDL::Params_T5::kLayers]; - pixelQuintupletsInGPU.lowerModuleIndices[::SDL::Params_pT5::kLayers * pixelQuintupletIndex + 3] = - quintupletsInGPU.lowerModuleIndices[T5Index * ::SDL::Params_T5::kLayers + 1]; - pixelQuintupletsInGPU.lowerModuleIndices[::SDL::Params_pT5::kLayers * pixelQuintupletIndex + 4] = - quintupletsInGPU.lowerModuleIndices[T5Index * ::SDL::Params_T5::kLayers + 2]; - pixelQuintupletsInGPU.lowerModuleIndices[::SDL::Params_pT5::kLayers * pixelQuintupletIndex + 5] = - quintupletsInGPU.lowerModuleIndices[T5Index * ::SDL::Params_T5::kLayers + 3]; - pixelQuintupletsInGPU.lowerModuleIndices[::SDL::Params_pT5::kLayers * pixelQuintupletIndex + 6] = - quintupletsInGPU.lowerModuleIndices[T5Index * ::SDL::Params_T5::kLayers + 4]; - - unsigned int pixelInnerMD = segmentsInGPU.mdIndices[::SDL::Params_pLS::kLayers * pixelIndex]; - unsigned int pixelOuterMD = segmentsInGPU.mdIndices[::SDL::Params_pLS::kLayers * pixelIndex + 1]; - - pixelQuintupletsInGPU.hitIndices[::SDL::Params_pT5::kHits * pixelQuintupletIndex] = + pixelQuintupletsInGPU.lowerModuleIndices[Params_pT5::kLayers * pixelQuintupletIndex + 2] = + quintupletsInGPU.lowerModuleIndices[T5Index * Params_T5::kLayers]; + pixelQuintupletsInGPU.lowerModuleIndices[Params_pT5::kLayers * pixelQuintupletIndex + 3] = + quintupletsInGPU.lowerModuleIndices[T5Index * Params_T5::kLayers + 1]; + pixelQuintupletsInGPU.lowerModuleIndices[Params_pT5::kLayers * pixelQuintupletIndex + 4] = + quintupletsInGPU.lowerModuleIndices[T5Index * Params_T5::kLayers + 2]; + pixelQuintupletsInGPU.lowerModuleIndices[Params_pT5::kLayers * pixelQuintupletIndex + 5] = + quintupletsInGPU.lowerModuleIndices[T5Index * Params_T5::kLayers + 3]; + pixelQuintupletsInGPU.lowerModuleIndices[Params_pT5::kLayers * pixelQuintupletIndex + 6] = + quintupletsInGPU.lowerModuleIndices[T5Index * Params_T5::kLayers + 4]; + + unsigned int pixelInnerMD = segmentsInGPU.mdIndices[Params_pLS::kLayers * pixelIndex]; + unsigned int pixelOuterMD = segmentsInGPU.mdIndices[Params_pLS::kLayers * pixelIndex + 1]; + + pixelQuintupletsInGPU.hitIndices[Params_pT5::kHits * pixelQuintupletIndex] = mdsInGPU.anchorHitIndices[pixelInnerMD]; - pixelQuintupletsInGPU.hitIndices[::SDL::Params_pT5::kHits * pixelQuintupletIndex + 1] = + pixelQuintupletsInGPU.hitIndices[Params_pT5::kHits * pixelQuintupletIndex + 1] = mdsInGPU.outerHitIndices[pixelInnerMD]; - pixelQuintupletsInGPU.hitIndices[::SDL::Params_pT5::kHits * pixelQuintupletIndex + 2] = + pixelQuintupletsInGPU.hitIndices[Params_pT5::kHits * pixelQuintupletIndex + 2] = mdsInGPU.anchorHitIndices[pixelOuterMD]; - pixelQuintupletsInGPU.hitIndices[::SDL::Params_pT5::kHits * pixelQuintupletIndex + 3] = + pixelQuintupletsInGPU.hitIndices[Params_pT5::kHits * pixelQuintupletIndex + 3] = mdsInGPU.outerHitIndices[pixelOuterMD]; - pixelQuintupletsInGPU.hitIndices[::SDL::Params_pT5::kHits * pixelQuintupletIndex + 4] = - quintupletsInGPU.hitIndices[::SDL::Params_T5::kHits * T5Index]; - pixelQuintupletsInGPU.hitIndices[::SDL::Params_pT5::kHits * pixelQuintupletIndex + 5] = - quintupletsInGPU.hitIndices[::SDL::Params_T5::kHits * T5Index + 1]; - pixelQuintupletsInGPU.hitIndices[::SDL::Params_pT5::kHits * pixelQuintupletIndex + 6] = - quintupletsInGPU.hitIndices[::SDL::Params_T5::kHits * T5Index + 2]; - pixelQuintupletsInGPU.hitIndices[::SDL::Params_pT5::kHits * pixelQuintupletIndex + 7] = - quintupletsInGPU.hitIndices[::SDL::Params_T5::kHits * T5Index + 3]; - pixelQuintupletsInGPU.hitIndices[::SDL::Params_pT5::kHits * pixelQuintupletIndex + 8] = - quintupletsInGPU.hitIndices[::SDL::Params_T5::kHits * T5Index + 4]; - pixelQuintupletsInGPU.hitIndices[::SDL::Params_pT5::kHits * pixelQuintupletIndex + 9] = - quintupletsInGPU.hitIndices[::SDL::Params_T5::kHits * T5Index + 5]; - pixelQuintupletsInGPU.hitIndices[::SDL::Params_pT5::kHits * pixelQuintupletIndex + 10] = - quintupletsInGPU.hitIndices[::SDL::Params_T5::kHits * T5Index + 6]; - pixelQuintupletsInGPU.hitIndices[::SDL::Params_pT5::kHits * pixelQuintupletIndex + 11] = - quintupletsInGPU.hitIndices[::SDL::Params_T5::kHits * T5Index + 7]; - pixelQuintupletsInGPU.hitIndices[::SDL::Params_pT5::kHits * pixelQuintupletIndex + 12] = - quintupletsInGPU.hitIndices[::SDL::Params_T5::kHits * T5Index + 8]; - pixelQuintupletsInGPU.hitIndices[::SDL::Params_pT5::kHits * pixelQuintupletIndex + 13] = - quintupletsInGPU.hitIndices[::SDL::Params_T5::kHits * T5Index + 9]; + pixelQuintupletsInGPU.hitIndices[Params_pT5::kHits * pixelQuintupletIndex + 4] = + quintupletsInGPU.hitIndices[Params_T5::kHits * T5Index]; + pixelQuintupletsInGPU.hitIndices[Params_pT5::kHits * pixelQuintupletIndex + 5] = + quintupletsInGPU.hitIndices[Params_T5::kHits * T5Index + 1]; + pixelQuintupletsInGPU.hitIndices[Params_pT5::kHits * pixelQuintupletIndex + 6] = + quintupletsInGPU.hitIndices[Params_T5::kHits * T5Index + 2]; + pixelQuintupletsInGPU.hitIndices[Params_pT5::kHits * pixelQuintupletIndex + 7] = + quintupletsInGPU.hitIndices[Params_T5::kHits * T5Index + 3]; + pixelQuintupletsInGPU.hitIndices[Params_pT5::kHits * pixelQuintupletIndex + 8] = + quintupletsInGPU.hitIndices[Params_T5::kHits * T5Index + 4]; + pixelQuintupletsInGPU.hitIndices[Params_pT5::kHits * pixelQuintupletIndex + 9] = + quintupletsInGPU.hitIndices[Params_T5::kHits * T5Index + 5]; + pixelQuintupletsInGPU.hitIndices[Params_pT5::kHits * pixelQuintupletIndex + 10] = + quintupletsInGPU.hitIndices[Params_T5::kHits * T5Index + 6]; + pixelQuintupletsInGPU.hitIndices[Params_pT5::kHits * pixelQuintupletIndex + 11] = + quintupletsInGPU.hitIndices[Params_T5::kHits * T5Index + 7]; + pixelQuintupletsInGPU.hitIndices[Params_pT5::kHits * pixelQuintupletIndex + 12] = + quintupletsInGPU.hitIndices[Params_T5::kHits * T5Index + 8]; + pixelQuintupletsInGPU.hitIndices[Params_pT5::kHits * pixelQuintupletIndex + 13] = + quintupletsInGPU.hitIndices[Params_T5::kHits * T5Index + 9]; pixelQuintupletsInGPU.rzChiSquared[pixelQuintupletIndex] = rzChiSquared; pixelQuintupletsInGPU.rPhiChiSquared[pixelQuintupletIndex] = rPhiChiSquared; @@ -2520,23 +2520,23 @@ namespace ALPAKA_ACCELERATOR_NAMESPACE::SDL { unsigned int fourthMDIndex = segmentsInGPU.mdIndices[2 * thirdSegmentIndex + 1]; unsigned int fifthMDIndex = segmentsInGPU.mdIndices[2 * fourthSegmentIndex + 1]; - uint16_t lowerModuleIndex1 = quintupletsInGPU.lowerModuleIndices[::SDL::Params_T5::kLayers * quintupletIndex]; - uint16_t lowerModuleIndex2 = quintupletsInGPU.lowerModuleIndices[::SDL::Params_T5::kLayers * quintupletIndex + 1]; - uint16_t lowerModuleIndex3 = quintupletsInGPU.lowerModuleIndices[::SDL::Params_T5::kLayers * quintupletIndex + 2]; - uint16_t lowerModuleIndex4 = quintupletsInGPU.lowerModuleIndices[::SDL::Params_T5::kLayers * quintupletIndex + 3]; - uint16_t lowerModuleIndex5 = quintupletsInGPU.lowerModuleIndices[::SDL::Params_T5::kLayers * quintupletIndex + 4]; + uint16_t lowerModuleIndex1 = quintupletsInGPU.lowerModuleIndices[Params_T5::kLayers * quintupletIndex]; + uint16_t lowerModuleIndex2 = quintupletsInGPU.lowerModuleIndices[Params_T5::kLayers * quintupletIndex + 1]; + uint16_t lowerModuleIndex3 = quintupletsInGPU.lowerModuleIndices[Params_T5::kLayers * quintupletIndex + 2]; + uint16_t lowerModuleIndex4 = quintupletsInGPU.lowerModuleIndices[Params_T5::kLayers * quintupletIndex + 3]; + uint16_t lowerModuleIndex5 = quintupletsInGPU.lowerModuleIndices[Params_T5::kLayers * quintupletIndex + 4]; - uint16_t lowerModuleIndices[::SDL::Params_T5::kLayers] = { + uint16_t lowerModuleIndices[Params_T5::kLayers] = { lowerModuleIndex1, lowerModuleIndex2, lowerModuleIndex3, lowerModuleIndex4, lowerModuleIndex5}; - float zPix[::SDL::Params_pLS::kLayers] = {mdsInGPU.anchorZ[pixelInnerMDIndex], mdsInGPU.anchorZ[pixelOuterMDIndex]}; - float rtPix[::SDL::Params_pLS::kLayers] = {mdsInGPU.anchorRt[pixelInnerMDIndex], mdsInGPU.anchorRt[pixelOuterMDIndex]}; - float zs[::SDL::Params_T5::kLayers] = {mdsInGPU.anchorZ[firstMDIndex], + float zPix[Params_pLS::kLayers] = {mdsInGPU.anchorZ[pixelInnerMDIndex], mdsInGPU.anchorZ[pixelOuterMDIndex]}; + float rtPix[Params_pLS::kLayers] = {mdsInGPU.anchorRt[pixelInnerMDIndex], mdsInGPU.anchorRt[pixelOuterMDIndex]}; + float zs[Params_T5::kLayers] = {mdsInGPU.anchorZ[firstMDIndex], mdsInGPU.anchorZ[secondMDIndex], mdsInGPU.anchorZ[thirdMDIndex], mdsInGPU.anchorZ[fourthMDIndex], mdsInGPU.anchorZ[fifthMDIndex]}; - float rts[::SDL::Params_T5::kLayers] = {mdsInGPU.anchorRt[firstMDIndex], + float rts[Params_T5::kLayers] = {mdsInGPU.anchorRt[firstMDIndex], mdsInGPU.anchorRt[secondMDIndex], mdsInGPU.anchorRt[thirdMDIndex], mdsInGPU.anchorRt[fourthMDIndex], @@ -2556,12 +2556,12 @@ namespace ALPAKA_ACCELERATOR_NAMESPACE::SDL { } //outer T5 - float xs[::SDL::Params_T5::kLayers] = {mdsInGPU.anchorX[firstMDIndex], + float xs[Params_T5::kLayers] = {mdsInGPU.anchorX[firstMDIndex], mdsInGPU.anchorX[secondMDIndex], mdsInGPU.anchorX[thirdMDIndex], mdsInGPU.anchorX[fourthMDIndex], mdsInGPU.anchorX[fifthMDIndex]}; - float ys[::SDL::Params_T5::kLayers] = {mdsInGPU.anchorY[firstMDIndex], + float ys[Params_T5::kLayers] = {mdsInGPU.anchorY[firstMDIndex], mdsInGPU.anchorY[secondMDIndex], mdsInGPU.anchorY[thirdMDIndex], mdsInGPU.anchorY[fourthMDIndex], @@ -2628,7 +2628,7 @@ namespace ALPAKA_ACCELERATOR_NAMESPACE::SDL { float error2 = 0; //hardcoded array indices!!! float RMSE = 0; - for (size_t i = 0; i < ::SDL::Params_T5::kLayers; i++) { + for (size_t i = 0; i < Params_T5::kLayers; i++) { uint16_t& lowerModuleIndex = lowerModuleIndices[i]; const int moduleType = modulesInGPU.moduleType[lowerModuleIndex]; const int moduleSide = modulesInGPU.sides[lowerModuleIndex]; @@ -2726,7 +2726,7 @@ namespace ALPAKA_ACCELERATOR_NAMESPACE::SDL { if (success) { unsigned int totOccupancyPixelQuintuplets = alpaka::atomicOp(acc, pixelQuintupletsInGPU.totOccupancyPixelQuintuplets, 1u); - if (totOccupancyPixelQuintuplets >= ::SDL::N_MAX_PIXEL_QUINTUPLETS) { + if (totOccupancyPixelQuintuplets >= N_MAX_PIXEL_QUINTUPLETS) { #ifdef Warnings printf("Pixel Quintuplet excess alert!\n"); #endif diff --git a/RecoTracker/LSTCore/src/alpaka/Quintuplet.h b/RecoTracker/LSTCore/src/alpaka/Quintuplet.h index 7b99879c583ce..f4368bac18d8f 100644 --- a/RecoTracker/LSTCore/src/alpaka/Quintuplet.h +++ b/RecoTracker/LSTCore/src/alpaka/Quintuplet.h @@ -2,7 +2,7 @@ #define Quintuplet_cuh #include "RecoTracker/LSTCore/interface/alpaka/Constants.h" -#include "RecoTracker/LSTCore/interface/alpaka/Module.h" +#include "RecoTracker/LSTCore/interface/Module.h" #include "RecoTracker/LSTCore/interface/EndcapGeometry.h" #include "NeuralNetwork.h" @@ -11,7 +11,7 @@ #include "Hit.h" #include "Triplet.h" -namespace ALPAKA_ACCELERATOR_NAMESPACE::SDL { +namespace SDL { struct quintuplets { unsigned int* tripletIndices; uint16_t* lowerModuleIndices; @@ -103,7 +103,7 @@ namespace ALPAKA_ACCELERATOR_NAMESPACE::SDL { template quintupletsBuffer(unsigned int nTotalQuintuplets, unsigned int nLowerModules, TDevAcc const& devAccIn, TQueue& queue) : tripletIndices_buf(allocBufWrapper(devAccIn, 2 * nTotalQuintuplets, queue)), - lowerModuleIndices_buf(allocBufWrapper(devAccIn, ::SDL::Params_T5::kLayers * nTotalQuintuplets, queue)), + lowerModuleIndices_buf(allocBufWrapper(devAccIn, Params_T5::kLayers * nTotalQuintuplets, queue)), nQuintuplets_buf(allocBufWrapper(devAccIn, nLowerModules, queue)), totOccupancyQuintuplets_buf(allocBufWrapper(devAccIn, nLowerModules, queue)), nMemoryLocations_buf(allocBufWrapper(devAccIn, 1, queue)), @@ -121,8 +121,8 @@ namespace ALPAKA_ACCELERATOR_NAMESPACE::SDL { regressionRadius_buf(allocBufWrapper(devAccIn, nTotalQuintuplets, queue)), regressionG_buf(allocBufWrapper(devAccIn, nTotalQuintuplets, queue)), regressionF_buf(allocBufWrapper(devAccIn, nTotalQuintuplets, queue)), - logicalLayers_buf(allocBufWrapper(devAccIn, ::SDL::Params_T5::kLayers * nTotalQuintuplets, queue)), - hitIndices_buf(allocBufWrapper(devAccIn, ::SDL::Params_T5::kHits * nTotalQuintuplets, queue)), + logicalLayers_buf(allocBufWrapper(devAccIn, Params_T5::kLayers * nTotalQuintuplets, queue)), + hitIndices_buf(allocBufWrapper(devAccIn, Params_T5::kHits * nTotalQuintuplets, queue)), rzChiSquared_buf(allocBufWrapper(devAccIn, nTotalQuintuplets, queue)), chiSquared_buf(allocBufWrapper(devAccIn, nTotalQuintuplets, queue)), nonAnchorChiSquared_buf(allocBufWrapper(devAccIn, nTotalQuintuplets, queue)) { @@ -170,11 +170,11 @@ namespace ALPAKA_ACCELERATOR_NAMESPACE::SDL { quintupletsInGPU.tripletIndices[2 * quintupletIndex] = innerTripletIndex; quintupletsInGPU.tripletIndices[2 * quintupletIndex + 1] = outerTripletIndex; - quintupletsInGPU.lowerModuleIndices[::SDL::Params_T5::kLayers * quintupletIndex] = lowerModule1; - quintupletsInGPU.lowerModuleIndices[::SDL::Params_T5::kLayers * quintupletIndex + 1] = lowerModule2; - quintupletsInGPU.lowerModuleIndices[::SDL::Params_T5::kLayers * quintupletIndex + 2] = lowerModule3; - quintupletsInGPU.lowerModuleIndices[::SDL::Params_T5::kLayers * quintupletIndex + 3] = lowerModule4; - quintupletsInGPU.lowerModuleIndices[::SDL::Params_T5::kLayers * quintupletIndex + 4] = lowerModule5; + quintupletsInGPU.lowerModuleIndices[Params_T5::kLayers * quintupletIndex] = lowerModule1; + quintupletsInGPU.lowerModuleIndices[Params_T5::kLayers * quintupletIndex + 1] = lowerModule2; + quintupletsInGPU.lowerModuleIndices[Params_T5::kLayers * quintupletIndex + 2] = lowerModule3; + quintupletsInGPU.lowerModuleIndices[Params_T5::kLayers * quintupletIndex + 3] = lowerModule4; + quintupletsInGPU.lowerModuleIndices[Params_T5::kLayers * quintupletIndex + 4] = lowerModule5; quintupletsInGPU.innerRadius[quintupletIndex] = __F2H(innerRadius); quintupletsInGPU.outerRadius[quintupletIndex] = __F2H(outerRadius); quintupletsInGPU.pt[quintupletIndex] = __F2H(pt); @@ -187,37 +187,37 @@ namespace ALPAKA_ACCELERATOR_NAMESPACE::SDL { quintupletsInGPU.regressionRadius[quintupletIndex] = regressionRadius; quintupletsInGPU.regressionG[quintupletIndex] = regressionG; quintupletsInGPU.regressionF[quintupletIndex] = regressionF; - quintupletsInGPU.logicalLayers[::SDL::Params_T5::kLayers * quintupletIndex] = - tripletsInGPU.logicalLayers[::SDL::Params_T3::kLayers * innerTripletIndex]; - quintupletsInGPU.logicalLayers[::SDL::Params_T5::kLayers * quintupletIndex + 1] = - tripletsInGPU.logicalLayers[::SDL::Params_T3::kLayers * innerTripletIndex + 1]; - quintupletsInGPU.logicalLayers[::SDL::Params_T5::kLayers * quintupletIndex + 2] = - tripletsInGPU.logicalLayers[::SDL::Params_T3::kLayers * innerTripletIndex + 2]; - quintupletsInGPU.logicalLayers[::SDL::Params_T5::kLayers * quintupletIndex + 3] = - tripletsInGPU.logicalLayers[::SDL::Params_T3::kLayers * outerTripletIndex + 1]; - quintupletsInGPU.logicalLayers[::SDL::Params_T5::kLayers * quintupletIndex + 4] = - tripletsInGPU.logicalLayers[::SDL::Params_T3::kLayers * outerTripletIndex + 2]; - - quintupletsInGPU.hitIndices[::SDL::Params_T5::kHits * quintupletIndex] = - tripletsInGPU.hitIndices[::SDL::Params_T3::kHits * innerTripletIndex]; - quintupletsInGPU.hitIndices[::SDL::Params_T5::kHits * quintupletIndex + 1] = - tripletsInGPU.hitIndices[::SDL::Params_T3::kHits * innerTripletIndex + 1]; - quintupletsInGPU.hitIndices[::SDL::Params_T5::kHits * quintupletIndex + 2] = - tripletsInGPU.hitIndices[::SDL::Params_T3::kHits * innerTripletIndex + 2]; - quintupletsInGPU.hitIndices[::SDL::Params_T5::kHits * quintupletIndex + 3] = - tripletsInGPU.hitIndices[::SDL::Params_T3::kHits * innerTripletIndex + 3]; - quintupletsInGPU.hitIndices[::SDL::Params_T5::kHits * quintupletIndex + 4] = - tripletsInGPU.hitIndices[::SDL::Params_T3::kHits * innerTripletIndex + 4]; - quintupletsInGPU.hitIndices[::SDL::Params_T5::kHits * quintupletIndex + 5] = - tripletsInGPU.hitIndices[::SDL::Params_T3::kHits * innerTripletIndex + 5]; - quintupletsInGPU.hitIndices[::SDL::Params_T5::kHits * quintupletIndex + 6] = - tripletsInGPU.hitIndices[::SDL::Params_T3::kHits * outerTripletIndex + 2]; - quintupletsInGPU.hitIndices[::SDL::Params_T5::kHits * quintupletIndex + 7] = - tripletsInGPU.hitIndices[::SDL::Params_T3::kHits * outerTripletIndex + 3]; - quintupletsInGPU.hitIndices[::SDL::Params_T5::kHits * quintupletIndex + 8] = - tripletsInGPU.hitIndices[::SDL::Params_T3::kHits * outerTripletIndex + 4]; - quintupletsInGPU.hitIndices[::SDL::Params_T5::kHits * quintupletIndex + 9] = - tripletsInGPU.hitIndices[::SDL::Params_T3::kHits * outerTripletIndex + 5]; + quintupletsInGPU.logicalLayers[Params_T5::kLayers * quintupletIndex] = + tripletsInGPU.logicalLayers[Params_T3::kLayers * innerTripletIndex]; + quintupletsInGPU.logicalLayers[Params_T5::kLayers * quintupletIndex + 1] = + tripletsInGPU.logicalLayers[Params_T3::kLayers * innerTripletIndex + 1]; + quintupletsInGPU.logicalLayers[Params_T5::kLayers * quintupletIndex + 2] = + tripletsInGPU.logicalLayers[Params_T3::kLayers * innerTripletIndex + 2]; + quintupletsInGPU.logicalLayers[Params_T5::kLayers * quintupletIndex + 3] = + tripletsInGPU.logicalLayers[Params_T3::kLayers * outerTripletIndex + 1]; + quintupletsInGPU.logicalLayers[Params_T5::kLayers * quintupletIndex + 4] = + tripletsInGPU.logicalLayers[Params_T3::kLayers * outerTripletIndex + 2]; + + quintupletsInGPU.hitIndices[Params_T5::kHits * quintupletIndex] = + tripletsInGPU.hitIndices[Params_T3::kHits * innerTripletIndex]; + quintupletsInGPU.hitIndices[Params_T5::kHits * quintupletIndex + 1] = + tripletsInGPU.hitIndices[Params_T3::kHits * innerTripletIndex + 1]; + quintupletsInGPU.hitIndices[Params_T5::kHits * quintupletIndex + 2] = + tripletsInGPU.hitIndices[Params_T3::kHits * innerTripletIndex + 2]; + quintupletsInGPU.hitIndices[Params_T5::kHits * quintupletIndex + 3] = + tripletsInGPU.hitIndices[Params_T3::kHits * innerTripletIndex + 3]; + quintupletsInGPU.hitIndices[Params_T5::kHits * quintupletIndex + 4] = + tripletsInGPU.hitIndices[Params_T3::kHits * innerTripletIndex + 4]; + quintupletsInGPU.hitIndices[Params_T5::kHits * quintupletIndex + 5] = + tripletsInGPU.hitIndices[Params_T3::kHits * innerTripletIndex + 5]; + quintupletsInGPU.hitIndices[Params_T5::kHits * quintupletIndex + 6] = + tripletsInGPU.hitIndices[Params_T3::kHits * outerTripletIndex + 2]; + quintupletsInGPU.hitIndices[Params_T5::kHits * quintupletIndex + 7] = + tripletsInGPU.hitIndices[Params_T3::kHits * outerTripletIndex + 3]; + quintupletsInGPU.hitIndices[Params_T5::kHits * quintupletIndex + 8] = + tripletsInGPU.hitIndices[Params_T3::kHits * outerTripletIndex + 4]; + quintupletsInGPU.hitIndices[Params_T5::kHits * quintupletIndex + 9] = + tripletsInGPU.hitIndices[Params_T3::kHits * outerTripletIndex + 5]; quintupletsInGPU.bridgeRadius[quintupletIndex] = bridgeRadius; quintupletsInGPU.rzChiSquared[quintupletIndex] = rzChiSquared; quintupletsInGPU.chiSquared[quintupletIndex] = rPhiChiSquared; @@ -2878,7 +2878,7 @@ namespace ALPAKA_ACCELERATOR_NAMESPACE::SDL { computeSigmasForRegression(acc, modulesInGPU, lowerModuleIndices, delta1, delta2, slopes, isFlat); regressionRadius = computeRadiusUsingRegression(acc, - ::SDL::Params_T5::kLayers, + Params_T5::kLayers, xVec, yVec, delta1, @@ -2927,7 +2927,7 @@ namespace ALPAKA_ACCELERATOR_NAMESPACE::SDL { //compute the other chisquared //non anchor is always shifted for tilted and endcap! - float nonAnchorDelta1[::SDL::Params_T5::kLayers], nonAnchorDelta2[::SDL::Params_T5::kLayers], nonAnchorSlopes[::SDL::Params_T5::kLayers]; + float nonAnchorDelta1[Params_T5::kLayers], nonAnchorDelta2[Params_T5::kLayers], nonAnchorSlopes[Params_T5::kLayers]; float nonAnchorxs[] = {mdsInGPU.outerX[firstMDIndex], mdsInGPU.outerX[secondMDIndex], mdsInGPU.outerX[thirdMDIndex], @@ -2946,10 +2946,10 @@ namespace ALPAKA_ACCELERATOR_NAMESPACE::SDL { nonAnchorDelta2, nonAnchorSlopes, isFlat, - ::SDL::Params_T5::kLayers, + Params_T5::kLayers, false); nonAnchorChiSquared = computeChiSquared(acc, - ::SDL::Params_T5::kLayers, + Params_T5::kLayers, nonAnchorxs, nonAnchorys, nonAnchorDelta1, @@ -2992,14 +2992,14 @@ namespace ALPAKA_ACCELERATOR_NAMESPACE::SDL { for (unsigned int innerTripletArrayIndex = globalThreadIdx[1]; innerTripletArrayIndex < nInnerTriplets; innerTripletArrayIndex += gridThreadExtent[1]) { unsigned int innerTripletIndex = rangesInGPU.tripletModuleIndices[lowerModule1] + innerTripletArrayIndex; - uint16_t lowerModule2 = tripletsInGPU.lowerModuleIndices[::SDL::Params_T3::kLayers * innerTripletIndex + 1]; - uint16_t lowerModule3 = tripletsInGPU.lowerModuleIndices[::SDL::Params_T3::kLayers * innerTripletIndex + 2]; + uint16_t lowerModule2 = tripletsInGPU.lowerModuleIndices[Params_T3::kLayers * innerTripletIndex + 1]; + uint16_t lowerModule3 = tripletsInGPU.lowerModuleIndices[Params_T3::kLayers * innerTripletIndex + 2]; unsigned int nOuterTriplets = tripletsInGPU.nTriplets[lowerModule3]; for (unsigned int outerTripletArrayIndex = globalThreadIdx[2]; outerTripletArrayIndex < nOuterTriplets; outerTripletArrayIndex += gridThreadExtent[2]) { unsigned int outerTripletIndex = rangesInGPU.tripletModuleIndices[lowerModule3] + outerTripletArrayIndex; - uint16_t lowerModule4 = tripletsInGPU.lowerModuleIndices[::SDL::Params_T3::kLayers * outerTripletIndex + 1]; - uint16_t lowerModule5 = tripletsInGPU.lowerModuleIndices[::SDL::Params_T3::kLayers * outerTripletIndex + 2]; + uint16_t lowerModule4 = tripletsInGPU.lowerModuleIndices[Params_T3::kLayers * outerTripletIndex + 1]; + uint16_t lowerModule5 = tripletsInGPU.lowerModuleIndices[Params_T3::kLayers * outerTripletIndex + 2]; float innerRadius, outerRadius, bridgeRadius, regressionG, regressionF, regressionRadius, rzChiSquared, chiSquared, nonAnchorChiSquared; //required for making distributions diff --git a/RecoTracker/LSTCore/src/alpaka/Segment.h b/RecoTracker/LSTCore/src/alpaka/Segment.h index 583bf7b1df4f0..3216afa7092e3 100644 --- a/RecoTracker/LSTCore/src/alpaka/Segment.h +++ b/RecoTracker/LSTCore/src/alpaka/Segment.h @@ -2,13 +2,13 @@ #define Segment_cuh #include "RecoTracker/LSTCore/interface/alpaka/Constants.h" -#include "RecoTracker/LSTCore/interface/alpaka/Module.h" +#include "RecoTracker/LSTCore/interface/Module.h" #include "RecoTracker/LSTCore/interface/EndcapGeometry.h" #include "MiniDoublet.h" #include "Hit.h" -namespace ALPAKA_ACCELERATOR_NAMESPACE::SDL { +namespace SDL { struct segments { FPX* dPhis; FPX* dPhiMins; @@ -794,7 +794,7 @@ namespace ALPAKA_ACCELERATOR_NAMESPACE::SDL { for (uint16_t outerLowerModuleArrayIdx = blockThreadIdx[1]; outerLowerModuleArrayIdx < nConnectedModules; outerLowerModuleArrayIdx += blockThreadExtent[1]) { uint16_t outerLowerModuleIndex = - modulesInGPU.moduleMap[innerLowerModuleIndex * ::SDL::MAX_CONNECTED_MODULES + outerLowerModuleArrayIdx]; + modulesInGPU.moduleMap[innerLowerModuleIndex * MAX_CONNECTED_MODULES + outerLowerModuleArrayIdx]; unsigned int nOuterMDs = mdsInGPU.nMDs[outerLowerModuleIndex]; @@ -1068,7 +1068,7 @@ namespace ALPAKA_ACCELERATOR_NAMESPACE::SDL { (hitsInGPU.zs[mdsInGPU.anchorHitIndices[outerMDIndex]]); score_lsq = score_lsq * score_lsq; - unsigned int hits1[::SDL::Params_pLS::kHits]; + unsigned int hits1[Params_pLS::kHits]; hits1[0] = hitsInGPU.idxs[mdsInGPU.anchorHitIndices[innerMDIndex]]; hits1[1] = hitsInGPU.idxs[mdsInGPU.anchorHitIndices[outerMDIndex]]; hits1[2] = hitsInGPU.idxs[mdsInGPU.outerHitIndices[innerMDIndex]]; diff --git a/RecoTracker/LSTCore/src/alpaka/TrackCandidate.h b/RecoTracker/LSTCore/src/alpaka/TrackCandidate.h index dc522b72f200b..fbf97c97c3c17 100644 --- a/RecoTracker/LSTCore/src/alpaka/TrackCandidate.h +++ b/RecoTracker/LSTCore/src/alpaka/TrackCandidate.h @@ -2,7 +2,7 @@ #define TrackCandidate_cuh #include "RecoTracker/LSTCore/interface/alpaka/Constants.h" -#include "RecoTracker/LSTCore/interface/alpaka/Module.h" +#include "RecoTracker/LSTCore/interface/Module.h" #include "Triplet.h" #include "Segment.h" @@ -11,7 +11,7 @@ #include "Quintuplet.h" #include "Hit.h" -namespace ALPAKA_ACCELERATOR_NAMESPACE::SDL { +namespace SDL { struct trackCandidates { short* trackCandidateType; // 4-T5 5-pT3 7-pT5 8-pLS unsigned int* directObjectIndices; // Will hold direct indices to each type containers @@ -83,10 +83,10 @@ namespace ALPAKA_ACCELERATOR_NAMESPACE::SDL { nTrackCandidatespT5_buf(allocBufWrapper(devAccIn, 1, queue)), nTrackCandidatespLS_buf(allocBufWrapper(devAccIn, 1, queue)), nTrackCandidatesT5_buf(allocBufWrapper(devAccIn, 1, queue)), - logicalLayers_buf(allocBufWrapper(devAccIn, ::SDL::Params_pT5::kLayers * maxTrackCandidates, queue)), - hitIndices_buf(allocBufWrapper(devAccIn, ::SDL::Params_pT5::kHits * maxTrackCandidates, queue)), + logicalLayers_buf(allocBufWrapper(devAccIn, Params_pT5::kLayers * maxTrackCandidates, queue)), + hitIndices_buf(allocBufWrapper(devAccIn, Params_pT5::kHits * maxTrackCandidates, queue)), pixelSeedIndex_buf(allocBufWrapper(devAccIn, maxTrackCandidates, queue)), - lowerModuleIndices_buf(allocBufWrapper(devAccIn, ::SDL::Params_pT5::kLayers * maxTrackCandidates, queue)), + lowerModuleIndices_buf(allocBufWrapper(devAccIn, Params_pT5::kLayers * maxTrackCandidates, queue)), centerX_buf(allocBufWrapper(devAccIn, maxTrackCandidates, queue)), centerY_buf(allocBufWrapper(devAccIn, maxTrackCandidates, queue)), radius_buf(allocBufWrapper(devAccIn, maxTrackCandidates, queue)) { @@ -115,11 +115,11 @@ namespace ALPAKA_ACCELERATOR_NAMESPACE::SDL { trackCandidatesInGPU.objectIndices[2 * trackCandidateIndex] = trackletIndex; trackCandidatesInGPU.objectIndices[2 * trackCandidateIndex + 1] = trackletIndex; - trackCandidatesInGPU.hitIndices[::SDL::Params_pT5::kHits * trackCandidateIndex + 0] = + trackCandidatesInGPU.hitIndices[Params_pT5::kHits * trackCandidateIndex + 0] = hitIndices.x; // Order explanation in https://github.com/SegmentLinking/TrackLooper/issues/267 - trackCandidatesInGPU.hitIndices[::SDL::Params_pT5::kHits * trackCandidateIndex + 1] = hitIndices.z; - trackCandidatesInGPU.hitIndices[::SDL::Params_pT5::kHits * trackCandidateIndex + 2] = hitIndices.y; - trackCandidatesInGPU.hitIndices[::SDL::Params_pT5::kHits * trackCandidateIndex + 3] = hitIndices.w; + trackCandidatesInGPU.hitIndices[Params_pT5::kHits * trackCandidateIndex + 1] = hitIndices.z; + trackCandidatesInGPU.hitIndices[Params_pT5::kHits * trackCandidateIndex + 2] = hitIndices.y; + trackCandidatesInGPU.hitIndices[Params_pT5::kHits * trackCandidateIndex + 3] = hitIndices.w; }; ALPAKA_FN_ACC ALPAKA_FN_INLINE void addTrackCandidateToMemory(struct SDL::trackCandidates& trackCandidatesInGPU, @@ -143,16 +143,16 @@ namespace ALPAKA_ACCELERATOR_NAMESPACE::SDL { trackCandidatesInGPU.objectIndices[2 * trackCandidateIndex + 1] = outerTrackletIndex; size_t limits = trackCandidateType == 7 - ? ::SDL::Params_pT5::kLayers - : ::SDL::Params_pT3::kLayers; // 7 means pT5, ::SDL::Params_pT3::kLayers = ::SDL::Params_T5::kLayers = 5 + ? Params_pT5::kLayers + : Params_pT3::kLayers; // 7 means pT5, Params_pT3::kLayers = Params_T5::kLayers = 5 //send the starting pointer to the logicalLayer and hitIndices for (size_t i = 0; i < limits; i++) { - trackCandidatesInGPU.logicalLayers[::SDL::Params_pT5::kLayers * trackCandidateIndex + i] = logicalLayerIndices[i]; - trackCandidatesInGPU.lowerModuleIndices[::SDL::Params_pT5::kLayers * trackCandidateIndex + i] = lowerModuleIndices[i]; + trackCandidatesInGPU.logicalLayers[Params_pT5::kLayers * trackCandidateIndex + i] = logicalLayerIndices[i]; + trackCandidatesInGPU.lowerModuleIndices[Params_pT5::kLayers * trackCandidateIndex + i] = lowerModuleIndices[i]; } for (size_t i = 0; i < 2 * limits; i++) { - trackCandidatesInGPU.hitIndices[::SDL::Params_pT5::kHits * trackCandidateIndex + i] = hitIndices[i]; + trackCandidatesInGPU.hitIndices[Params_pT5::kHits * trackCandidateIndex + i] = hitIndices[i]; } trackCandidatesInGPU.centerX[trackCandidateIndex] = __F2H(centerX); trackCandidatesInGPU.centerY[trackCandidateIndex] = __F2H(centerY); @@ -164,8 +164,8 @@ namespace ALPAKA_ACCELERATOR_NAMESPACE::SDL { struct SDL::miniDoublets& mdsInGPU, struct SDL::segments& segmentsInGPU, struct SDL::hits& hitsInGPU) { - int phits1[::SDL::Params_pLS::kHits]; - int phits2[::SDL::Params_pLS::kHits]; + int phits1[Params_pLS::kHits]; + int phits2[Params_pLS::kHits]; phits1[0] = hitsInGPU.idxs[mdsInGPU.anchorHitIndices[segmentsInGPU.mdIndices[2 * ix]]]; phits1[1] = hitsInGPU.idxs[mdsInGPU.anchorHitIndices[segmentsInGPU.mdIndices[2 * ix + 1]]]; @@ -179,12 +179,12 @@ namespace ALPAKA_ACCELERATOR_NAMESPACE::SDL { int npMatched = 0; - for (int i = 0; i < ::SDL::Params_pLS::kHits; i++) { + for (int i = 0; i < Params_pLS::kHits; i++) { bool pmatched = false; if (phits1[i] == -1) continue; - for (int j = 0; j < ::SDL::Params_pLS::kHits; j++) { + for (int j = 0; j < Params_pLS::kHits; j++) { if (phits2[j] == -1) continue; @@ -398,7 +398,7 @@ namespace ALPAKA_ACCELERATOR_NAMESPACE::SDL { unsigned int trackCandidateIdx = alpaka::atomicOp(acc, trackCandidatesInGPU.nTrackCandidates, 1u); - if (trackCandidateIdx >= ::SDL::N_MAX_PIXEL_TRACK_CANDIDATES) // This is done before any non-pixel TCs are added + if (trackCandidateIdx >= N_MAX_PIXEL_TRACK_CANDIDATES) // This is done before any non-pixel TCs are added { #ifdef Warnings printf("Track Candidate excess alert! Type = pT3"); @@ -416,9 +416,9 @@ namespace ALPAKA_ACCELERATOR_NAMESPACE::SDL { 5 /*track candidate type pT3=5*/, pixelTripletIndex, pixelTripletIndex, - &pixelTripletsInGPU.logicalLayers[::SDL::Params_pT3::kLayers * pixelTripletIndex], - &pixelTripletsInGPU.lowerModuleIndices[::SDL::Params_pT3::kLayers * pixelTripletIndex], - &pixelTripletsInGPU.hitIndices[::SDL::Params_pT3::kHits * pixelTripletIndex], + &pixelTripletsInGPU.logicalLayers[Params_pT3::kLayers * pixelTripletIndex], + &pixelTripletsInGPU.lowerModuleIndices[Params_pT3::kLayers * pixelTripletIndex], + &pixelTripletsInGPU.hitIndices[Params_pT3::kHits * pixelTripletIndex], segmentsInGPU.seedIdx[pT3PixelIndex - pLS_offset], __H2F(pixelTripletsInGPU.centerX[pixelTripletIndex]), __H2F(pixelTripletsInGPU.centerY[pixelTripletIndex]), @@ -456,7 +456,7 @@ namespace ALPAKA_ACCELERATOR_NAMESPACE::SDL { alpaka::atomicOp(acc, trackCandidatesInGPU.nTrackCandidates, 1u); if (trackCandidateIdx - *trackCandidatesInGPU.nTrackCandidatespT5 - *trackCandidatesInGPU.nTrackCandidatespT3 >= - ::SDL::N_MAX_NONPIXEL_TRACK_CANDIDATES) // pT5 and pT3 TCs have been added, but not pLS TCs + N_MAX_NONPIXEL_TRACK_CANDIDATES) // pT5 and pT3 TCs have been added, but not pLS TCs { #ifdef Warnings printf("Track Candidate excess alert! Type = T5"); @@ -469,9 +469,9 @@ namespace ALPAKA_ACCELERATOR_NAMESPACE::SDL { 4 /*track candidate type T5=4*/, quintupletIndex, quintupletIndex, - &quintupletsInGPU.logicalLayers[::SDL::Params_T5::kLayers * quintupletIndex], - &quintupletsInGPU.lowerModuleIndices[::SDL::Params_T5::kLayers * quintupletIndex], - &quintupletsInGPU.hitIndices[::SDL::Params_T5::kHits * quintupletIndex], + &quintupletsInGPU.logicalLayers[Params_T5::kLayers * quintupletIndex], + &quintupletsInGPU.lowerModuleIndices[Params_T5::kLayers * quintupletIndex], + &quintupletsInGPU.hitIndices[Params_T5::kHits * quintupletIndex], -1 /*no pixel seed index for T5s*/, quintupletsInGPU.regressionG[quintupletIndex], quintupletsInGPU.regressionF[quintupletIndex], @@ -503,7 +503,7 @@ namespace ALPAKA_ACCELERATOR_NAMESPACE::SDL { unsigned int trackCandidateIdx = alpaka::atomicOp(acc, trackCandidatesInGPU.nTrackCandidates, 1u); if (trackCandidateIdx - *trackCandidatesInGPU.nTrackCandidatesT5 >= - ::SDL::N_MAX_PIXEL_TRACK_CANDIDATES) // T5 TCs have already been added + N_MAX_PIXEL_TRACK_CANDIDATES) // T5 TCs have already been added { #ifdef Warnings printf("Track Candidate excess alert! Type = pLS"); @@ -543,7 +543,7 @@ namespace ALPAKA_ACCELERATOR_NAMESPACE::SDL { unsigned int trackCandidateIdx = alpaka::atomicOp(acc, trackCandidatesInGPU.nTrackCandidates, 1u); - if (trackCandidateIdx >= ::SDL::N_MAX_PIXEL_TRACK_CANDIDATES) // No other TCs have been added yet + if (trackCandidateIdx >= N_MAX_PIXEL_TRACK_CANDIDATES) // No other TCs have been added yet { #ifdef Warnings printf("Track Candidate excess alert! Type = pT5"); @@ -562,9 +562,9 @@ namespace ALPAKA_ACCELERATOR_NAMESPACE::SDL { 7 /*track candidate type pT5=7*/, pT5PixelIndex, pixelQuintupletsInGPU.T5Indices[pixelQuintupletIndex], - &pixelQuintupletsInGPU.logicalLayers[::SDL::Params_pT5::kLayers * pixelQuintupletIndex], - &pixelQuintupletsInGPU.lowerModuleIndices[::SDL::Params_pT5::kLayers * pixelQuintupletIndex], - &pixelQuintupletsInGPU.hitIndices[::SDL::Params_pT5::kHits * pixelQuintupletIndex], + &pixelQuintupletsInGPU.logicalLayers[Params_pT5::kLayers * pixelQuintupletIndex], + &pixelQuintupletsInGPU.lowerModuleIndices[Params_pT5::kLayers * pixelQuintupletIndex], + &pixelQuintupletsInGPU.hitIndices[Params_pT5::kHits * pixelQuintupletIndex], segmentsInGPU.seedIdx[pT5PixelIndex - pLS_offset], __H2F(pixelQuintupletsInGPU.centerX[pixelQuintupletIndex]), __H2F(pixelQuintupletsInGPU.centerY[pixelQuintupletIndex]), diff --git a/RecoTracker/LSTCore/src/alpaka/Triplet.h b/RecoTracker/LSTCore/src/alpaka/Triplet.h index 9d5e16df41756..793a3186174b1 100644 --- a/RecoTracker/LSTCore/src/alpaka/Triplet.h +++ b/RecoTracker/LSTCore/src/alpaka/Triplet.h @@ -2,13 +2,13 @@ #define Triplet_cuh #include "RecoTracker/LSTCore/interface/alpaka/Constants.h" -#include "RecoTracker/LSTCore/interface/alpaka/Module.h" +#include "RecoTracker/LSTCore/interface/Module.h" #include "Segment.h" #include "MiniDoublet.h" #include "Hit.h" -namespace ALPAKA_ACCELERATOR_NAMESPACE::SDL { +namespace SDL { struct triplets { unsigned int* segmentIndices; uint16_t* lowerModuleIndices; //3 of them now @@ -108,12 +108,12 @@ namespace ALPAKA_ACCELERATOR_NAMESPACE::SDL { template tripletsBuffer(unsigned int maxTriplets, unsigned int nLowerModules, TDevAcc const& devAccIn, TQueue& queue) : segmentIndices_buf(allocBufWrapper(devAccIn, 2 * maxTriplets, queue)), - lowerModuleIndices_buf(allocBufWrapper(devAccIn, ::SDL::Params_T3::kLayers * maxTriplets, queue)), + lowerModuleIndices_buf(allocBufWrapper(devAccIn, Params_T3::kLayers * maxTriplets, queue)), nTriplets_buf(allocBufWrapper(devAccIn, nLowerModules, queue)), totOccupancyTriplets_buf(allocBufWrapper(devAccIn, nLowerModules, queue)), nMemoryLocations_buf(allocBufWrapper(devAccIn, 1, queue)), - logicalLayers_buf(allocBufWrapper(devAccIn, maxTriplets * ::SDL::Params_T3::kLayers, queue)), - hitIndices_buf(allocBufWrapper(devAccIn, maxTriplets * ::SDL::Params_T3::kHits, queue)), + logicalLayers_buf(allocBufWrapper(devAccIn, maxTriplets * Params_T3::kLayers, queue)), + hitIndices_buf(allocBufWrapper(devAccIn, maxTriplets * Params_T3::kHits, queue)), betaIn_buf(allocBufWrapper(devAccIn, maxTriplets, queue)), circleRadius_buf(allocBufWrapper(devAccIn, maxTriplets, queue)), circleCenterX_buf(allocBufWrapper(devAccIn, maxTriplets, queue)), @@ -191,31 +191,31 @@ namespace ALPAKA_ACCELERATOR_NAMESPACE::SDL { { tripletsInGPU.segmentIndices[tripletIndex * 2] = innerSegmentIndex; tripletsInGPU.segmentIndices[tripletIndex * 2 + 1] = outerSegmentIndex; - tripletsInGPU.lowerModuleIndices[tripletIndex * ::SDL::Params_T3::kLayers] = innerInnerLowerModuleIndex; - tripletsInGPU.lowerModuleIndices[tripletIndex * ::SDL::Params_T3::kLayers + 1] = middleLowerModuleIndex; - tripletsInGPU.lowerModuleIndices[tripletIndex * ::SDL::Params_T3::kLayers + 2] = outerOuterLowerModuleIndex; + tripletsInGPU.lowerModuleIndices[tripletIndex * Params_T3::kLayers] = innerInnerLowerModuleIndex; + tripletsInGPU.lowerModuleIndices[tripletIndex * Params_T3::kLayers + 1] = middleLowerModuleIndex; + tripletsInGPU.lowerModuleIndices[tripletIndex * Params_T3::kLayers + 2] = outerOuterLowerModuleIndex; tripletsInGPU.betaIn[tripletIndex] = __F2H(betaIn); tripletsInGPU.circleRadius[tripletIndex] = circleRadius; tripletsInGPU.circleCenterX[tripletIndex] = circleCenterX; tripletsInGPU.circleCenterY[tripletIndex] = circleCenterY; - tripletsInGPU.logicalLayers[tripletIndex * ::SDL::Params_T3::kLayers] = + tripletsInGPU.logicalLayers[tripletIndex * Params_T3::kLayers] = modulesInGPU.layers[innerInnerLowerModuleIndex] + (modulesInGPU.subdets[innerInnerLowerModuleIndex] == 4) * 6; - tripletsInGPU.logicalLayers[tripletIndex * ::SDL::Params_T3::kLayers + 1] = + tripletsInGPU.logicalLayers[tripletIndex * Params_T3::kLayers + 1] = modulesInGPU.layers[middleLowerModuleIndex] + (modulesInGPU.subdets[middleLowerModuleIndex] == 4) * 6; - tripletsInGPU.logicalLayers[tripletIndex * ::SDL::Params_T3::kLayers + 2] = + tripletsInGPU.logicalLayers[tripletIndex * Params_T3::kLayers + 2] = modulesInGPU.layers[outerOuterLowerModuleIndex] + (modulesInGPU.subdets[outerOuterLowerModuleIndex] == 4) * 6; //get the hits unsigned int firstMDIndex = segmentsInGPU.mdIndices[2 * innerSegmentIndex]; unsigned int secondMDIndex = segmentsInGPU.mdIndices[2 * innerSegmentIndex + 1]; unsigned int thirdMDIndex = segmentsInGPU.mdIndices[2 * outerSegmentIndex + 1]; - tripletsInGPU.hitIndices[tripletIndex * ::SDL::Params_T3::kHits] = mdsInGPU.anchorHitIndices[firstMDIndex]; - tripletsInGPU.hitIndices[tripletIndex * ::SDL::Params_T3::kHits + 1] = mdsInGPU.outerHitIndices[firstMDIndex]; - tripletsInGPU.hitIndices[tripletIndex * ::SDL::Params_T3::kHits + 2] = mdsInGPU.anchorHitIndices[secondMDIndex]; - tripletsInGPU.hitIndices[tripletIndex * ::SDL::Params_T3::kHits + 3] = mdsInGPU.outerHitIndices[secondMDIndex]; - tripletsInGPU.hitIndices[tripletIndex * ::SDL::Params_T3::kHits + 4] = mdsInGPU.anchorHitIndices[thirdMDIndex]; - tripletsInGPU.hitIndices[tripletIndex * ::SDL::Params_T3::kHits + 5] = mdsInGPU.outerHitIndices[thirdMDIndex]; + tripletsInGPU.hitIndices[tripletIndex * Params_T3::kHits] = mdsInGPU.anchorHitIndices[firstMDIndex]; + tripletsInGPU.hitIndices[tripletIndex * Params_T3::kHits + 1] = mdsInGPU.outerHitIndices[firstMDIndex]; + tripletsInGPU.hitIndices[tripletIndex * Params_T3::kHits + 2] = mdsInGPU.anchorHitIndices[secondMDIndex]; + tripletsInGPU.hitIndices[tripletIndex * Params_T3::kHits + 3] = mdsInGPU.outerHitIndices[secondMDIndex]; + tripletsInGPU.hitIndices[tripletIndex * Params_T3::kHits + 4] = mdsInGPU.anchorHitIndices[thirdMDIndex]; + tripletsInGPU.hitIndices[tripletIndex * Params_T3::kHits + 5] = mdsInGPU.outerHitIndices[thirdMDIndex]; #ifdef CUT_VALUE_DEBUG tripletsInGPU.zOut[tripletIndex] = zOut; tripletsInGPU.rtOut[tripletIndex] = rtOut;