4#ifndef ACTSGPUEVENT_TRACCCMEASUREMENTDEVICECONVERTERALG_H
5#define ACTSGPUEVENT_TRACCCMEASUREMENTDEVICECONVERTERALG_H
15#include "GaudiKernel/ToolHandle.h"
21#include <traccc/edm/measurement_collection.hpp>
22#include <traccc/geometry/detector.hpp>
23#include <vecmem/memory/memory_resource.hpp>
24#include <traccc/geometry/detector_conditions_description.hpp>
25#include <traccc/geometry/detector_buffer.hpp>
27#include <cuda_runtime_api.h>
30#define CUDA_ERROR_CHECK(EXP) \
32 cudaError_t errorCode = EXP; \
33 if (errorCode != cudaSuccess) { \
34 errorcheck::ReportMessage(MSG::ERROR, ERRORCHECK_ARGS, \
35 __PRETTY_FUNCTION__, \
36 StatusCode::FAILURE) \
38 << "Failed to execute: " << #EXP << " (" \
39 << cudaGetErrorString(errorCode) << ")"; \
40 return StatusCode::FAILURE; \
63 using AthReentrantAlgorithm::AthReentrantAlgorithm;
68 virtual StatusCode
execute(
const EventContext& ctx)
const override;
70 virtual StatusCode
finalize()
override;
76 this,
"InputMeasurements",
"TracccMeasurements",
77 "Input traccc measurement collection buffer"};
82 this,
"OutputPixelClusters",
"ITkTracccPixelClusters",
83 "Output xAOD pixel cluster container"};
85 this,
"OutputStripClusters",
"ITkTracccStripClusters",
86 "Output xAOD strip cluster container"};
90 ToolHandle<AthDevice::IMemoryResourcesTool>
m_mrTool{
91 this,
"MemoryResourcesTool",
"",
"Tool that provides memory resources"};
94 this,
"CopiesProviderTool",
"",
"Tool that provides vecmem copy objects"};
97 this,
"StreamTool",
"",
"Tool that provides CUDA streams"};
100 this,
"DeviceDetectorName",
"",
101 "Detray device detector object"};
103 this,
"DeviceConditionsObjectName",
"",
104 "Key for reading the per-IOV traccc device conditions object"};
131 , vecmem::memory_resource & mr
132 , vecmem::copy
const & copy
133 , traccc::itk_detector::view_type
const & detector_view
134 , traccc::detector_conditions_description::const_view
const & detector_conditions_view
135 , traccc::edm::measurement_collection::const_view::size_type nb_measurements
136 ,
const traccc::edm::measurement_collection::const_view & input
137 , DevicePixelMeasurementContainer::view::size_type & output_n_pixels
138 , DeviceStripMeasurementContainer::view::size_type & output_n_strips
139 , std::unique_ptr<DevicePixelMeasurementContainer::buffer> & output_pixel_meas
140 , std::unique_ptr<DeviceStripMeasurementContainer::buffer> & output_strip_meas
Property holding a SG store/key/clid from which a ReadHandle is made.
Property holding a SG store/key/clid from which a WriteHandle is made.
Algorithm converting traccc measurements (device buffer) to xAOD clusters (host container).
SG::ReadCondHandleKey< traccc::detector_conditions_description::buffer > m_deviceCondKey
ToolHandle< AthDevice::ICopiesTool > m_copiesTool
std::atomic< int > m_nPix
The object counters for debug prints in finalize method {.
ToolHandle< AthCUDA::IStreamTool > m_streamTool
virtual StatusCode execute(const EventContext &ctx) const override
Function executing the algorithm.
SG::WriteHandleKey< xAOD::PixelClusterContainer > m_outputPixelKey
virtual StatusCode finalize() override
Function finalizing the algorthm.
std::atomic< int > m_nMeas
std::atomic< int > m_nStrip
SG::ReadHandleKey< traccc::edm::measurement_collection::buffer > m_inputMeasKey
virtual StatusCode initialize() override
Function initializing the algorithm.
Gaudi::Property< std::string > m_deviceDetectorName
ToolHandle< AthDevice::IMemoryResourcesTool > m_mrTool
SG::WriteHandleKey< xAOD::StripClusterContainer > m_outputStripKey
const traccc::detector_buffer * m_detector
An algorithm that can be simultaneously executed in multiple threads.
Property holding a SG store/key/clid from which a ReadHandle is made.
Property holding a SG store/key/clid from which a WriteHandle is made.
The AlignStoreProviderAlg loads the rigid alignment corrections and pipes them through the readout ge...
StatusCode convertMeasurementsOnGPU(cudaStream_t stream, vecmem::memory_resource &mr, vecmem::copy const ©, traccc::itk_detector::view_type const &detector_view, traccc::detector_conditions_description::const_view const &detector_conditions_view, traccc::edm::measurement_collection::const_view::size_type nb_measurements, const traccc::edm::measurement_collection::const_view &input, DevicePixelMeasurementContainer::view::size_type &output_n_pixels, DeviceStripMeasurementContainer::view::size_type &output_n_strips, std::unique_ptr< DevicePixelMeasurementContainer::buffer > &output_pixel_meas, std::unique_ptr< DeviceStripMeasurementContainer::buffer > &output_strip_meas)