ATLAS Offline Software
F150IntegrationAlg.h
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2025 CERN for the benefit of the ATLAS collaboration
3 */
4 
9 #ifndef EFTRACKING_FPGA_INTEGRATION_F150IntegrationAlg_H
10 #define EFTRACKING_FPGA_INTEGRATION_F150IntegrationAlg_H
11 
12 // EFTracking include
16 
17 // Athena include
20 #include "GaudiKernel/ServiceHandle.h"
21 #include "GaudiKernel/IChronoSvc.h"
24 
26 
28 {
36  {
37  public:
38  using IntegrationBase::IntegrationBase;
39  virtual StatusCode initialize() override final;
40  virtual StatusCode execute(const EventContext &ctx) const override final;
41  virtual StatusCode finalize() override final;
42 
43  private:
45 
46  SG::ReadHandleKey<std::vector<uint64_t>> m_FPGAPixelRDO{this, "FPGAEncodedPixelKey", "FPGAEncodedPixelRDOs", "Pixel RDO converted to FPGA format"};
47  SG::ReadHandleKey<std::vector<uint64_t>> m_FPGAStripRDO{this, "FPGAEncodedStripKey", "FPGAEncodedStripRDOs", "Strip RDO converted to FPGA format"};
48 
49  SG::WriteHandleKey<std::vector<uint64_t>> m_FPGAPixelOutput{this, "FPGAOutputPixelKey", "FPGAPixelOutput", "Pixel output from FPGA format"};
50  SG::WriteHandleKey<std::vector<uint64_t>> m_FPGAStripOutput{this, "FPGAOutputStripKey", "FPGAStripOutput", "Strip output from FPGA format"};
51  SG::WriteHandleKey<std::vector<uint64_t>> m_FPGATrackOutput{this, "FPGAOutputTrackKey", "FPGATrackOutput", "Track output from FPGA format"};
52 
53  Gaudi::Property<int> m_FPGAThreads{this, "FPGAThreads", 1, "number of FPGA threads to initialize"};
54  Gaudi::Property<bool> m_outputTextFile{this, "outputTextFile", "", "Whether to output text file"};
55 
56  Gaudi::Property<std::string> m_xclbin{this, "xclbin", "", "xclbin path and name"};
57 
58  Gaudi::Property<std::string> m_pixelEdmKernelName{this, "PixelEDMPrepKernelName", "", "Name of the FPGA kernel"};
59  Gaudi::Property<std::string> m_stripEdmKernelName{this, "StripEDMPrepKernelName", "", "Name of the FPGA kernel"};
60  Gaudi::Property<std::string> m_pixelClusterKernelName{this, "PixelClusterKernelName", "", "Name of the pixel clustering kernel"};
61  Gaudi::Property<std::string> m_stripClusterKernelName{this, "StripClusterKernelName", "", "Name of the strip clustering kernel"};
62  Gaudi::Property<std::string> m_stripL2GKernelName{this, "StripL2GKernelName", "", "Name of the strip L2G kernel"};
63  Gaudi::Property<std::string> m_slicingEngineInputName{this, "SlicingEngineInputName", "", "Name of the slicing engine input kernel"};
64  Gaudi::Property<std::string> m_slicingEngineOutputName{this, "SlicingEngineOutputName", "", "Name of the slicing engine output kernel"};
65  Gaudi::Property<std::string> m_insideOutInputName{this, "InsideOutInputName", "", "Name of the inside out input kernel"};
66  Gaudi::Property<std::string> m_insideOutOutputName{this, "InsideOutOutputName", "", "Name of the inside out output kernel"};
67 
68  ToolHandle< GenericMonitoringTool > m_monTool { this, "MonTool", "", "Monitoring tool" };
69 
70  mutable std::atomic<ulonglong> m_numEvents{0};
71  mutable std::atomic<cl_ulong> m_pixelInputTime{0};
72  mutable std::atomic<cl_ulong> m_stripInputTime{0};
73  mutable std::atomic<cl_ulong> m_pixelClusteringTime{0};
74  mutable std::atomic<cl_ulong> m_stripClusteringTime{0};
75  mutable std::atomic<cl_ulong> m_stripL2GTime{0};
76  mutable std::atomic<cl_ulong> m_pixelEdmPrepTime{0};
77  mutable std::atomic<cl_ulong> m_stripEdmPrepTime{0};
78  mutable std::atomic<cl_ulong> m_pixelOutputTime{0};
79  mutable std::atomic<cl_ulong> m_stripOutputTime{0};
80  mutable std::atomic<cl_ulong> m_kernelTime{0};
81 
82  // Kernels
83  // Clustering
84  mutable std::vector<cl::Kernel> m_pixelClusteringKernels ATLAS_THREAD_SAFE;
85  mutable std::vector<cl::Kernel> m_stripClusteringKernels ATLAS_THREAD_SAFE;
86 
87  // L2G
88  mutable std::vector<cl::Kernel> m_stripL2GKernels ATLAS_THREAD_SAFE;
89 
90  // EDM prep
91  mutable std::vector<cl::Kernel> m_pixelEdmPrepKernels ATLAS_THREAD_SAFE;
92  mutable std::vector<cl::Kernel> m_stripEdmPrepKernels ATLAS_THREAD_SAFE;
93 
94  mutable std::vector<cl::Kernel> m_slicingEngineInputKernels ATLAS_THREAD_SAFE;
95  mutable std::vector<cl::Kernel> m_slicingEngineOutputKernels ATLAS_THREAD_SAFE;
96  mutable std::vector<cl::Kernel> m_insideOutInputKernels ATLAS_THREAD_SAFE;
97  mutable std::vector<cl::Kernel> m_insideOutOutputKernels ATLAS_THREAD_SAFE;
98 
99  // Buffers for input
100  std::vector<cl::Buffer> m_pixelClusterInputBufferList;
101  std::vector<cl::Buffer> m_stripClusterInputBufferList;
102  // Buffers for Clustering
103  std::vector<cl::Buffer> m_pixelClusterOutputBufferList;
104  std::vector<cl::Buffer> m_stripClusterOutputBufferList;
105  std::vector<cl::Buffer> m_pixelClusterEDMOutputBufferList;
106  std::vector<cl::Buffer> m_stripClusterEDMOutputBufferList;
107  // L2G
108  std::vector<cl::Buffer> m_stripL2GOutputBufferList;
109  std::vector<cl::Buffer> m_stripL2GEDMOutputBufferList;
110  std::vector<cl::Buffer> m_edmPixelOutputBufferList;
111  std::vector<cl::Buffer> m_edmStripOutputBufferList;
112 
113  std::vector<cl::Buffer> m_slicingEngineOutputBufferList;
114  std::vector<cl::Buffer> m_insideOutOutputBufferList;
115 
116  // Command queue
117  std::vector<cl::CommandQueue> m_acc_queues;
118  void getListofCUs(std::vector<std::string>& cuNames);
119 
120  void dumpHexData(std::span<const uint64_t> data, const std::string& dataDescriptor, const EventContext &ctx) const;
121 
122 
123  };
124 }
125 
126 #endif // EFTRACKING_FPGA_INTEGRATION_F150IntegrationAlg_H
EFTrackingFPGAIntegration::F150IntegrationAlg::m_stripL2GKernelName
Gaudi::Property< std::string > m_stripL2GKernelName
Name of the strip L2G kernelS.
Definition: F150IntegrationAlg.h:62
IRegSelTool.h
IntegrationBase
The base class for the EFTracking FPGA integration development.
Definition: IntegrationBase.h:38
data
char data[hepevt_bytes_allocation_ATLAS]
Definition: HepEvt.cxx:11
EFTrackingFPGAIntegration::F150IntegrationAlg
This is the class for the benchmark algorithm specific to the FPGA integration and output conversion.
Definition: F150IntegrationAlg.h:36
EFTrackingFPGAIntegration::F150IntegrationAlg::m_FPGATrackOutput
SG::WriteHandleKey< std::vector< uint64_t > > m_FPGATrackOutput
Definition: F150IntegrationAlg.h:51
EFTrackingFPGAIntegration::F150IntegrationAlg::m_stripOutputTime
std::atomic< cl_ulong > m_stripOutputTime
Time for strip output buffer read.
Definition: F150IntegrationAlg.h:79
EFTrackingFPGAIntegration::F150IntegrationAlg::m_numEvents
std::atomic< ulonglong > m_numEvents
Number of events processed.
Definition: F150IntegrationAlg.h:70
EFTrackingFPGAIntegration::F150IntegrationAlg::m_pixelClusteringTime
std::atomic< cl_ulong > m_pixelClusteringTime
Time for pixel clustering.
Definition: F150IntegrationAlg.h:73
EFTrackingFPGAIntegration::F150IntegrationAlg::finalize
virtual StatusCode finalize() override final
Definition: F150IntegrationAlg.cxx:457
EFTrackingFPGAIntegration::F150IntegrationAlg::m_outputTextFile
Gaudi::Property< bool > m_outputTextFile
Whether to run SE or not.
Definition: F150IntegrationAlg.h:54
EFTrackingFPGAIntegration::F150IntegrationAlg::ATLAS_THREAD_SAFE
std::vector< cl::Kernel > m_insideOutOutputKernels ATLAS_THREAD_SAFE
Definition: F150IntegrationAlg.h:97
EFTrackingFPGAIntegration::F150IntegrationAlg::ATLAS_THREAD_SAFE
std::vector< cl::Kernel > m_stripL2GKernels ATLAS_THREAD_SAFE
Definition: F150IntegrationAlg.h:88
EFTrackingFPGAIntegration::F150IntegrationAlg::m_stripClusterKernelName
Gaudi::Property< std::string > m_stripClusterKernelName
Name of the strip clustering kerne.
Definition: F150IntegrationAlg.h:61
EFTrackingFPGAIntegration::F150IntegrationAlg::m_xclbin
Gaudi::Property< std::string > m_xclbin
Path and name of the xclbin file.
Definition: F150IntegrationAlg.h:56
EFTrackingFPGAIntegration::F150IntegrationAlg::m_monTool
ToolHandle< GenericMonitoringTool > m_monTool
Definition: F150IntegrationAlg.h:68
EFTrackingFPGAIntegration::F150IntegrationAlg::m_pixelClusterOutputBufferList
std::vector< cl::Buffer > m_pixelClusterOutputBufferList
Definition: F150IntegrationAlg.h:103
EFTrackingFPGAIntegration::F150IntegrationAlg::m_slicingEngineInputName
Gaudi::Property< std::string > m_slicingEngineInputName
Definition: F150IntegrationAlg.h:63
EFTrackingFPGAIntegration::F150IntegrationAlg::ATLAS_THREAD_SAFE
std::vector< cl::Kernel > m_stripEdmPrepKernels ATLAS_THREAD_SAFE
Definition: F150IntegrationAlg.h:92
EFTrackingFPGAIntegration::F150IntegrationAlg::m_pixelEdmKernelName
Gaudi::Property< std::string > m_pixelEdmKernelName
Name of the FPGA kernel.
Definition: F150IntegrationAlg.h:58
IntegrationBase.h
EFTrackingFPGAIntegration::F150IntegrationAlg::execute
virtual StatusCode execute(const EventContext &ctx) const override final
Should be overriden by derived classes to perform meaningful work.
Definition: F150IntegrationAlg.cxx:158
EFTrackingFPGAIntegration::F150IntegrationAlg::ATLAS_THREAD_SAFE
std::vector< cl::Kernel > m_insideOutInputKernels ATLAS_THREAD_SAFE
Definition: F150IntegrationAlg.h:96
EFTrackingFPGAIntegration::F150IntegrationAlg::m_FPGAStripOutput
SG::WriteHandleKey< std::vector< uint64_t > > m_FPGAStripOutput
Definition: F150IntegrationAlg.h:50
SG::ReadHandleKey
Property holding a SG store/key/clid from which a ReadHandle is made.
Definition: StoreGate/StoreGate/ReadHandleKey.h:39
EFTrackingFPGAIntegration::F150IntegrationAlg::m_FPGAPixelRDO
SG::ReadHandleKey< std::vector< uint64_t > > m_FPGAPixelRDO
Definition: F150IntegrationAlg.h:46
EFTrackingFPGAIntegration::F150IntegrationAlg::m_stripL2GEDMOutputBufferList
std::vector< cl::Buffer > m_stripL2GEDMOutputBufferList
Definition: F150IntegrationAlg.h:109
EFTrackingFPGAIntegration::F150IntegrationAlg::ATLAS_THREAD_SAFE
std::vector< cl::Kernel > m_slicingEngineOutputKernels ATLAS_THREAD_SAFE
Definition: F150IntegrationAlg.h:95
EFTrackingFPGAIntegration::F150IntegrationAlg::m_stripClusterInputBufferList
std::vector< cl::Buffer > m_stripClusterInputBufferList
Definition: F150IntegrationAlg.h:101
EFTrackingFPGAIntegration::F150IntegrationAlg::m_pixelInputTime
std::atomic< cl_ulong > m_pixelInputTime
Time for pixel input buffer write.
Definition: F150IntegrationAlg.h:71
EFTrackingFPGAIntegration::F150IntegrationAlg::getListofCUs
void getListofCUs(std::vector< std::string > &cuNames)
Definition: F150IntegrationAlg.cxx:479
EFTrackingFPGAIntegration::F150IntegrationAlg::m_insideOutOutputName
Gaudi::Property< std::string > m_insideOutOutputName
Definition: F150IntegrationAlg.h:66
EFTrackingFPGAIntegration::F150IntegrationAlg::ATLAS_THREAD_SAFE
std::vector< cl::Kernel > m_pixelEdmPrepKernels ATLAS_THREAD_SAFE
Definition: F150IntegrationAlg.h:91
EFTrackingFPGAIntegration::F150IntegrationAlg::m_stripClusteringTime
std::atomic< cl_ulong > m_stripClusteringTime
Time for strip clustering.
Definition: F150IntegrationAlg.h:74
EFTrackingFPGAIntegration::F150IntegrationAlg::m_FPGAStripRDO
SG::ReadHandleKey< std::vector< uint64_t > > m_FPGAStripRDO
Definition: F150IntegrationAlg.h:47
EFTrackingFPGAIntegration::F150IntegrationAlg::m_stripL2GTime
std::atomic< cl_ulong > m_stripL2GTime
Time for strip L2G.
Definition: F150IntegrationAlg.h:75
EFTrackingFPGAIntegration::F150IntegrationAlg::m_stripL2GOutputBufferList
std::vector< cl::Buffer > m_stripL2GOutputBufferList
Definition: F150IntegrationAlg.h:108
EFTrackingFPGAIntegration::F150IntegrationAlg::m_edmPixelOutputBufferList
std::vector< cl::Buffer > m_edmPixelOutputBufferList
Definition: F150IntegrationAlg.h:110
EFTrackingFPGAIntegration::F150IntegrationAlg::initialize
virtual StatusCode initialize() override final
Detect the OpenCL devices and prepare OpenCL context.
Definition: F150IntegrationAlg.cxx:16
SCT_RDO_Container.h
EFTrackingFPGAIntegration::F150IntegrationAlg::m_slicingEngineOutputBufferList
std::vector< cl::Buffer > m_slicingEngineOutputBufferList
Definition: F150IntegrationAlg.h:113
EFTrackingFPGAIntegration::F150IntegrationAlg::m_stripClusterEDMOutputBufferList
std::vector< cl::Buffer > m_stripClusterEDMOutputBufferList
Definition: F150IntegrationAlg.h:106
SG::WriteHandleKey
Property holding a SG store/key/clid from which a WriteHandle is made.
Definition: StoreGate/StoreGate/WriteHandleKey.h:40
EFTrackingFPGAIntegration::F150IntegrationAlg::m_insideOutOutputBufferList
std::vector< cl::Buffer > m_insideOutOutputBufferList
Definition: F150IntegrationAlg.h:114
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
EFTrackingFPGAIntegration::F150IntegrationAlg::m_pixelClusterEDMOutputBufferList
std::vector< cl::Buffer > m_pixelClusterEDMOutputBufferList
Definition: F150IntegrationAlg.h:105
EFTrackingFPGAIntegration::F150IntegrationAlg::m_stripEdmPrepTime
std::atomic< cl_ulong > m_stripEdmPrepTime
Time for strip EDM preparation.
Definition: F150IntegrationAlg.h:77
EFTrackingFPGAIntegration::F150IntegrationAlg::m_stripInputTime
std::atomic< cl_ulong > m_stripInputTime
Time for strip input buffer write.
Definition: F150IntegrationAlg.h:72
EFTrackingFPGAIntegration::F150IntegrationAlg::m_insideOutInputName
Gaudi::Property< std::string > m_insideOutInputName
Definition: F150IntegrationAlg.h:65
EFTrackingFPGAIntegration::F150IntegrationAlg::m_pixelClusterInputBufferList
std::vector< cl::Buffer > m_pixelClusterInputBufferList
Definition: F150IntegrationAlg.h:100
EFTrackingFPGAIntegration
The class for enconding RDO to FPGA format.
Definition: BenchmarkAlg.h:28
EFTrackingFPGAIntegration::F150IntegrationAlg::m_pixelEdmPrepTime
std::atomic< cl_ulong > m_pixelEdmPrepTime
Time for pixel EDM preparation.
Definition: F150IntegrationAlg.h:76
Monitored.h
Header file to be included by clients of the Monitored infrastructure.
EFTrackingFPGAIntegration::F150IntegrationAlg::m_acc_queues
std::vector< cl::CommandQueue > m_acc_queues
Definition: F150IntegrationAlg.h:117
EFTrackingFPGAIntegration::F150IntegrationAlg::m_slicingEngineOutputName
Gaudi::Property< std::string > m_slicingEngineOutputName
Definition: F150IntegrationAlg.h:64
EFTrackingFPGAIntegration::F150IntegrationAlg::m_kernelTime
std::atomic< cl_ulong > m_kernelTime
Time for kernel execution.
Definition: F150IntegrationAlg.h:80
EFTrackingFPGAIntegration::F150IntegrationAlg::m_FPGAPixelOutput
SG::WriteHandleKey< std::vector< uint64_t > > m_FPGAPixelOutput
Definition: F150IntegrationAlg.h:49
EFTrackingTransient.h
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:240
EFTrackingFPGAIntegration::F150IntegrationAlg::m_edmStripOutputBufferList
std::vector< cl::Buffer > m_edmStripOutputBufferList
Definition: F150IntegrationAlg.h:111
EFTrackingFPGAIntegration::F150IntegrationAlg::m_chronoSvc
ServiceHandle< IChronoSvc > m_chronoSvc
Service for timing the algorithm.
Definition: F150IntegrationAlg.h:44
PixelRDO_Container.h
xAODClusterMaker.h
EFTrackingFPGAIntegration::F150IntegrationAlg::m_FPGAThreads
Gaudi::Property< int > m_FPGAThreads
Definition: F150IntegrationAlg.h:53
EFTrackingFPGAIntegration::F150IntegrationAlg::m_stripClusterOutputBufferList
std::vector< cl::Buffer > m_stripClusterOutputBufferList
Definition: F150IntegrationAlg.h:104
EFTrackingFPGAIntegration::F150IntegrationAlg::ATLAS_THREAD_SAFE
std::vector< cl::Kernel > m_stripClusteringKernels ATLAS_THREAD_SAFE
Definition: F150IntegrationAlg.h:85
EFTrackingFPGAIntegration::F150IntegrationAlg::ATLAS_THREAD_SAFE
std::vector< cl::Kernel > m_pixelClusteringKernels ATLAS_THREAD_SAFE
Definition: F150IntegrationAlg.h:84
EFTrackingFPGAIntegration::F150IntegrationAlg::ATLAS_THREAD_SAFE
std::vector< cl::Kernel > m_slicingEngineInputKernels ATLAS_THREAD_SAFE
Definition: F150IntegrationAlg.h:94
EFTrackingFPGAIntegration::F150IntegrationAlg::m_pixelClusterKernelName
Gaudi::Property< std::string > m_pixelClusterKernelName
Name of the pixel clustering kernel.
Definition: F150IntegrationAlg.h:60
EFTrackingFPGAIntegration::F150IntegrationAlg::m_pixelOutputTime
std::atomic< cl_ulong > m_pixelOutputTime
Time for pixel output buffer read.
Definition: F150IntegrationAlg.h:78
EFTrackingFPGAIntegration::F150IntegrationAlg::m_stripEdmKernelName
Gaudi::Property< std::string > m_stripEdmKernelName
Name of the FPGA kernel.
Definition: F150IntegrationAlg.h:59
TrigRoiDescriptorCollection.h
ServiceHandle< IChronoSvc >
EFTrackingFPGAIntegration::F150IntegrationAlg::dumpHexData
void dumpHexData(std::span< const uint64_t > data, const std::string &dataDescriptor, const EventContext &ctx) const
Definition: F150IntegrationAlg.cxx:133