From eb5de05acde834fecafba919b609f6d416476c25 Mon Sep 17 00:00:00 2001 From: Andres Rios Tascon Date: Mon, 24 Jun 2024 11:30:45 -0700 Subject: [PATCH] Minor cleanup --- .../interface/alpaka/EndcapGeometryBuffer.h | 7 ++++--- .../LSTCore/interface/alpaka/LSTESData.h | 20 +++++++++---------- RecoTracker/LSTCore/interface/alpaka/Module.h | 4 ++-- .../LSTCore/src/alpaka/LSTESData.dev.cc | 10 ++++++---- RecoTracker/LSTCore/standalone/bin/sdl.cc | 3 ++- 5 files changed, 24 insertions(+), 20 deletions(-) diff --git a/RecoTracker/LSTCore/interface/alpaka/EndcapGeometryBuffer.h b/RecoTracker/LSTCore/interface/alpaka/EndcapGeometryBuffer.h index 76849b3f2d206..97e755e57601c 100644 --- a/RecoTracker/LSTCore/interface/alpaka/EndcapGeometryBuffer.h +++ b/RecoTracker/LSTCore/interface/alpaka/EndcapGeometryBuffer.h @@ -43,14 +43,15 @@ namespace SDL { alpaka::memcpy(queue, geoMapPhi_buf, src.geoMapPhi_buf); } - template - endcapGeometryBuffer(TQueue queue, const endcapGeometryBuffer& src, unsigned int nEndCapMap) { + template + endcapGeometryBuffer(TQueue queue, const endcapGeometryBuffer& src, unsigned int nEndCapMap) + : endcapGeometryBuffer(alpaka::getDev(queue), nEndCapMap) { copyFromSrc(queue, src); } inline SDL::endcapGeom const* data() const { return this; } }; - + } // namespace SDL #endif diff --git a/RecoTracker/LSTCore/interface/alpaka/LSTESData.h b/RecoTracker/LSTCore/interface/alpaka/LSTESData.h index 39509f963028b..ea7e5a7fa647d 100644 --- a/RecoTracker/LSTCore/interface/alpaka/LSTESData.h +++ b/RecoTracker/LSTCore/interface/alpaka/LSTESData.h @@ -40,16 +40,16 @@ namespace SDL { pixelMapping(pixelMappingIn) {} }; - std::unique_ptr> loadAndFillESHost(); + std::unique_ptr> loadAndFillESHost(); } // namespace SDL namespace cms::alpakatools { template <> - struct CopyToDevice> { + struct CopyToDevice> { template - static SDL::LSTESData> copyAsync( - TQueue& queue, SDL::LSTESData const& srcData) { + 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); @@ -58,12 +58,12 @@ namespace cms::alpakatools { deviceEndcapGeometryBuffers->copyFromSrc(queue, *srcData.endcapGeometryBuffers); return SDL::LSTESData>(srcData.nModules, - srcData.nLowerModules, - srcData.nPixels, - srcData.nEndCapMap, - deviceModulesBuffers, - deviceEndcapGeometryBuffers, - srcData.pixelMapping); + srcData.nLowerModules, + srcData.nPixels, + srcData.nEndCapMap, + deviceModulesBuffers, + deviceEndcapGeometryBuffers, + srcData.pixelMapping); } }; } // namespace cms::alpakatools diff --git a/RecoTracker/LSTCore/interface/alpaka/Module.h b/RecoTracker/LSTCore/interface/alpaka/Module.h index 0a269eaa6e16a..1f9cf2e148107 100644 --- a/RecoTracker/LSTCore/interface/alpaka/Module.h +++ b/RecoTracker/LSTCore/interface/alpaka/Module.h @@ -359,8 +359,8 @@ namespace SDL { alpaka::wait(queue); } - template - modulesBuffer(TQueue queue, const modulesBuffer& src, unsigned int nMod, unsigned int nPixs) + template + modulesBuffer(TQueue queue, const modulesBuffer& src, unsigned int nMod, unsigned int nPixs) : modulesBuffer(alpaka::getDev(queue), nMod, nPixs) { copyFromSrc(queue, src); } diff --git a/RecoTracker/LSTCore/src/alpaka/LSTESData.dev.cc b/RecoTracker/LSTCore/src/alpaka/LSTESData.dev.cc index c091eb2e0a64f..3d64627e217f9 100644 --- a/RecoTracker/LSTCore/src/alpaka/LSTESData.dev.cc +++ b/RecoTracker/LSTCore/src/alpaka/LSTESData.dev.cc @@ -93,11 +93,13 @@ std::unique_ptr> SDL::loadAndFillESHost() { auto moduleConnectionMap = std::make_shared>(); ::loadMapsHost(*pLStoLayer, endcapGeometry, tiltedGeometry, moduleConnectionMap); - auto endcapGeometryBuffers = std::make_shared>(cms::alpakatools::host(), - endcapGeometry->nEndCapMap); + auto endcapGeometryBuffers = + 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); - alpaka::memcpy(queue, endcapGeometryBuffers->geoMapPhi_buf, endcapGeometry->geoMapPhi_buf, endcapGeometry->nEndCapMap); + alpaka::memcpy( + queue, endcapGeometryBuffers->geoMapDetId_buf, endcapGeometry->geoMapDetId_buf, endcapGeometry->nEndCapMap); + alpaka::memcpy( + queue, endcapGeometryBuffers->geoMapPhi_buf, endcapGeometry->geoMapPhi_buf, endcapGeometry->nEndCapMap); auto path = get_absolute_path_after_check_file_exists(trackLooperDir() + "/data/OT800_IT615_pt0.8/sensor_centroids.bin"); diff --git a/RecoTracker/LSTCore/standalone/bin/sdl.cc b/RecoTracker/LSTCore/standalone/bin/sdl.cc index 6f3f7e29d9a49..c6734ca750c30 100644 --- a/RecoTracker/LSTCore/standalone/bin/sdl.cc +++ b/RecoTracker/LSTCore/standalone/bin/sdl.cc @@ -295,7 +295,8 @@ void run_sdl() { TStopwatch full_timer; full_timer.Start(); auto hostESData = SDL::loadAndFillESHost(); - auto deviceESData = cms::alpakatools::CopyToDevice>::copyAsync(queues[0], *hostESData.get()); + auto deviceESData = + cms::alpakatools::CopyToDevice>::copyAsync(queues[0], *hostESData.get()); float timeForMapLoading = full_timer.RealTime() * 1000; if (ana.do_write_ntuple) {