![]() |
ATLAS Offline Software
|
Algorithm to reconstruct CaloCluster objects with GPU acceleration, providing interoperability for calling standard CPU algorithms before and after the GPU processing part. More...
#include <CaloGPUHybridClusterProcessor.h>
Classes | |
| class | simple_GPU_pointer_holder |
A simple RAII wrapper to ensure proper allocation and deallocation of GPU memory in a void * for the temporaries. More... | |
Public Member Functions | |
| CaloGPUHybridClusterProcessor (const std::string &name, ISvcLocator *pSvcLocator) | |
| virtual | ~CaloGPUHybridClusterProcessor () override=default |
| virtual StatusCode | initialize () override |
| virtual StatusCode | initialize_non_CUDA () override |
| Initialization that does not invoke CUDA functions. | |
| virtual StatusCode | initialize_CUDA () override |
| Initialization that invokes CUDA functions. | |
| virtual StatusCode | execute (const EventContext &ctx) const override |
| virtual StatusCode | finalize () override |
| virtual StatusCode | sysInitialize () override |
| Override sysInitialize. | |
| virtual bool | isClonable () const override |
| Specify if the algorithm is clonable. | |
| virtual unsigned int | cardinality () const override |
| Cardinality (Maximum number of clones that can exist) special value 0 means that algorithm is reentrant. | |
| virtual StatusCode | sysExecute (const EventContext &ctx) override |
| Execute an algorithm. | |
| virtual const DataObjIDColl & | extraOutputDeps () const override |
| Return the list of extra output dependencies. | |
| virtual bool | filterPassed (const EventContext &ctx) const |
| virtual void | setFilterPassed (bool state, const EventContext &ctx) const |
| ServiceHandle< StoreGateSvc > & | evtStore () |
The standard StoreGateSvc (event store) Returns (kind of) a pointer to the StoreGateSvc. | |
| const ServiceHandle< StoreGateSvc > & | detStore () const |
The standard StoreGateSvc/DetectorStore Returns (kind of) a pointer to the StoreGateSvc. | |
| virtual StatusCode | sysStart () override |
| Handle START transition. | |
| virtual std::vector< Gaudi::DataHandle * > | inputHandles () const override |
| Return this algorithm's input handles. | |
| virtual std::vector< Gaudi::DataHandle * > | outputHandles () const override |
| Return this algorithm's output handles. | |
| Gaudi::Details::PropertyBase & | declareProperty (Gaudi::Property< T, V, H > &t) |
| void | updateVHKA (Gaudi::Details::PropertyBase &) |
| MsgStream & | msg () const |
| bool | msgLvl (const MSG::Level lvl) const |
| void | handle (const Incident &incident) override |
Protected Member Functions | |
| void | renounceArray (SG::VarHandleKeyArray &handlesArray) |
| remove all handles from I/O resolution | |
| std::enable_if_t< std::is_void_v< std::result_of_t< decltype(&T::renounce)(T)> > &&!std::is_base_of_v< SG::VarHandleKeyArray, T > &&std::is_base_of_v< Gaudi::DataHandle, T >, void > | renounce (T &h) |
| void | extraDeps_update_handler (Gaudi::Details::PropertyBase &ExtraDeps) |
| Add StoreName to extra input/output deps as needed. | |
| void | record_times (const size_t event_num, const std::vector< size_t > ×) const |
| template<class ... Args> | |
| void | record_times (const size_t event_num, const size_t &value) const |
| template<class ... Args> | |
| void | record_times (const size_t event_num, const size_t &value, Args &&... args) const |
| void | print_times (const std::string &header, const size_t time_size) const |
Protected Attributes | |
| std::shared_mutex | m_timeMutex |
| Mutex that is locked when recording times. | |
| Gaudi::Property< bool > | m_measureTimes |
If true, times are recorded to the file given by m_timeFileName. | |
| Gaudi::Property< std::string > | m_timeFileName |
| File to which times should be saved. | |
Private Types | |
| typedef ServiceHandle< StoreGateSvc > | StoreGateSvc_t |
Private Member Functions | |
| Gaudi::Details::PropertyBase & | declareGaudiProperty (Gaudi::Property< T, V, H > &hndl, const SG::VarHandleKeyType &) |
| specialization for handling Gaudi::Property<SG::VarHandleKey> | |
| void | record_times_helper (const size_t) const |
| template<class Arg> | |
| void | record_times_helper (const size_t index, Arg &&arg) const |
| template<class ... Args> | |
| void | record_times_helper (size_t index, Args &&... args) const |
Private Attributes | |
| ToolHandle< ICaloClusterGPUConstantTransformer > | m_transformConstantData {this, "ConstantDataToGPUTool", "", "Tool for transforming the constant data and sending it to the GPU"} |
| The tool that will convert the constant data from the CPU to the GPU. | |
| ToolHandleArray< CaloClusterCollectionProcessor > | m_preGPUoperations {this, "BeforeGPUTools", {}, "Tools to be applied to the clusters on the CPU before processing them on the GPU"} |
| Tools to be applied to the clusters before being sent to the GPU for processing. | |
| ToolHandle< ICaloClusterGPUInputTransformer > | m_transformForGPU {this, "EventDataToGPUTool", "", "Tool for transforming the event data and sending it to the GPU"} |
| The tool that will actually convert the data from the CPU to the GPU. | |
| ToolHandleArray< CaloClusterGPUProcessor > | m_GPUoperations {this, "GPUTools", {}, "Tools to be applied to the clusters on the GPU"} |
| Tools to be applied to the clusters on the GPU. | |
| ToolHandle< ICaloClusterGPUOutputTransformer > | m_transformBackToCPU {this, "GPUToEventDataTool", {}, "Tool for getting the data from the GPU back to the CPU Athena data structures"} |
| The tool that will convert the data from the GPU back to the CPU. | |
| ToolHandleArray< CaloClusterCollectionProcessor > | m_postGPUoperations {this, "AfterGPUTools", {}, "Tools to be applied to the clusters on the CPU after returning from the GPU"} |
| Tools to be applied to the clusters after returning from the GPU. | |
| Gaudi::Property< bool > | m_doPlots {this, "DoPlots", false, "Do plots based on the plotter tool optionally provided."} |
If true, calls the plotter specified by m_plotterTool at every tool execution. | |
| ToolHandle< ICaloClusterGPUPlotter > | m_plotterTool {this, "PlotterTool", "", "An optional plotter, for testing and/or debugging purposes"} |
| An optional plotter, for testing and/or debugging purposes. | |
| Gaudi::Property< bool > | m_writeTriggerSpecificInfo {this, "WriteTriggerSpecificInfo", false, "Write some trigger-specific decorations and use the trigger auxiliary container."} |
If true, writes some trigger-specific decorations. | |
| SG::WriteDecorHandleKey< xAOD::CaloClusterContainer > | m_mDecor_ncells {this, "Decor_ncells", "nCells", "Decorator containing the number of cells associated to a cluster"} |
| Key to the handle for writing the number of cells as a decoration. | |
| Gaudi::Property< size_t > | m_numPreAllocatedGPUData {this, "NumPreAllocatedDataHolders", 0, "Number of event data holders to pre-allocate on GPU memory"} |
| Number of events for which to pre-allocate space on GPU memory (should ideally be set to the expected number of threads to be run with). | |
| SG::WriteHandleKey< xAOD::CaloClusterContainer > | m_clusterOutput {this, "ClustersOutputName", "", "The name of the key in StoreGate for the output CaloClusterContainer"} |
| The name of the key in StoreGate for the output CaloClusterContainer. | |
| SG::WriteHandleKey< CaloClusterCellLinkContainer > | m_clusterCellLinkOutput {this, "ClusterCellLinksOutputName", "", "The name of the key in StoreGate for the output CaloClusterCellLinkContainer"} |
| The name of the key in StoreGate for the output CaloClusterCellLinkContainer. | |
| Gaudi::Property< bool > | m_deferConstantDataToFirstEvent {this, "DeferConstantDataPreparationToFirstEvent", true, "Convert and send event data on first event instead of during initialize (needed for exporting geometry and noise properly)?"} |
If true, the constant data is only converted and sent to the GPU on the first event, in case not all the necessary information is available during the initialize phase. | |
| Gaudi::Property< bool > | m_skipConversions {this, "SkipConversions", false, "If true, skip converting CPU to GPU data (useful if only instanting CPU tools)"} |
If true, both constant and event data conversion is skipped. | |
| CaloRecGPU::Helpers::separate_thread_holder< CaloRecGPU::EventDataHolder > m_eventDataThreadedHolder | ATLAS_THREAD_SAFE |
| A way to reduce allocations over multiple threads by keeping a cache of previously allocated objects that get assigned to the threads as they need them. | |
| CaloRecGPU::Helpers::separate_thread_holder< simple_GPU_pointer_holder > m_temporariesThreadedHolder | ATLAS_THREAD_SAFE |
| A way to reduce allocations over multiple threads by keeping a cache of previously allocated objects that get assigned to the threads as they need them. | |
| size_t | m_temporariesSize |
| The size of the temporary buffer to allocate for the GPU tools that will be called. | |
| CaloRecGPU::ConstantDataHolder m_constantData | ATLAS_THREAD_SAFE |
| Constant data, common for all events and persisted throughout the run. | |
| std::atomic< bool > | m_constantDataSent |
| A flag to signal that the constant data has been adequately sent to the GPU. | |
| std::mutex | m_mutex |
| This mutex is locked when sending the constant data on the first event to ensure thread safety. | |
| DataObjIDColl | m_extendedExtraObjects |
| Extra output dependency collection, extended by AthAlgorithmDHUpdate to add symlinks. | |
| StoreGateSvc_t | m_evtStore |
| Pointer to StoreGate (event store by default) | |
| StoreGateSvc_t | m_detStore |
| Pointer to StoreGate (detector store by default) | |
| std::vector< SG::VarHandleKeyArray * > | m_vhka |
| bool | m_varHandleArraysDeclared |
Algorithm to reconstruct CaloCluster objects with GPU acceleration, providing interoperability for calling standard CPU algorithms before and after the GPU processing part.
This class is meant as a replacement for CaloClusterMaker in that it creates a CaloClusterCollection and runs several tools over it. The main addition is the fact that, besides CPU-based tools, GPU-accelerated versions of the standard tools can be run, with adequate memory sharing between them to minimize transfers and (re-)conversions from and to the GPU-friendly data representation.
Definition at line 50 of file CaloGPUHybridClusterProcessor.h.
|
privateinherited |
Definition at line 388 of file AthCommonDataStore.h.
| CaloGPUHybridClusterProcessor::CaloGPUHybridClusterProcessor | ( | const std::string & | name, |
| ISvcLocator * | pSvcLocator ) |
Definition at line 31 of file CaloGPUHybridClusterProcessor.cxx.
|
overridevirtualdefault |
|
overridevirtualinherited |
Cardinality (Maximum number of clones that can exist) special value 0 means that algorithm is reentrant.
Override this to return 0 for reentrant algorithms.
Definition at line 75 of file AthCommonReentrantAlgorithm.cxx.
|
inlineprivateinherited |
specialization for handling Gaudi::Property<SG::VarHandleKey>
Definition at line 156 of file AthCommonDataStore.h.
|
inlineinherited |
Definition at line 145 of file AthCommonDataStore.h.
|
inlineinherited |
The standard StoreGateSvc/DetectorStore Returns (kind of) a pointer to the StoreGateSvc.
Definition at line 95 of file AthCommonDataStore.h.
|
inlineinherited |
The standard StoreGateSvc (event store) Returns (kind of) a pointer to the StoreGateSvc.
Definition at line 85 of file AthCommonDataStore.h.
|
overridevirtual |
Definition at line 164 of file CaloGPUHybridClusterProcessor.cxx.
|
protectedinherited |
Add StoreName to extra input/output deps as needed.
use the logic of the VarHandleKey to parse the DataObjID keys supplied via the ExtraInputs and ExtraOuputs Properties to add the StoreName if it's not explicitly given
|
overridevirtualinherited |
Return the list of extra output dependencies.
This list is extended to include symlinks implied by inheritance relations.
Definition at line 94 of file AthCommonReentrantAlgorithm.cxx.
|
inlinevirtualinherited |
Definition at line 96 of file AthCommonReentrantAlgorithm.h.
|
overridevirtual |
Definition at line 413 of file CaloGPUHybridClusterProcessor.cxx.
|
inlineoverrideinherited |
Definition at line 66 of file CaloGPUCUDAInitialization.h.
|
inlineoverridevirtual |
Reimplemented from CaloGPUCUDAInitialization.
Definition at line 57 of file CaloGPUHybridClusterProcessor.h.
|
overridevirtual |
Initialization that invokes CUDA functions.
Reimplemented from CaloGPUCUDAInitialization.
Definition at line 126 of file CaloGPUHybridClusterProcessor.cxx.
|
overridevirtual |
Initialization that does not invoke CUDA functions.
Reimplemented from CaloGPUCUDAInitialization.
Definition at line 40 of file CaloGPUHybridClusterProcessor.cxx.
|
overridevirtualinherited |
Return this algorithm's input handles.
We override this to include handle instances from key arrays if they have not yet been declared. See comments on updateVHKA.
|
overridevirtualinherited |
Specify if the algorithm is clonable.
Reentrant algorithms are clonable.
Reimplemented in InDet::GNNSeedingTrackMaker, InDet::SCT_Clusterization, InDet::SiSPGNNTrackMaker, InDet::SiSPSeededTrackFinder, InDet::SiTrackerSpacePointFinder, ITkPixelCablingAlg, ITkStripCablingAlg, RoIBResultToxAOD, SCT_ByteStreamErrorsTestAlg, SCT_CablingCondAlgFromCoraCool, SCT_CablingCondAlgFromText, SCT_ConditionsParameterTestAlg, SCT_ConditionsSummaryTestAlg, SCT_ConfigurationConditionsTestAlg, SCT_FlaggedConditionTestAlg, SCT_LinkMaskingTestAlg, SCT_MajorityConditionsTestAlg, SCT_ModuleVetoTestAlg, SCT_MonitorConditionsTestAlg, SCT_PrepDataToxAOD, SCT_RawDataToxAOD, SCT_ReadCalibChipDataTestAlg, SCT_ReadCalibDataTestAlg, SCT_RODVetoTestAlg, SCT_SensorsTestAlg, SCT_SiliconConditionsTestAlg, SCT_StripVetoTestAlg, SCT_TdaqEnabledTestAlg, SCT_TestCablingAlg, SCTEventFlagWriter, SCTRawDataProvider, SCTSiLorentzAngleTestAlg, SCTSiPropertiesTestAlg, and Simulation::BeamEffectsAlg.
Definition at line 68 of file AthCommonReentrantAlgorithm.cxx.
|
inlineinherited |
Definition at line 24 of file AthCommonMsg.h.
|
inlineinherited |
Definition at line 30 of file AthCommonMsg.h.
|
overridevirtualinherited |
Return this algorithm's output handles.
We override this to include handle instances from key arrays if they have not yet been declared. See comments on updateVHKA.
|
inlineprotectedinherited |
Definition at line 143 of file CaloGPUTimed.h.
|
inlineprotectedinherited |
Definition at line 105 of file CaloGPUTimed.h.
|
inlineprotectedinherited |
Definition at line 124 of file CaloGPUTimed.h.
|
inlineprotectedinherited |
Definition at line 86 of file CaloGPUTimed.h.
|
inlineprivateinherited |
Definition at line 70 of file CaloGPUTimed.h.
|
inlineprivateinherited |
Definition at line 64 of file CaloGPUTimed.h.
|
inlineprivateinherited |
Definition at line 79 of file CaloGPUTimed.h.
|
inlineprotectedinherited |
Definition at line 380 of file AthCommonDataStore.h.
|
inlineprotectedinherited |
remove all handles from I/O resolution
Definition at line 364 of file AthCommonDataStore.h.
|
inlinevirtualinherited |
Definition at line 100 of file AthCommonReentrantAlgorithm.h.
|
overridevirtualinherited |
Execute an algorithm.
We override this in order to work around an issue with the Algorithm base class storing the event context in a member variable that can cause crashes in MT jobs.
Definition at line 85 of file AthCommonReentrantAlgorithm.cxx.
|
overridevirtualinherited |
Override sysInitialize.
Override sysInitialize from the base class.
Loop through all output handles, and if they're WriteCondHandles, automatically register them and this Algorithm with the CondSvc
Scan through all outputHandles, and if they're WriteCondHandles, register them with the CondSvc
Reimplemented from AthCommonDataStore< AthCommonMsg< Gaudi::Algorithm > >.
Reimplemented in HypoBase, and InputMakerBase.
Definition at line 61 of file AthCommonReentrantAlgorithm.cxx.
|
overridevirtualinherited |
Handle START transition.
We override this in order to make sure that conditions handle keys can cache a pointer to the conditions container.
|
inlineinherited |
Definition at line 308 of file AthCommonDataStore.h.
|
mutableprivate |
A way to reduce allocations over multiple threads by keeping a cache of previously allocated objects that get assigned to the threads as they need them.
It's all thread-safe due to an internal mutex ensuring no objects get assigned to different threads.
Definition at line 159 of file CaloGPUHybridClusterProcessor.h.
|
mutableprivate |
A way to reduce allocations over multiple threads by keeping a cache of previously allocated objects that get assigned to the threads as they need them.
It's all thread-safe due to an internal mutex ensuring no objects get assigned to different threads.
Definition at line 224 of file CaloGPUHybridClusterProcessor.h.
|
mutableprivate |
Constant data, common for all events and persisted throughout the run.
Is mutable to deal with the cases where the data preparation is deferred to the first event.
Definition at line 239 of file CaloGPUHybridClusterProcessor.h.
|
private |
The name of the key in StoreGate for the output CaloClusterCellLinkContainer.
Definition at line 142 of file CaloGPUHybridClusterProcessor.h.
|
private |
The name of the key in StoreGate for the output CaloClusterContainer.
Definition at line 138 of file CaloGPUHybridClusterProcessor.h.
|
mutableprivate |
A flag to signal that the constant data has been adequately sent to the GPU.
This is required for everything to work properly in a multi-threaded context...
Definition at line 245 of file CaloGPUHybridClusterProcessor.h.
|
private |
If true, the constant data is only converted and sent to the GPU on the first event, in case not all the necessary information is available during the initialize phase.
Definition at line 148 of file CaloGPUHybridClusterProcessor.h.
|
privateinherited |
Pointer to StoreGate (detector store by default)
Definition at line 393 of file AthCommonDataStore.h.
|
private |
If true, calls the plotter specified by m_plotterTool at every tool execution.
It should be the plotter's responsibility to only take data from the tools it wants to.
Definition at line 113 of file CaloGPUHybridClusterProcessor.h.
|
privateinherited |
Pointer to StoreGate (event store by default)
Definition at line 390 of file AthCommonDataStore.h.
|
privateinherited |
Extra output dependency collection, extended by AthAlgorithmDHUpdate to add symlinks.
Empty if no symlinks were found.
Definition at line 114 of file AthCommonReentrantAlgorithm.h.
|
private |
Tools to be applied to the clusters on the GPU.
Definition at line 95 of file CaloGPUHybridClusterProcessor.h.
|
private |
Key to the handle for writing the number of cells as a decoration.
Definition at line 127 of file CaloGPUHybridClusterProcessor.h.
|
protectedinherited |
If true, times are recorded to the file given by m_timeFileName.
Defaults to false.
Definition at line 46 of file CaloGPUTimed.h.
|
mutableprivate |
This mutex is locked when sending the constant data on the first event to ensure thread safety.
Otherwise, it's unused.
Definition at line 251 of file CaloGPUHybridClusterProcessor.h.
|
private |
Number of events for which to pre-allocate space on GPU memory (should ideally be set to the expected number of threads to be run with).
Definition at line 134 of file CaloGPUHybridClusterProcessor.h.
|
private |
An optional plotter, for testing and/or debugging purposes.
Definition at line 119 of file CaloGPUHybridClusterProcessor.h.
|
private |
Tools to be applied to the clusters after returning from the GPU.
Definition at line 107 of file CaloGPUHybridClusterProcessor.h.
|
private |
Tools to be applied to the clusters before being sent to the GPU for processing.
Definition at line 82 of file CaloGPUHybridClusterProcessor.h.
|
private |
If true, both constant and event data conversion is skipped.
Definition at line 153 of file CaloGPUHybridClusterProcessor.h.
|
private |
The size of the temporary buffer to allocate for the GPU tools that will be called.
Will correspond to the maximum of all the necessary sizes for all the GPU tools.
Definition at line 232 of file CaloGPUHybridClusterProcessor.h.
|
protectedinherited |
File to which times should be saved.
Definition at line 50 of file CaloGPUTimed.h.
|
mutableprotectedinherited |
Mutex that is locked when recording times.
Definition at line 32 of file CaloGPUTimed.h.
|
private |
The tool that will convert the data from the GPU back to the CPU.
Definition at line 101 of file CaloGPUHybridClusterProcessor.h.
|
private |
The tool that will convert the constant data from the CPU to the GPU.
Definition at line 76 of file CaloGPUHybridClusterProcessor.h.
|
private |
The tool that will actually convert the data from the CPU to the GPU.
Definition at line 89 of file CaloGPUHybridClusterProcessor.h.
|
privateinherited |
Definition at line 399 of file AthCommonDataStore.h.
|
privateinherited |
Definition at line 398 of file AthCommonDataStore.h.
|
private |
If true, writes some trigger-specific decorations.
Definition at line 123 of file CaloGPUHybridClusterProcessor.h.