Skip to content

Commit

Permalink
Minor cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
ariostas committed Jun 24, 2024
1 parent a3f65da commit eb5de05
Show file tree
Hide file tree
Showing 5 changed files with 24 additions and 20 deletions.
7 changes: 4 additions & 3 deletions RecoTracker/LSTCore/interface/alpaka/EndcapGeometryBuffer.h
Original file line number Diff line number Diff line change
Expand Up @@ -43,14 +43,15 @@ namespace SDL {
alpaka::memcpy(queue, geoMapPhi_buf, src.geoMapPhi_buf);
}

template <typename TQueue>
endcapGeometryBuffer(TQueue queue, const endcapGeometryBuffer<alpaka::DevCpu>& src, unsigned int nEndCapMap) {
template <typename TQueue, typename TDevSrc>
endcapGeometryBuffer(TQueue queue, const endcapGeometryBuffer<TDevSrc>& src, unsigned int nEndCapMap)
: endcapGeometryBuffer(alpaka::getDev(queue), nEndCapMap) {
copyFromSrc(queue, src);
}

inline SDL::endcapGeom const* data() const { return this; }
};

} // namespace SDL

#endif
20 changes: 10 additions & 10 deletions RecoTracker/LSTCore/interface/alpaka/LSTESData.h
Original file line number Diff line number Diff line change
Expand Up @@ -40,16 +40,16 @@ namespace SDL {
pixelMapping(pixelMappingIn) {}
};

std::unique_ptr<LSTESData<SDL::DevHost>> loadAndFillESHost();
std::unique_ptr<LSTESData<alpaka_common::DevHost>> loadAndFillESHost();

} // namespace SDL

namespace cms::alpakatools {
template <>
struct CopyToDevice<SDL::LSTESData<SDL::DevHost>> {
struct CopyToDevice<SDL::LSTESData<alpaka_common::DevHost>> {
template <typename TQueue>
static SDL::LSTESData<alpaka::Dev<TQueue>> copyAsync(
TQueue& queue, SDL::LSTESData<SDL::DevHost> const& srcData) {
static SDL::LSTESData<alpaka::Dev<TQueue>> copyAsync(TQueue& queue,
SDL::LSTESData<alpaka_common::DevHost> const& srcData) {
auto deviceModulesBuffers = std::make_shared<SDL::modulesBuffer<alpaka::Dev<TQueue>>>(
alpaka::getDev(queue), srcData.nModules, srcData.nPixels);
deviceModulesBuffers->copyFromSrc(queue, *srcData.modulesBuffers);
Expand All @@ -58,12 +58,12 @@ namespace cms::alpakatools {
deviceEndcapGeometryBuffers->copyFromSrc(queue, *srcData.endcapGeometryBuffers);

return SDL::LSTESData<alpaka::Dev<TQueue>>(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
Expand Down
4 changes: 2 additions & 2 deletions RecoTracker/LSTCore/interface/alpaka/Module.h
Original file line number Diff line number Diff line change
Expand Up @@ -359,8 +359,8 @@ namespace SDL {
alpaka::wait(queue);
}

template <typename TQueue>
modulesBuffer(TQueue queue, const modulesBuffer<alpaka::DevCpu>& src, unsigned int nMod, unsigned int nPixs)
template <typename TQueue, typename TDevSrc>
modulesBuffer(TQueue queue, const modulesBuffer<TDevSrc>& src, unsigned int nMod, unsigned int nPixs)
: modulesBuffer(alpaka::getDev(queue), nMod, nPixs) {
copyFromSrc(queue, src);
}
Expand Down
10 changes: 6 additions & 4 deletions RecoTracker/LSTCore/src/alpaka/LSTESData.dev.cc
Original file line number Diff line number Diff line change
Expand Up @@ -93,11 +93,13 @@ std::unique_ptr<SDL::LSTESData<SDL::DevHost>> SDL::loadAndFillESHost() {
auto moduleConnectionMap = std::make_shared<SDL::ModuleConnectionMap<SDL::Dev>>();
::loadMapsHost(*pLStoLayer, endcapGeometry, tiltedGeometry, moduleConnectionMap);

auto endcapGeometryBuffers = std::make_shared<SDL::endcapGeometryBuffer<SDL::DevHost>>(cms::alpakatools::host(),
endcapGeometry->nEndCapMap);
auto endcapGeometryBuffers =
std::make_shared<SDL::endcapGeometryBuffer<SDL::DevHost>>(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");
Expand Down
3 changes: 2 additions & 1 deletion RecoTracker/LSTCore/standalone/bin/sdl.cc
Original file line number Diff line number Diff line change
Expand Up @@ -295,7 +295,8 @@ void run_sdl() {
TStopwatch full_timer;
full_timer.Start();
auto hostESData = SDL::loadAndFillESHost();
auto deviceESData = cms::alpakatools::CopyToDevice<SDL::LSTESData<SDL::DevHost>>::copyAsync(queues[0], *hostESData.get());
auto deviceESData =
cms::alpakatools::CopyToDevice<SDL::LSTESData<SDL::DevHost>>::copyAsync(queues[0], *hostESData.get());
float timeForMapLoading = full_timer.RealTime() * 1000;

if (ana.do_write_ntuple) {
Expand Down

0 comments on commit eb5de05

Please sign in to comment.