|
ATLAS Offline Software
|
Standard tool to calculate cluster info (energy, transverse energy, pseudo-rapidity and azimuthal angle) and apply E/ET cuts on clusters if desired.
More...
#include <BasicGPUClusterInfoCalculator.h>
|
| BasicGPUClusterInfoCalculator (const std::string &type, const std::string &name, const IInterface *parent) |
|
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 CaloRecGPU::ConstantDataHolder &constant_data, CaloRecGPU::EventDataHolder &event_data, void *temporary_buffer) const override |
| Process the clusters on GPU. More...
|
|
virtual StatusCode | finalize () override |
|
virtual | ~BasicGPUClusterInfoCalculator ()=default |
|
virtual size_t | size_of_temporaries () const override |
| The size (in bytes) of the temporary object(s) that the algorithm will use. More...
|
|
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 | sysInitialize () override |
| Perform system initialization for an algorithm. 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 |
|
| DeclareInterfaceID (CaloClusterGPUProcessor, 1, 0) |
|
void | handle (const Incident &incident) override |
|
|
Gaudi::Property< bool > | m_preserveClusterMoments {this, "PreserveClusterMoments", false, "Do not use cluster moments array as temporary storage"} |
| If set to true , allocates a temporary array to store some temporary intermediate results instead of using cluster moments. More...
|
|
Gaudi::Property< bool > | m_cutClustersInAbsE {this, "ClusterCutsInAbsEt", true, "Do cluster cuts in Abs Et instead of Et"} |
| if set to true cluster cuts are on \(|E|_\perp\), if false on \(E_\perp\). More...
|
|
Gaudi::Property< float > | m_clusterETThreshold {this, "ClusterEtorAbsEtCut", 0.*CLHEP::MeV, "Cluster E_t or Abs E_t cut"} |
| \(E_\perp\) cut on the clusters. More...
|
|
ServiceHandle< IGPUKernelSizeOptimizerSvc > | m_kernelSizeOptimizer { this, "KernelSizeOptimizer", "GPUKernelSizeOptimizerSvc", "CUDA kernel size optimization service." } |
| Handle to the CUDA kernel block and grid size optimization service. 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 |
|
Standard tool to calculate cluster info (energy, transverse energy, pseudo-rapidity and azimuthal angle) and apply E/ET cuts on clusters if desired.
- 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
- 11 August 2022
Definition at line 34 of file BasicGPUClusterInfoCalculator.h.
◆ StoreGateSvc_t
◆ BasicGPUClusterInfoCalculator()
BasicGPUClusterInfoCalculator::BasicGPUClusterInfoCalculator |
( |
const std::string & |
type, |
|
|
const std::string & |
name, |
|
|
const IInterface * |
parent |
|
) |
| |
◆ ~BasicGPUClusterInfoCalculator()
virtual BasicGPUClusterInfoCalculator::~BasicGPUClusterInfoCalculator |
( |
| ) |
|
|
virtualdefault |
◆ 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]
◆ DeclareInterfaceID()
◆ 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);
253 return PBASE::declareProperty(
name,hndl,
doc);
◆ 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.
229 return PBASE::declareProperty(
name,hndl,
doc);
◆ 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.
338 return PBASE::declareProperty(
name, property,
doc);
◆ 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()
Process the clusters on GPU.
- Parameters
-
ctx | The event context. |
constant_data | Data held in GPU memory that is common to all events (cell noise and geometry). |
event_data | Data held in GPU memory that is specific to this event (including the description of the clusters themselves). |
temporary_buffer | A pointer to an \array in GPU memory that is at least as large as size_of_temporaries() , to hold temporary information for the algorithms. Given the way CUDA memory allocations work, casting this to a pointer (or a CaloRecGPU::Helpers::CUDA_kernel_object ) to the intended type and then using it will be perfectly valid. |
Implements CaloClusterGPUProcessor.
Definition at line 35 of file BasicGPUClusterInfoCalculator.cxx.
38 using clock_type = boost::chrono::thread_clock;
39 auto time_cast = [](
const auto & before,
const auto & after)
41 return boost::chrono::duration_cast<boost::chrono::microseconds>(after - before).count();
64 time_cast(
start, before_seed_properties),
65 time_cast(before_seed_properties, before_calculating),
66 time_cast(before_calculating,
end)
71 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
◆ finalize()
StatusCode BasicGPUClusterInfoCalculator::finalize |
( |
| ) |
|
|
overridevirtual |
◆ 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 BasicGPUClusterInfoCalculator::initialize |
( |
| ) |
|
|
inlineoverridevirtual |
◆ initialize_CUDA()
StatusCode BasicGPUClusterInfoCalculator::initialize_CUDA |
( |
| ) |
|
|
overridevirtual |
◆ initialize_non_CUDA()
StatusCode BasicGPUClusterInfoCalculator::initialize_non_CUDA |
( |
| ) |
|
|
overridevirtual |
◆ 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.
◆ 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()
◆ size_of_temporaries()
virtual size_t BasicGPUClusterInfoCalculator::size_of_temporaries |
( |
| ) |
const |
|
inlineoverridevirtual |
◆ sysInitialize()
◆ 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/2]
std::vector<size_t> m_times CaloGPUTimed::ATLAS_THREAD_SAFE |
|
mutableprotectedinherited |
Vector to hold execution times to be recorded if necessary.
Definition at line 35 of file CaloGPUTimed.h.
◆ ATLAS_THREAD_SAFE [2/2]
std::vector<size_t> m_eventNumbers CaloGPUTimed::ATLAS_THREAD_SAFE |
|
mutableprotectedinherited |
Vector to hold the event numbers to be recorded if necessary.
Definition at line 40 of file CaloGPUTimed.h.
◆ m_clusterETThreshold
Gaudi::Property<float> BasicGPUClusterInfoCalculator::m_clusterETThreshold {this, "ClusterEtorAbsEtCut", 0.*CLHEP::MeV, "Cluster E_t or Abs E_t cut"} |
|
private |
\(E_\perp\) cut on the clusters.
The clusters have to pass this cut (which is on \(E_\perp\) or \(|E|_\perp\) of the cluster depending on the above switch) in order to be inserted into the CaloClusterContainer.
Definition at line 93 of file BasicGPUClusterInfoCalculator.h.
◆ m_cutClustersInAbsE
Gaudi::Property<bool> BasicGPUClusterInfoCalculator::m_cutClustersInAbsE {this, "ClusterCutsInAbsEt", true, "Do cluster cuts in Abs Et instead of Et"} |
|
private |
◆ m_detStore
◆ m_evtStore
◆ m_kernelSizeOptimizer
◆ 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_preserveClusterMoments
Gaudi::Property<bool> BasicGPUClusterInfoCalculator::m_preserveClusterMoments {this, "PreserveClusterMoments", false, "Do not use cluster moments array as temporary storage"} |
|
private |
If set to true
, allocates a temporary array to store some temporary intermediate results instead of using cluster moments.
Default is false
.
Definition at line 78 of file BasicGPUClusterInfoCalculator.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_varHandleArraysDeclared
◆ m_vhka
The documentation for this class was generated from the following files:
ServiceHandle< IGPUKernelSizeOptimizerSvc > m_kernelSizeOptimizer
Handle to the CUDA kernel block and grid size optimization service.
void calculateClusterProperties(CaloRecGPU::EventDataHolder &holder, CaloRecGPU::Helpers::CUDA_kernel_object< ClusterInfoCalculatorTemporaries > temps, const CaloRecGPU::ConstantDataHolder &instance_data, const IGPUKernelSizeOptimizer &optimizer, const bool synchronize=false, const bool cut_in_absolute_ET=true, const float absolute_ET_threshold=-1, CaloRecGPU::CUDA_Helpers::CUDAStreamPtrHolder stream_to_use={})
Gaudi::Property< float > m_clusterETThreshold
cut on the clusters.
std::shared_mutex m_timeMutex
Mutex that is locked when recording times.
CaloRecGPU::Helpers::CUDA_object< CaloRecGPU::ClusterMomentsArr > m_moments_dev
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T > &t)
std::pair< long int, long int > indices
void updateSeedCellProperties(CaloRecGPU::EventDataHolder &holder, CaloRecGPU::Helpers::CUDA_kernel_object< ClusterInfoCalculatorTemporaries > temps, const CaloRecGPU::ConstantDataHolder &instance_data, const IGPUKernelSizeOptimizer &optimizer, const bool synchronize=false, CaloRecGPU::CUDA_Helpers::CUDAStreamPtrHolder stream_to_use={})
Holds one objects of type \T in memory context Context.
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
virtual void setOwner(IDataHandleHolder *o)=0
virtual StatusCode initialize()
void print_times(const std::string &header, const size_t time_size) const
StoreGateSvc_t m_detStore
Pointer to StoreGate (detector store by default)
virtual void renounce()=0
std::conditional< std::is_base_of< SG::VarHandleKeyArray, T >::value, VarHandleKeyArrayType, type2 >::type type
static const std::string & type()
Incident type.
void record_times_helper(const size_t) const
virtual StatusCode initialize_CUDA()
Initialization that invokes CUDA functions.
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.
Gaudi::Property< bool > m_measureTimes
If true, times are recorded to the file given by m_timeFileName.
void register_kernels(IGPUKernelSizeOptimizer &optimizer)
SG::VarHandleKey & vhKey()
Return a non-const reference to the HandleKey.
Gaudi::Details::PropertyBase & declareGaudiProperty(Gaudi::Property< T > &hndl, const SG::VarHandleKeyType &)
specialization for handling Gaudi::Property<SG::VarHandleKey>
Gaudi::Property< bool > m_cutClustersInAbsE
if set to true cluster cuts are on , if false on .
Gaudi::Property< bool > m_preserveClusterMoments
If set to true, allocates a temporary array to store some temporary intermediate results instead of u...