|
ATLAS Offline Software
|
Standard tool to output the GPU data representation to the non-standard file format that we have been using for plotting and validation purposes.
More...
#include <CaloGPUOutput.h>
|
| CaloGPUOutput (const std::string &type, const std::string &name, const IInterface *parent) |
|
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 | ~CaloGPUOutput ()=default |
|
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 |
|
virtual size_t | size_of_temporaries () const |
| The size (in bytes) of the temporary object(s) that the algorithm will use. More...
|
|
| DeclareInterfaceID (CaloClusterGPUProcessor, 1, 0) |
|
|
Gaudi::Property< std::string > | m_savePath {this, "SavePath", "./saved_clusters", "Path to where the files should be saved"} |
| The path specifying the folder to which the files should be saved. More...
|
|
Gaudi::Property< std::string > | m_filePrefix {this, "FilePrefix", "", "Prefix of the saved files"} |
| The prefix of the saved files. More...
|
|
Gaudi::Property< std::string > | m_fileSuffix {this, "FileSuffix", "", "Suffix of the saved files"} |
| The suffix of the saved files. More...
|
|
Gaudi::Property< unsigned int > | m_numWidth {this, "NumberWidth", 9, "The number of digits to reserve for the events"} |
| The number of digits to reserve for the events. More...
|
|
Gaudi::Property< bool > | m_sortedAndCutClusters {this, "UseSortedAndCutClusters", true, "Sort the clusters by transverse energy, apply a cut and ensure contiguous tags"} |
| If true , sort the clusters by transverse energy and compactify the tags to ensure sequentiality. More...
|
|
Gaudi::Property< bool > | m_onlyCellInfo {this, "OnlyOutputCellInfo", false, "Only output cell info"} |
| If true , only output cell info (useful for reducing disk usage when running the full standalone version of the algorithms). More...
|
|
std::atomic< bool > | m_constantDataSaved |
| A flag to signal that the constant data has been adequately saved. More...
|
|
std::mutex | m_mutex |
| This mutex is locked when saving the constant data on the first event to ensure thread safety. 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 output the GPU data representation to the non-standard file format that we have been using for plotting and validation purposes.
- 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
- 30 May 2022 There are likely more elegant/general/generic/portable solutions, some of which might even avoid Root too, but our workflow was built around this one...
Definition at line 27 of file CaloGPUOutput.h.
◆ StoreGateSvc_t
◆ CaloGPUOutput()
CaloGPUOutput::CaloGPUOutput |
( |
const std::string & |
type, |
|
|
const std::string & |
name, |
|
|
const IInterface * |
parent |
|
) |
| |
Definition at line 15 of file CaloGPUOutput.cxx.
19 declareInterface<CaloClusterGPUProcessor> (
this);
◆ ~CaloGPUOutput()
virtual CaloGPUOutput::~CaloGPUOutput |
( |
| ) |
|
|
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 22 of file CaloGPUOutput.cxx.
26 std::lock_guard<std::mutex> lock_guard(
m_mutex);
33 return StatusCode::FAILURE;
47 return StatusCode::FAILURE;
50 return StatusCode::SUCCESS;
57 std::unordered_map<int, int> tag_map;
61 std::vector<int> cluster_order(
clusters->number);
63 std::iota(cluster_order.begin(), cluster_order.end(), 0);
65 std::sort(cluster_order.begin(), cluster_order.end(), [&](
const int a,
const int b)
67 if (clusters->seedCellID[a] < 0)
81 int real_cluster_numbers =
clusters->number;
83 for (
size_t i = 0;
i < cluster_order.size(); ++
i)
85 const int this_id = cluster_order[
i];
86 if (
clusters->seedCellID[this_id] < 0)
88 tag_map[this_id] = -1;
89 --real_cluster_numbers;
99 clusters->number = real_cluster_numbers;
101 for (
int i = 0;
i < temp_clusters->number; ++
i)
103 clusters->clusterEnergy[
i] = temp_clusters->clusterEnergy[cluster_order[
i]];
104 clusters->clusterEt[
i] = temp_clusters->clusterEt[cluster_order[
i]];
105 clusters->clusterEta[
i] = temp_clusters->clusterEta[cluster_order[
i]];
106 clusters->clusterPhi[
i] = temp_clusters->clusterPhi[cluster_order[
i]];
107 clusters->seedCellID[
i] = temp_clusters->seedCellID[cluster_order[
i]];
111 size_t shared_count = 0;
114 if (!cell_info->is_valid(
i))
118 const ClusterTag this_tag = cell_state->clusterTag[
i];
121 cell_state->clusterTag[
i] = ClusterTag::make_invalid_tag();
126 const int new_idx = tag_map[old_idx];
128 const int new_idx2 = old_idx2 >= 0 ? tag_map[old_idx2] : -1;
129 if (new_idx < 0 && new_idx2 < 0)
131 cell_state->clusterTag[
i] = ClusterTag::make_invalid_tag();
133 else if (new_idx < 0)
135 cell_state->clusterTag[
i] = ClusterTag::make_tag(new_idx2);
137 else if (new_idx2 < 0)
139 cell_state->clusterTag[
i] = ClusterTag::make_tag(new_idx);
159 return StatusCode::FAILURE;
162 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
◆ 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.
◆ renounce()
◆ renounceArray()
◆ size_of_temporaries()
virtual size_t CaloClusterGPUProcessor::size_of_temporaries |
( |
| ) |
const |
|
inlinevirtualinherited |
◆ 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()
◆ m_constantDataSaved
std::atomic<bool> CaloGPUOutput::m_constantDataSaved |
|
mutableprivate |
A flag to signal that the constant data has been adequately saved.
This is required for everything to work properly in a multi-threaded context...
Definition at line 79 of file CaloGPUOutput.h.
◆ m_detStore
◆ m_evtStore
◆ m_filePrefix
Gaudi::Property<std::string> CaloGPUOutput::m_filePrefix {this, "FilePrefix", "", "Prefix of the saved files"} |
|
private |
The prefix of the saved files.
Empty string by default.
Definition at line 53 of file CaloGPUOutput.h.
◆ m_fileSuffix
Gaudi::Property<std::string> CaloGPUOutput::m_fileSuffix {this, "FileSuffix", "", "Suffix of the saved files"} |
|
private |
The suffix of the saved files.
Empty string by default.
Definition at line 58 of file CaloGPUOutput.h.
◆ m_mutex
std::mutex CaloGPUOutput::m_mutex |
|
mutableprivate |
This mutex is locked when saving the constant data on the first event to ensure thread safety.
Otherwise, it's unused.
Definition at line 84 of file CaloGPUOutput.h.
◆ m_numWidth
Gaudi::Property<unsigned int> CaloGPUOutput::m_numWidth {this, "NumberWidth", 9, "The number of digits to reserve for the events"} |
|
private |
The number of digits to reserve for the events.
9 by default.
Definition at line 63 of file CaloGPUOutput.h.
◆ m_onlyCellInfo
Gaudi::Property<bool> CaloGPUOutput::m_onlyCellInfo {this, "OnlyOutputCellInfo", false, "Only output cell info"} |
|
private |
If true
, only output cell info (useful for reducing disk usage when running the full standalone version of the algorithms).
Definition at line 73 of file CaloGPUOutput.h.
◆ m_savePath
Gaudi::Property<std::string> CaloGPUOutput::m_savePath {this, "SavePath", "./saved_clusters", "Path to where the files should be saved"} |
|
private |
The path specifying the folder to which the files should be saved.
Default
./saved_clusters
Definition at line 48 of file CaloGPUOutput.h.
◆ m_sortedAndCutClusters
Gaudi::Property<bool> CaloGPUOutput::m_sortedAndCutClusters {this, "UseSortedAndCutClusters", true, "Sort the clusters by transverse energy, apply a cut and ensure contiguous tags"} |
|
private |
If true
, sort the clusters by transverse energy and compactify the tags to ensure sequentiality.
Definition at line 68 of file CaloGPUOutput.h.
◆ m_varHandleArraysDeclared
◆ m_vhka
The documentation for this class was generated from the following files:
static ErrorState save_constants_to_folder(const std::filesystem::path &folder, const CaloRecGPU::Helpers::CPU_object< CaloRecGPU::GeometryArr > &geo, const CaloRecGPU::Helpers::CPU_object< CaloRecGPU::CellNoiseArr > &noise, const std::string &prefix="", const std::string &suffix="", const bool output_errors=true)
constexpr int32_t secondary_cluster_index() const
constexpr bool is_shared_between_clusters() const
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T > &t)
Holds one objects of type \T in memory context Context.
CaloRecGPU::Helpers::CUDA_object< CaloRecGPU::CellStateArr > m_cell_state_dev
CaloRecGPU::Helpers::CUDA_object< CaloRecGPU::ClusterInfoArr > m_clusters_dev
static ErrorState save_event_to_folder(const size_t event_number, const std::filesystem::path &folder, const CaloRecGPU::Helpers::CPU_object< CaloRecGPU::CellInfoArr > &cell_info, const CaloRecGPU::Helpers::CPU_object< CaloRecGPU::CellStateArr > &cell_state, const CaloRecGPU::Helpers::CPU_object< CaloRecGPU::ClusterInfoArr > &clusters, const std::string &prefix="", const std::string &suffix="", const unsigned int num_width=9, const bool output_errors=true)
StoreGateSvc_t m_evtStore
Pointer to StoreGate (event store by default)
std::vector< SG::VarHandleKeyArray * > m_vhka
CaloRecGPU::Helpers::CUDA_object< CaloRecGPU::CellInfoArr > m_cell_info_dev
virtual void setOwner(IDataHandleHolder *o)=0
constexpr int32_t cluster_index() const
Gaudi::Property< bool > m_onlyCellInfo
If true, only output cell info (useful for reducing disk usage when running the full standalone versi...
Gaudi::Property< unsigned int > m_numWidth
The number of digits to reserve for the events.
StoreGateSvc_t m_detStore
Pointer to StoreGate (detector store by default)
CaloRecGPU::Helpers::CUDA_object< CaloRecGPU::CellNoiseArr > m_cell_noise_dev
Gaudi::Property< std::string > m_savePath
The path specifying the folder to which the files should be saved.
virtual void renounce()=0
std::conditional< std::is_base_of< SG::VarHandleKeyArray, T >::value, VarHandleKeyArrayType, type2 >::type type
CaloRecGPU::Helpers::CUDA_object< CaloRecGPU::GeometryArr > m_geometry_dev
Gaudi::Property< std::string > m_filePrefix
The prefix of the saved files.
constexpr bool is_part_of_cluster() const
std::mutex m_mutex
This mutex is locked when saving the constant data on the first event to ensure thread safety.
static ErrorState save_cell_info_to_folder(const size_t event_number, const std::filesystem::path &folder, const CaloRecGPU::Helpers::CPU_object< CaloRecGPU::CellInfoArr > &cell_info, const std::string &prefix="", const std::string &suffix="", const unsigned int num_width=9, const bool output_errors=true)
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.
std::atomic< bool > m_constantDataSaved
A flag to signal that the constant data has been adequately saved.
SG::VarHandleKey & vhKey()
Return a non-const reference to the HandleKey.
Gaudi::Property< std::string > m_fileSuffix
The suffix of the saved files.
Gaudi::Details::PropertyBase & declareGaudiProperty(Gaudi::Property< T > &hndl, const SG::VarHandleKeyType &)
specialization for handling Gaudi::Property<SG::VarHandleKey>
constexpr int32_t secondary_cluster_weight() const
Gaudi::Property< bool > m_sortedAndCutClusters
If true, sort the clusters by transverse energy and compactify the tags to ensure sequentiality.