|
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>
|
| 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. More...
|
|
virtual StatusCode | initialize_CUDA () override |
| Initialization that invokes CUDA functions. More...
|
|
virtual StatusCode | execute (const EventContext &ctx) const override |
|
virtual StatusCode | finalize () override |
|
virtual StatusCode | sysInitialize () override |
| Override sysInitialize. More...
|
|
virtual bool | isClonable () const override |
| Specify if the algorithm is clonable. More...
|
|
virtual unsigned int | cardinality () const override |
| Cardinality (Maximum number of clones that can exist) special value 0 means that algorithm is reentrant. More...
|
|
virtual StatusCode | sysExecute (const EventContext &ctx) override |
| Execute an algorithm. More...
|
|
virtual const DataObjIDColl & | extraOutputDeps () const override |
| Return the list of extra output dependencies. More...
|
|
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 . More...
|
|
const ServiceHandle< StoreGateSvc > & | evtStore () const |
| The standard StoreGateSvc (event store) Returns (kind of) a pointer to the StoreGateSvc . More...
|
|
const ServiceHandle< StoreGateSvc > & | detStore () const |
| The standard StoreGateSvc/DetectorStore Returns (kind of) a pointer to the StoreGateSvc . More...
|
|
virtual StatusCode | sysStart () override |
| Handle START transition. More...
|
|
virtual std::vector< Gaudi::DataHandle * > | inputHandles () const override |
| Return this algorithm's input handles. More...
|
|
virtual std::vector< Gaudi::DataHandle * > | outputHandles () const override |
| Return this algorithm's output handles. More...
|
|
Gaudi::Details::PropertyBase & | declareProperty (Gaudi::Property< T > &t) |
|
Gaudi::Details::PropertyBase * | declareProperty (const std::string &name, SG::VarHandleKey &hndl, const std::string &doc, const SG::VarHandleKeyType &) |
| Declare a new Gaudi property. More...
|
|
Gaudi::Details::PropertyBase * | declareProperty (const std::string &name, SG::VarHandleBase &hndl, const std::string &doc, const SG::VarHandleType &) |
| Declare a new Gaudi property. More...
|
|
Gaudi::Details::PropertyBase * | declareProperty (const std::string &name, SG::VarHandleKeyArray &hndArr, const std::string &doc, const SG::VarHandleKeyArrayType &) |
|
Gaudi::Details::PropertyBase * | declareProperty (const std::string &name, T &property, const std::string &doc, const SG::NotHandleType &) |
| Declare a new Gaudi property. More...
|
|
Gaudi::Details::PropertyBase * | declareProperty (const std::string &name, T &property, const std::string &doc="none") |
| Declare a new Gaudi property. More...
|
|
void | updateVHKA (Gaudi::Details::PropertyBase &) |
|
MsgStream & | msg () const |
|
MsgStream & | msg (const MSG::Level lvl) const |
|
bool | msgLvl (const MSG::Level lvl) const |
|
void | handle (const Incident &incident) override |
|
|
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. More...
|
|
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. More...
|
|
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. More...
|
|
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. More...
|
|
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. More...
|
|
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. More...
|
|
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. More...
|
|
ToolHandle< ICaloClusterGPUPlotter > | m_plotterTool {this, "PlotterTool", "", "An optional plotter, for testing and/or debugging purposes"} |
| An optional plotter, for testing and/or debugging purposes. More...
|
|
Gaudi::Property< bool > | m_doMonitoring {this, "DoMonitoring", false, "Do monitoring."} |
| If true , uses the monitoring tool specified by m_monitorTool . More...
|
|
Gaudi::Property< bool > | m_monitorCells {this, "MonitorCells", false, "Whether to monitor cells too."} |
|
Gaudi::Property< float > | m_monitoring1thr { this, "Thr1", 2, "First Threshold to pass for cell monitoring" } |
|
Gaudi::Property< float > | m_monitoring2thr { this, "Thr2", 4, "Second Threshold to pass for cell monitoring" } |
|
SG::ReadCondHandleKey< CaloNoise > | m_noiseCDOKey {this, "CaloNoiseKey", "totalNoise", "SG Key of CaloNoise data object"} |
|
ToolHandle< GenericMonitoringTool > | m_moniTool { this, "MonitoringTool", "", "Monitoring tool" } |
| Monitoring tool. More...
|
|
SG::ReadDecorHandleKey< xAOD::EventInfo > | m_avgMuKey { this, "averageInteractionsPerCrossingKey", "EventInfo.averageInteractionsPerCrossing", "Decoration for Average Interaction Per Crossing" } |
| Event input: To get <mu> from Event Info. More...
|
|
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. More...
|
|
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. More...
|
|
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). More...
|
|
SG::ReadHandleKey< CaloCellContainer > | m_cellsKey {this, "CellsName", "", "Name(s) of Cell Containers"} |
| vector of names of the cell containers to use as input. More...
|
|
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. More...
|
|
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. More...
|
|
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. More...
|
|
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. More...
|
|
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. More...
|
|
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. More...
|
|
size_t | m_temporariesSize |
| The size of the temporary buffer to allocate for the GPU tools that will be called. More...
|
|
CaloRecGPU::ConstantDataHolder m_constantData | ATLAS_THREAD_SAFE |
| Constant data, common for all events and persisted throughout the run. More...
|
|
std::atomic< bool > | m_constantDataSent |
| A flag to signal that the constant data has been adequately sent to the GPU. More...
|
|
std::mutex | m_mutex |
| This mutex is locked when sending the constant data on the first event to ensure thread safety. More...
|
|
DataObjIDColl | m_extendedExtraObjects |
| Extra output dependency collection, extended by AthAlgorithmDHUpdate to add symlinks. More...
|
|
StoreGateSvc_t | m_evtStore |
| Pointer to StoreGate (event store by default) More...
|
|
StoreGateSvc_t | m_detStore |
| Pointer to StoreGate (detector store by default) More...
|
|
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.
- Author
- Nuno Fernandes nuno..nosp@m.dos..nosp@m.santo.nosp@m.s.fe.nosp@m.rnand.nosp@m.es@c.nosp@m.ern.c.nosp@m.h
- Date
- 27 May 2022 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 51 of file CaloGPUHybridClusterProcessor.h.
◆ StoreGateSvc_t
◆ CaloGPUHybridClusterProcessor()
CaloGPUHybridClusterProcessor::CaloGPUHybridClusterProcessor |
( |
const std::string & |
name, |
|
|
ISvcLocator * |
pSvcLocator |
|
) |
| |
◆ ~CaloGPUHybridClusterProcessor()
virtual CaloGPUHybridClusterProcessor::~CaloGPUHybridClusterProcessor |
( |
| ) |
|
|
overridevirtualdefault |
◆ cardinality()
unsigned int AthReentrantAlgorithm::cardinality |
( |
| ) |
const |
|
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.
Override this to return 0 for reentrant algorithms.
Definition at line 55 of file AthReentrantAlgorithm.cxx.
◆ declareGaudiProperty() [1/4]
specialization for handling Gaudi::Property<SG::VarHandleKeyArray>
Definition at line 170 of file AthCommonDataStore.h.
175 hndl.documentation());
◆ declareGaudiProperty() [2/4]
specialization for handling Gaudi::Property<SG::VarHandleKey>
Definition at line 156 of file AthCommonDataStore.h.
161 hndl.documentation());
◆ declareGaudiProperty() [3/4]
specialization for handling Gaudi::Property<SG::VarHandleBase>
Definition at line 184 of file AthCommonDataStore.h.
189 hndl.documentation());
◆ declareGaudiProperty() [4/4]
◆ declareProperty() [1/6]
Declare a new Gaudi property.
- Parameters
-
name | Name of the property. |
hndl | Object holding the property value. |
doc | Documentation string for the property. |
This is the version for types that derive from SG::VarHandleBase
. The property value object is put on the input and output lists as appropriate; then we forward to the base class.
Definition at line 245 of file AthCommonDataStore.h.
250 this->declare(hndl.
vhKey());
251 hndl.
vhKey().setOwner(
this);
◆ declareProperty() [2/6]
Declare a new Gaudi property.
- Parameters
-
name | Name of the property. |
hndl | Object holding the property value. |
doc | Documentation string for the property. |
This is the version for types that derive from SG::VarHandleKey
. The property value object is put on the input and output lists as appropriate; then we forward to the base class.
Definition at line 221 of file AthCommonDataStore.h.
◆ declareProperty() [3/6]
◆ declareProperty() [4/6]
Declare a new Gaudi property.
- Parameters
-
name | Name of the property. |
property | Object holding the property value. |
doc | Documentation string for the property. |
This is the generic version, for types that do not derive from SG::VarHandleKey
. It just forwards to the base class version of declareProperty
.
Definition at line 333 of file AthCommonDataStore.h.
◆ declareProperty() [5/6]
Declare a new Gaudi property.
- Parameters
-
name | Name of the property. |
property | Object holding the property value. |
doc | Documentation string for the property. |
This dispatches to either the generic declareProperty
or the one for VarHandle/Key/KeyArray.
Definition at line 352 of file AthCommonDataStore.h.
◆ declareProperty() [6/6]
◆ detStore()
◆ evtStore() [1/2]
◆ evtStore() [2/2]
◆ execute()
StatusCode CaloGPUHybridClusterProcessor::execute |
( |
const EventContext & |
ctx | ) |
const |
|
overridevirtual |
Definition at line 179 of file CaloGPUHybridClusterProcessor.cxx.
201 ATH_CHECK( cluster_collection.record (std::make_unique<xAOD::CaloClusterContainer>(), std::make_unique<xAOD::CaloClusterTrigAuxContainer> () ));
214 std::lock_guard<std::mutex> lock_guard(
m_mutex);
231 ATH_MSG_ERROR(
"Could not get valid Event Data Holder! Event: " << ctx.evt() );
232 return StatusCode::FAILURE;
241 simple_GPU_pointer_holder * temporaries_data_ptr_holder =
nullptr;
244 if (!temporaries_data_ptr_holder)
246 ATH_MSG_ERROR(
"temporaries_data_ptr_holder is null in CaloGPUHybridClusterProcessor::execute" );
247 return StatusCode::FAILURE;
254 ATH_MSG_ERROR(
"Could not get valid temporary buffer holder! Event: " << ctx.evt() );
255 return StatusCode::FAILURE;
261 using clock_type = boost::chrono::thread_clock;
262 auto time_cast = [](
const auto & before,
const auto & after)
264 return boost::chrono::duration_cast<boost::chrono::microseconds>(after - before).count();
267 std::vector<size_t>
times;
269 size_t plot_time = 0;
276 times.reserve(time_size);
286 plot_time += time_cast(
t1,
t2);
292 time_clusMaker.start();
298 ATH_CHECK( pre_GPU_tool->execute(ctx, cluster_collection_ptr) );
307 ATH_CHECK(
m_plotterTool->update_plots(ctx, constant_data_holder, cluster_collection_ptr, pre_GPU_tool.get()) );
311 plot_time += time_cast(
t3,
t4);
334 plot_time += time_cast(
t1,
t2);
341 ATH_CHECK( GPU_tool->execute(ctx, constant_data_holder, *event_data_ptr, temporaries_data_ptr_holder->get_pointer()) );
350 ATH_CHECK(
m_plotterTool->update_plots(ctx, constant_data_holder, cluster_collection_ptr, *event_data_ptr, GPU_tool.get()) );
354 plot_time += time_cast(
t3,
t4);
377 plot_time += time_cast(
t1,
t2);
383 time_clusMaker.stop();
384 time_clusCorr.start();
390 ATH_CHECK( post_GPU_tool->execute(ctx, cluster_collection_ptr) );
394 times.push_back(time_cast(t9, t10));
399 ATH_CHECK(
m_plotterTool->update_plots(ctx, constant_data_holder, cluster_collection_ptr, post_GPU_tool.get()) );
403 plot_time += time_cast(
t3,
t4);
415 plot_time += time_cast(
t1,
t2);
428 decor_handle(*
cl) = 0;
432 decor_handle(*
cl) = cell_links->
size();
437 ATH_MSG_DEBUG(
"Created cluster container with " << cluster_collection->size() <<
" clusters");
447 times.push_back(plot_time);
455 time_clusCorr.stop();
460 std::vector<double> clus_phi;
461 std::vector<double> clus_eta;
462 std::vector<double> N_BAD_CELLS;
463 std::vector<double> ENG_FRAC_MAX;
464 std::vector<unsigned int> sizeVec;
475 auto moncount_1thrsigma_by_mu2 =
Monitored::Scalar(
"count_1thrsigma_by_mu2", -999.0);
476 auto moncount_2thrsigma_by_mu2 =
Monitored::Scalar(
"count_2thrsigma_by_mu2", -999.0);
478 mon_clusEt, mon_clusPhi, mon_clusEta, mon_clusSignalState, mon_clusSize,
479 mon_badCells, mon_engFrac, mon_size, monmu, moncount_1thrsigma, moncount_2thrsigma,
480 mon_container_size_by_mu, moncount_1thrsigma_by_mu2, moncount_2thrsigma_by_mu2 );
483 mon_container_size = cluster_collection_ptr->size();
488 if (! num_cell_links)
490 sizeVec.push_back(0);
494 sizeVec.push_back(num_cell_links->
size());
496 clus_phi.push_back(
cl->phi());
497 clus_eta.push_back(
cl->eta());
505 if (eventInfoDecor.isPresent())
507 read_mu = eventInfoDecor(0);
512 int count_1thrsigma = 0, count_2thrsigma = 0;
517 if ( !cell_collection.isValid() )
519 ATH_MSG_ERROR(
" Cannot retrieve CaloCellContainer: " << cell_collection.name() );
520 return StatusCode::FAILURE;
525 for (
const auto &
cell : *cell_collection)
535 count_1thrsigma += 1;
538 count_2thrsigma += 1;
544 moncount_1thrsigma = count_1thrsigma;
545 moncount_2thrsigma = count_2thrsigma;
549 const float rev_mu = 1.f / read_mu;
550 mon_container_size_by_mu = rev_mu * cluster_collection_ptr->size();
551 const float sqr_rev_mu = rev_mu * rev_mu;
552 moncount_1thrsigma_by_mu2 = sqr_rev_mu * count_1thrsigma;
553 moncount_2thrsigma_by_mu2 = sqr_rev_mu * count_2thrsigma;
559 return StatusCode::SUCCESS;
◆ extraDeps_update_handler()
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
◆ extraOutputDeps()
const DataObjIDColl & AthReentrantAlgorithm::extraOutputDeps |
( |
| ) |
const |
|
overridevirtualinherited |
Return the list of extra output dependencies.
This list is extended to include symlinks implied by inheritance relations.
Definition at line 79 of file AthReentrantAlgorithm.cxx.
86 return Algorithm::extraOutputDeps();
◆ filterPassed()
virtual bool AthReentrantAlgorithm::filterPassed |
( |
const EventContext & |
ctx | ) |
const |
|
inlinevirtualinherited |
◆ finalize()
StatusCode CaloGPUHybridClusterProcessor::finalize |
( |
| ) |
|
|
overridevirtual |
Definition at line 562 of file CaloGPUHybridClusterProcessor.cxx.
566 std::string header_string;
568 auto add_name_to_string = [&](
const auto &
obj)
570 std::string
rep =
obj->name();
572 header_string +=
rep +
" ";
577 add_name_to_string(pre_GPU_tool);
587 add_name_to_string(GPU_tool);
597 add_name_to_string(post_GPU_tool);
613 return StatusCode::SUCCESS;
◆ handle()
void CaloGPUCUDAInitialization::handle |
( |
const Incident & |
incident | ) |
|
|
inlineoverrideinherited |
Definition at line 66 of file CaloGPUCUDAInitialization.h.
68 const bool is_multiprocess = (Gaudi::Concurrency::ConcurrencyFlags::numProcs() > 0);
73 throw GaudiException(
"Failed to perform the CUDA initialization!",
74 "CaloGPUCUDAInitialization::handle",
◆ initialize()
virtual StatusCode CaloGPUHybridClusterProcessor::initialize |
( |
| ) |
|
|
inlineoverridevirtual |
◆ initialize_CUDA()
StatusCode CaloGPUHybridClusterProcessor::initialize_CUDA |
( |
| ) |
|
|
overridevirtual |
◆ initialize_non_CUDA()
StatusCode CaloGPUHybridClusterProcessor::initialize_non_CUDA |
( |
| ) |
|
|
overridevirtual |
Initialization that does not invoke CUDA functions.
Reimplemented from CaloGPUCUDAInitialization.
Definition at line 40 of file CaloGPUHybridClusterProcessor.cxx.
51 bool any_failed =
false;
53 auto retrieve_and_report = [&](
auto &
var,
const auto &
type,
bool & falsify_if_empty)
57 falsify_if_empty =
false;
60 else if (
var.retrieve().isFailure())
116 return StatusCode::FAILURE;
137 return StatusCode::SUCCESS;
◆ inputHandles()
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.
◆ isClonable()
bool AthReentrantAlgorithm::isClonable |
( |
| ) |
const |
|
overridevirtualinherited |
Specify if the algorithm is clonable.
Reentrant algorithms are clonable.
Reimplemented in Simulation::BeamEffectsAlg, InDet::SiTrackerSpacePointFinder, InDet::SCT_Clusterization, InDet::SiSPSeededTrackFinder, SCTRawDataProvider, InDet::GNNSeedingTrackMaker, SCT_PrepDataToxAOD, RoIBResultToxAOD, SCT_CablingCondAlgFromCoraCool, SCT_ReadCalibDataTestAlg, SCT_CablingCondAlgFromText, InDet::SiSPGNNTrackMaker, SCT_ReadCalibChipDataTestAlg, SCT_TestCablingAlg, SCT_ConfigurationConditionsTestAlg, ITkPixelCablingAlg, ITkStripCablingAlg, SCTEventFlagWriter, SCT_ConditionsSummaryTestAlg, SCT_ModuleVetoTestAlg, SCT_MonitorConditionsTestAlg, SCT_LinkMaskingTestAlg, SCT_MajorityConditionsTestAlg, SCT_RODVetoTestAlg, SCT_SensorsTestAlg, SCT_TdaqEnabledTestAlg, SCT_SiliconConditionsTestAlg, SCTSiLorentzAngleTestAlg, SCT_ByteStreamErrorsTestAlg, SCT_ConditionsParameterTestAlg, SCT_FlaggedConditionTestAlg, SCT_StripVetoTestAlg, SCT_RawDataToxAOD, and SCTSiPropertiesTestAlg.
Definition at line 44 of file AthReentrantAlgorithm.cxx.
◆ msg() [1/2]
◆ msg() [2/2]
◆ msgLvl()
◆ outputHandles()
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.
◆ print_times()
void CaloGPUTimed::print_times |
( |
const std::string & |
header, |
|
|
const size_t |
time_size |
|
) |
| const |
|
inlineprotectedinherited |
Definition at line 143 of file CaloGPUTimed.h.
145 std::shared_lock<std::shared_mutex> lock(
m_timeMutex);
152 std::vector<size_t>
indices(m_eventNumbers.size());
157 return m_eventNumbers[a] < m_eventNumbers[b];
162 out <<
"Event_Number Total " <<
header <<
"\n";
166 out << m_eventNumbers[
idx] <<
" ";
170 for (
size_t i = 0;
i < time_size; ++
i)
172 total += m_times[
idx * time_size +
i];
177 for (
size_t i = 0;
i < time_size; ++
i)
179 out << m_times[
idx * time_size +
i] <<
" ";
◆ record_times() [1/3]
template<class ... Args>
void CaloGPUTimed::record_times |
( |
const size_t |
event_num, |
|
|
const size_t & |
value |
|
) |
| const |
|
inlineprotectedinherited |
Definition at line 105 of file CaloGPUTimed.h.
107 const size_t time_size = 1;
112 std::unique_lock<std::shared_mutex> lock(
m_timeMutex);
113 old_size = m_times.size();
114 m_times.resize(old_size + time_size);
115 m_eventNumbers.push_back(event_num);
118 std::shared_lock<std::shared_mutex> lock(
m_timeMutex);
◆ record_times() [2/3]
template<class ... Args>
void CaloGPUTimed::record_times |
( |
const size_t |
event_num, |
|
|
const size_t & |
value, |
|
|
Args &&... |
args |
|
) |
| const |
|
inlineprotectedinherited |
Definition at line 124 of file CaloGPUTimed.h.
126 const size_t time_size =
sizeof...(args) + 1;
131 std::unique_lock<std::shared_mutex> lock(
m_timeMutex);
132 old_size = m_times.size();
133 m_times.resize(old_size + time_size);
134 m_eventNumbers.push_back(event_num);
137 std::shared_lock<std::shared_mutex> lock(
m_timeMutex);
◆ record_times() [3/3]
void CaloGPUTimed::record_times |
( |
const size_t |
event_num, |
|
|
const std::vector< size_t > & |
times |
|
) |
| const |
|
inlineprotectedinherited |
Definition at line 86 of file CaloGPUTimed.h.
90 std::unique_lock<std::shared_mutex> lock(
m_timeMutex);
91 old_size = m_times.size();
92 m_times.resize(old_size +
times.size());
93 m_eventNumbers.push_back(event_num);
96 std::shared_lock<std::shared_mutex> lock(
m_timeMutex);
97 for (
size_t i = 0;
i <
times.size(); ++
i)
99 m_times[old_size +
i] =
times[
i];
◆ record_times_helper() [1/3]
template<class Arg >
void CaloGPUTimed::record_times_helper |
( |
const size_t |
index, |
|
|
Arg && |
arg |
|
) |
| const |
|
inlineprivateinherited |
◆ record_times_helper() [2/3]
void CaloGPUTimed::record_times_helper |
( |
const |
size_t | ) |
const |
|
inlineprivateinherited |
◆ record_times_helper() [3/3]
template<class ... Args>
void CaloGPUTimed::record_times_helper |
( |
size_t |
index, |
|
|
Args &&... |
args |
|
) |
| const |
|
inlineprivateinherited |
◆ renounce()
◆ renounceArray()
◆ setFilterPassed()
virtual void AthReentrantAlgorithm::setFilterPassed |
( |
bool |
state, |
|
|
const EventContext & |
ctx |
|
) |
| const |
|
inlinevirtualinherited |
◆ sysExecute()
StatusCode AthReentrantAlgorithm::sysExecute |
( |
const EventContext & |
ctx | ) |
|
|
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 67 of file AthReentrantAlgorithm.cxx.
69 return Gaudi::Algorithm::sysExecute (ctx);
◆ sysInitialize()
StatusCode AthReentrantAlgorithm::sysInitialize |
( |
| ) |
|
|
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 InputMakerBase, and HypoBase.
Definition at line 96 of file AthReentrantAlgorithm.cxx.
107 if ( cs.retrieve().isFailure() ) {
109 return StatusCode::SUCCESS;
111 if (cs->regHandle(
this,*
h).isFailure()) {
112 sc = StatusCode::FAILURE;
113 ATH_MSG_ERROR(
"unable to register WriteCondHandle " <<
h->fullKey()
◆ sysStart()
Handle START transition.
We override this in order to make sure that conditions handle keys can cache a pointer to the conditions container.
◆ updateVHKA()
◆ ATLAS_THREAD_SAFE [1/3]
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 184 of file CaloGPUHybridClusterProcessor.h.
◆ ATLAS_THREAD_SAFE [2/3]
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 249 of file CaloGPUHybridClusterProcessor.h.
◆ ATLAS_THREAD_SAFE [3/3]
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 264 of file CaloGPUHybridClusterProcessor.h.
◆ m_avgMuKey
◆ m_cellsKey
◆ m_clusterCellLinkOutput
◆ m_clusterOutput
◆ m_constantDataSent
std::atomic<bool> CaloGPUHybridClusterProcessor::m_constantDataSent |
|
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 270 of file CaloGPUHybridClusterProcessor.h.
◆ m_deferConstantDataToFirstEvent
Gaudi::Property<bool> CaloGPUHybridClusterProcessor::m_deferConstantDataToFirstEvent {this, "DeferConstantDataPreparationToFirstEvent", true, "Convert and send event data on first event instead of during initialize (needed for exporting geometry and noise properly)?"} |
|
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 173 of file CaloGPUHybridClusterProcessor.h.
◆ m_detStore
◆ m_doMonitoring
Gaudi::Property<bool> CaloGPUHybridClusterProcessor::m_doMonitoring {this, "DoMonitoring", false, "Do monitoring."} |
|
private |
◆ m_doPlots
Gaudi::Property<bool> CaloGPUHybridClusterProcessor::m_doPlots {this, "DoPlots", false, "Do plots based on the plotter tool optionally provided."} |
|
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 114 of file CaloGPUHybridClusterProcessor.h.
◆ m_evtStore
◆ m_extendedExtraObjects
DataObjIDColl AthReentrantAlgorithm::m_extendedExtraObjects |
|
privateinherited |
Extra output dependency collection, extended by AthAlgorithmDHUpdate to add symlinks.
Empty if no symlinks were found.
Definition at line 153 of file AthReentrantAlgorithm.h.
◆ m_GPUoperations
ToolHandleArray<CaloClusterGPUProcessor> CaloGPUHybridClusterProcessor::m_GPUoperations {this, "GPUTools", {}, "Tools to be applied to the clusters on the GPU"} |
|
private |
◆ m_mDecor_ncells
◆ m_measureTimes
Gaudi::Property<bool> CaloGPUTimed::m_measureTimes |
|
protectedinherited |
If true
, times are recorded to the file given by m_timeFileName
.
Defaults to false
.
Definition at line 46 of file CaloGPUTimed.h.
◆ m_moniTool
◆ m_monitorCells
Gaudi::Property<bool> CaloGPUHybridClusterProcessor::m_monitorCells {this, "MonitorCells", false, "Whether to monitor cells too."} |
|
private |
◆ m_monitoring1thr
Gaudi::Property<float> CaloGPUHybridClusterProcessor::m_monitoring1thr { this, "Thr1", 2, "First Threshold to pass for cell monitoring" } |
|
private |
◆ m_monitoring2thr
Gaudi::Property<float> CaloGPUHybridClusterProcessor::m_monitoring2thr { this, "Thr2", 4, "Second Threshold to pass for cell monitoring" } |
|
private |
◆ m_mutex
std::mutex CaloGPUHybridClusterProcessor::m_mutex |
|
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 276 of file CaloGPUHybridClusterProcessor.h.
◆ m_noiseCDOKey
◆ m_numPreAllocatedGPUData
Gaudi::Property<size_t> CaloGPUHybridClusterProcessor::m_numPreAllocatedGPUData {this, "NumPreAllocatedDataHolders", 0, "Number of event data holders to pre-allocate on GPU memory"} |
|
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 154 of file CaloGPUHybridClusterProcessor.h.
◆ m_plotterTool
ToolHandle<ICaloClusterGPUPlotter> CaloGPUHybridClusterProcessor::m_plotterTool {this, "PlotterTool", "", "An optional plotter, for testing and/or debugging purposes"} |
|
private |
◆ m_postGPUoperations
ToolHandleArray<CaloClusterCollectionProcessor> CaloGPUHybridClusterProcessor::m_postGPUoperations {this, "AfterGPUTools", {}, "Tools to be applied to the clusters on the CPU after returning from the GPU"} |
|
private |
◆ m_preGPUoperations
ToolHandleArray<CaloClusterCollectionProcessor> CaloGPUHybridClusterProcessor::m_preGPUoperations {this, "BeforeGPUTools", {}, "Tools to be applied to the clusters on the CPU before processing them on the GPU"} |
|
private |
◆ m_skipConversions
Gaudi::Property<bool> CaloGPUHybridClusterProcessor::m_skipConversions {this, "SkipConversions", false, "If true, skip converting CPU to GPU data (useful if only instanting CPU tools)"} |
|
private |
◆ m_temporariesSize
size_t CaloGPUHybridClusterProcessor::m_temporariesSize |
|
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.
- Warning
- Every tool should consider the buffer as filled with uninitialized memory at their start.
Definition at line 257 of file CaloGPUHybridClusterProcessor.h.
◆ m_timeFileName
Gaudi::Property<std::string> CaloGPUTimed::m_timeFileName |
|
protectedinherited |
File to which times should be saved.
Definition at line 50 of file CaloGPUTimed.h.
◆ m_timeMutex
std::shared_mutex CaloGPUTimed::m_timeMutex |
|
mutableprotectedinherited |
Mutex that is locked when recording times.
Definition at line 32 of file CaloGPUTimed.h.
◆ m_transformBackToCPU
◆ m_transformConstantData
◆ m_transformForGPU
◆ m_varHandleArraysDeclared
◆ m_vhka
◆ m_writeTriggerSpecificInfo
Gaudi::Property<bool> CaloGPUHybridClusterProcessor::m_writeTriggerSpecificInfo {this, "WriteTriggerSpecificInfo", false, "Write some trigger-specific decorations and use the trigger auxiliary container."} |
|
private |
The documentation for this class was generated from the following files:
std::vector< LUCID_DigitContainer_p2 > t6
std::string replace(std::string s, const std::string &s2, const std::string &s3)
ToolHandle< ICaloClusterGPUOutputTransformer > m_transformBackToCPU
The tool that will convert the data from the GPU back to the CPU.
Gaudi::Property< bool > m_skipConversions
If true, both constant and event data conversion is skipped.
static StatusCode finalizeClusters(SG::WriteHandle< CaloClusterCellLinkContainer > &h, xAOD::CaloClusterContainer *pClusterColl)
Finalize clusters (move CaloClusterCellLink to a separate container).
Group
Properties of a chain group.
static StatusCode AddContainerWriteHandle(SG::WriteHandle< xAOD::CaloClusterContainer > &clusColl)
Creates a new xAOD::CaloClusterContainer in the given WriteHandle + CaloClusterAuxContainer and recor...
std::shared_mutex m_timeMutex
Mutex that is locked when recording times.
std::vector< LUCID_SimHit_p3 > t8
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T > &t)
std::vector< LUCID_RawData_p1 > t3
std::pair< long int, long int > indices
size_t m_temporariesSize
The size of the temporary buffer to allocate for the GPU tools that will be called.
This class groups all DetDescr information related to a CaloCell. Provides a generic interface for al...
Gaudi::Property< bool > m_doMonitoring
If true, uses the monitoring tool specified by m_monitorTool.
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)
std::vector< ALFA_RawDataCollection_p1 > t1
SG::ReadDecorHandleKey< xAOD::EventInfo > m_avgMuKey
Event input: To get <mu> from Event Info.
Gaudi::Property< bool > m_writeTriggerSpecificInfo
If true, writes some trigger-specific decorations.
ToolHandle< ICaloClusterGPUPlotter > m_plotterTool
An optional plotter, for testing and/or debugging purposes.
StoreGateSvc_t m_evtStore
Pointer to StoreGate (event store by default)
Gaudi::Property< std::string > m_timeFileName
File to which times should be saved.
std::vector< SG::VarHandleKeyArray * > m_vhka
std::vector< LUCID_SimHit_p2 > t7
State signalState() const
Get the current signal state.
const std::string & key() const
Return the StoreGate ID for the referenced object.
@ ENG_FRAC_MAX
Energy fraction of hottest cell.
ToolHandleArray< CaloClusterGPUProcessor > m_GPUoperations
Tools to be applied to the clusters on the GPU.
float getNoise(const IdentifierHash h, const int gain) const
Accessor by IdentifierHash and gain.
Gaudi::Property< float > m_monitoring1thr
ValuesCollection< T > Collection(std::string name, const T &collection)
Declare a monitored (double-convertible) collection.
virtual void setOwner(IDataHandleHolder *o)=0
Gaudi::Property< bool > m_doPlots
If true, calls the plotter specified by m_plotterTool at every tool execution.
virtual StatusCode initialize()
Gaudi::Property< float > m_monitoring2thr
Bookkeeping of cells that make up a cluster Simplified replacement for CaloCellLink,...
ClusterSize clusterSize() const
Get cluster size.
SG::ReadCondHandleKey< CaloNoise > m_noiseCDOKey
ToolHandle< GenericMonitoringTool > m_moniTool
Monitoring tool.
Description of a calorimeter cluster.
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 ...
std::mutex m_mutex
This mutex is locked when sending the constant data on the first event to ensure thread safety.
AthReentrantAlgorithm()
Default constructor:
void allocate(const bool also_GPU=true)
Handle class for reading a decoration on an object.
virtual std::vector< Gaudi::DataHandle * > outputHandles() const override
Return this algorithm's output handles.
::StatusCode StatusCode
StatusCode definition for legacy code.
Handle class for adding a decoration to an object.
void print_times(const std::string &header, const size_t time_size) const
Gaudi::Property< bool > m_deferConstantDataToFirstEvent
If true, the constant data is only converted and sent to the GPU on the first event,...
Gaudi::Property< bool > m_monitorCells
StoreGateSvc_t m_detStore
Pointer to StoreGate (detector store by default)
StatusCode initialize(bool used=true)
If this object is used as a property, then this should be called during the initialize phase.
DataObjIDColl m_extendedExtraObjects
Extra output dependency collection, extended by AthAlgorithmDHUpdate to add symlinks.
std::atomic< bool > m_constantDataSent
A flag to signal that the constant data has been adequately sent to the GPU.
std::vector< LUCID_RawDataContainer_p1 > t4
virtual void renounce()=0
SG::WriteHandleKey< CaloClusterCellLinkContainer > m_clusterCellLinkOutput
The name of the key in StoreGate for the output CaloClusterCellLinkContainer.
std::conditional< std::is_base_of< SG::VarHandleKeyArray, T >::value, VarHandleKeyArrayType, type2 >::type type
bool is_tile() const
cell belongs to Tile
SG::ReadHandleKey< CaloCellContainer > m_cellsKey
vector of names of the cell containers to use as input.
IdentifierHash identifyHash() const override final
cell subcalo hash same as subcalo_hash(), but kept for backward compatibility
size_t size() const
size method
virtual StatusCode sysInitialize() override
Override sysInitialize.
StatusCode initialize(bool used=true)
static const std::string & type()
Incident type.
ToolHandleArray< CaloClusterCollectionProcessor > m_postGPUoperations
Tools to be applied to the clusters after returning from the GPU.
void record_times_helper(const size_t) const
virtual StatusCode initialize_CUDA()
Initialization that invokes CUDA functions.
std::vector< LUCID_Digit_p2 > t5
std::vector< ALFA_RawDataContainer_p1 > t2
SG::WriteDecorHandleKey< xAOD::CaloClusterContainer > m_mDecor_ncells
Key to the handle for writing the number of cells as a decoration.
void record_times(const size_t event_num, const std::vector< size_t > ×) const
void sort(typename std::reverse_iterator< DataModel_detail::iterator< DVL > > beg, typename std::reverse_iterator< DataModel_detail::iterator< DVL > > end, const Compare &comp)
Specialization of sort for DataVector/List.
#define ATH_MSG_WARNING(x)
Gaudi::Property< bool > m_measureTimes
If true, times are recorded to the file given by m_timeFileName.
SG::VarHandleKey & vhKey()
Return a non-const reference to the HandleKey.
Gaudi::Property< size_t > m_numPreAllocatedGPUData
Number of events for which to pre-allocate space on GPU memory (should ideally be set to the expected...
ToolHandleArray< CaloClusterCollectionProcessor > m_preGPUoperations
Tools to be applied to the clusters before being sent to the GPU for processing.
Declare a monitored scalar variable.
cl
print [x.__class__ for x in toList(dqregion.getSubRegions()) ]
@ N_BAD_CELLS
number of bad cells
Gaudi::Details::PropertyBase & declareGaudiProperty(Gaudi::Property< T > &hndl, const SG::VarHandleKeyType &)
specialization for handling Gaudi::Property<SG::VarHandleKey>
SG::WriteHandleKey< xAOD::CaloClusterContainer > m_clusterOutput
The name of the key in StoreGate for the output CaloClusterContainer.
ToolHandle< ICaloClusterGPUConstantTransformer > m_transformConstantData
The tool that will convert the constant data from the CPU to the GPU.
ToolHandle< ICaloClusterGPUInputTransformer > m_transformForGPU
The tool that will actually convert the data from the CPU to the GPU.