ATLAS Offline Software
F110IntegrationAlg.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_F110IntegrationAlg_H
10 #define EFTRACKING_FPGA_INTEGRATION_F110IntegrationAlg_H
11 
12 // EFTracking include
18 
19 // Athena include
22 #include "GaudiKernel/ServiceHandle.h"
23 #include "GaudiKernel/IChronoSvc.h"
26 
27 #include <mutex>
28 
30 {
38  {
39  public:
40  using IntegrationBase::IntegrationBase;
41  virtual StatusCode initialize() override final;
42  virtual StatusCode execute(const EventContext &ctx) const override final;
43  virtual StatusCode finalize() override final;
44 
45  private:
46  std::vector<cl::Event> getDepVector(std::vector<cl::Event> &endEvents, size_t cu) const;
47 
49 
50  SG::ReadHandleKey<std::vector<uint64_t>> m_FPGAPixelRDO{this, "FPGAEncodedPixelKey", "FPGAEncodedPixelRDOs", "Pixel RDO converted to FPGA format"};
51  SG::ReadHandleKey<std::vector<uint64_t>> m_FPGAStripRDO{this, "FPGAEncodedStripKey", "FPGAEncodedStripRDOs", "Strip RDO converted to FPGA format"};
52 
53  SG::ReadHandleKey<int> m_FPGAPixelRDOSize{this, "FPGAEncodedPixelSizeKey", "FPGAEncodedPixelSizeRDOs", "Pixel RDO converted to FPGA format"};
54  SG::ReadHandleKey<int> m_FPGAStripRDOSize{this, "FPGAEncodedStripSizeKey", "FPGAEncodedStripSizeRDOs", "Strip RDO converted to FPGA format"};
55 
56  SG::WriteHandleKey<std::vector<uint32_t>> m_FPGAPixelOutput{this, "FPGAOutputPixelKey", "FPGAPixelOutput", "Pixel output from FPGA format"};
57  SG::WriteHandleKey<std::vector<uint32_t>> m_FPGAStripOutput{this, "FPGAOutputStripKey", "FPGAStripOutput", "Strip output from FPGA format"};
58 
59  Gaudi::Property<int> m_FPGAThreads{this, "FPGAThreads", 1, "number of FPGA threads to initialize"};
60 
61  Gaudi::Property<std::string> m_xclbin{this, "xclbin", "", "xclbin path and name"};
62 
63  Gaudi::Property<std::string> m_pixelEdmKernelName{this, "PixelEDMPrepKernelName", "", "Name of the FPGA kernel"};
64 
65  Gaudi::Property<std::string> m_stripEdmKernelName{this, "StripEDMPrepKernelName", "", "Name of the FPGA kernel"};
66 
67  Gaudi::Property<std::string> m_pixelClusterKernelName{this, "PixelClusterKernelName", "", "Name of the pixel clustering kernel"};
68 
69  Gaudi::Property<std::string> m_stripClusterKernelName{this, "StripClusterKernelName", "", "Name of the strip clustering kernel"};
70 
71  Gaudi::Property<std::string> m_stripL2GKernelName{this, "StripL2GKernelName", "", "Name of the strip L2G kernel"};
72 
74 
75  mutable std::vector<cl::Event> m_stripClusterEndEvents ATLAS_THREAD_SAFE;
76  mutable std::vector<cl::Event> m_stripL2GEndEvents ATLAS_THREAD_SAFE;
77  mutable std::vector<cl::Event> m_stripEDMEndEvents ATLAS_THREAD_SAFE;
78 
79  mutable std::vector<cl::Event> m_pixelClusterEndEvents ATLAS_THREAD_SAFE;
80  mutable std::vector<cl::Event> m_pixelEDMEndEvents ATLAS_THREAD_SAFE;
81 
82  mutable std::vector<cl::Kernel> m_pixelClusterKernels ATLAS_THREAD_SAFE;
83  mutable std::vector<cl::Kernel> m_pixelEDMKernels ATLAS_THREAD_SAFE;
84 
85  mutable std::vector<cl::Kernel> m_stripClusterKernels ATLAS_THREAD_SAFE;
86  mutable std::vector<cl::Kernel> m_stripEDMKernels ATLAS_THREAD_SAFE;
87  mutable std::vector<cl::Kernel> m_stripL2GKernels ATLAS_THREAD_SAFE;
88 
89  mutable std::atomic<ulonglong> m_numEvents{0};
90  mutable std::atomic<cl_ulong> m_pixelInputTime{0};
91  mutable std::atomic<cl_ulong> m_stripInputTime{0};
92  mutable std::atomic<cl_ulong> m_pixelClusteringTime{0};
93  mutable std::atomic<cl_ulong> m_stripClusteringTime{0};
94  mutable std::atomic<cl_ulong> m_stripL2GTime{0};
95  mutable std::atomic<cl_ulong> m_pixelEdmPrepTime{0};
96  mutable std::atomic<cl_ulong> m_stripEdmPrepTime{0};
97  mutable std::atomic<cl_ulong> m_pixelOutputTime{0};
98  mutable std::atomic<cl_ulong> m_stripOutputTime{0};
99  mutable std::atomic<cl_ulong> m_kernelTime{0};
100 
101  // Buffers for input
102  mutable std::vector<cl::Buffer> m_pixelClusterInputBufferList ATLAS_THREAD_SAFE;
103  mutable std::vector<cl::Buffer> m_stripClusterInputBufferList ATLAS_THREAD_SAFE;
104  // Buffers for Clustering
105  mutable std::vector<cl::Buffer> m_stripClusterOutputBufferList ATLAS_THREAD_SAFE;
106  mutable std::vector<cl::Buffer> m_pixelClusterEDMOutputBufferList ATLAS_THREAD_SAFE;
107  mutable std::vector<cl::Buffer> m_stripClusterEDMOutputBufferList ATLAS_THREAD_SAFE;
108  // L2G
109  mutable std::vector<cl::Buffer> m_stripL2GOutputBufferList ATLAS_THREAD_SAFE;
110  mutable std::vector<cl::Buffer> m_stripL2GEDMOutputBufferList ATLAS_THREAD_SAFE;
111  // EDMPrep
112  mutable std::vector<cl::Buffer> m_edmPixelOutputBufferList ATLAS_THREAD_SAFE;
113  mutable std::vector<cl::Buffer> m_edmStripOutputBufferList ATLAS_THREAD_SAFE;
114 
115  // Command queue
116  cl::CommandQueue m_acc_queue;
117 
118 
119  void getListofCUs(std::vector<std::string>& cuNames);
120 
121 
122  };
123 }
124 
125 #endif // EFTRACKING_FPGA_INTEGRATION_F110IntegrationAlg_H
EFTrackingFPGAIntegration::F110IntegrationAlg::m_stripInputTime
std::atomic< cl_ulong > m_stripInputTime
Time for strip input buffer write.
Definition: F110IntegrationAlg.h:91
EFTrackingFPGAIntegration::F110IntegrationAlg::m_stripEdmKernelName
Gaudi::Property< std::string > m_stripEdmKernelName
Name of the FPGA kernel.
Definition: F110IntegrationAlg.h:65
EFTrackingFPGAIntegration::F110IntegrationAlg::m_acc_queue
cl::CommandQueue m_acc_queue
Definition: F110IntegrationAlg.h:116
IRegSelTool.h
EFTrackingFPGAIntegration::F110IntegrationAlg::ATLAS_THREAD_SAFE
std::vector< cl::Buffer > m_edmStripOutputBufferList ATLAS_THREAD_SAFE
Definition: F110IntegrationAlg.h:113
IntegrationBase
The base class for the EFTracking FPGA integration development.
Definition: IntegrationBase.h:38
EFTrackingFPGAIntegration::F110IntegrationAlg::ATLAS_THREAD_SAFE
std::vector< cl::Kernel > m_stripL2GKernels ATLAS_THREAD_SAFE
Definition: F110IntegrationAlg.h:87
EFTrackingFPGAIntegration::F110IntegrationAlg::m_pixelInputTime
std::atomic< cl_ulong > m_pixelInputTime
Time for pixel input buffer write.
Definition: F110IntegrationAlg.h:90
BeamSpot::mutex
std::mutex mutex
Definition: InDetBeamSpotVertex.cxx:18
EFTrackingFPGAIntegration::F110IntegrationAlg::ATLAS_THREAD_SAFE
std::vector< cl::Event > m_stripL2GEndEvents ATLAS_THREAD_SAFE
Definition: F110IntegrationAlg.h:76
EFTrackingFPGAIntegration::F110IntegrationAlg::m_stripL2GTime
std::atomic< cl_ulong > m_stripL2GTime
Time for strip L2G.
Definition: F110IntegrationAlg.h:94
EFTrackingFPGAIntegration::F110IntegrationAlg::ATLAS_THREAD_SAFE
std::vector< cl::Kernel > m_pixelEDMKernels ATLAS_THREAD_SAFE
Definition: F110IntegrationAlg.h:83
EFTrackingFPGAIntegration::F110IntegrationAlg::m_FPGAPixelOutput
SG::WriteHandleKey< std::vector< uint32_t > > m_FPGAPixelOutput
Definition: F110IntegrationAlg.h:56
EFTrackingFPGAIntegration::F110IntegrationAlg::ATLAS_THREAD_SAFE
std::vector< cl::Buffer > m_pixelClusterEDMOutputBufferList ATLAS_THREAD_SAFE
Definition: F110IntegrationAlg.h:106
EFTrackingFPGAIntegration::F110IntegrationAlg::m_fpgaHandleMtx
std::mutex m_fpgaHandleMtx
Definition: F110IntegrationAlg.h:73
EFTrackingFPGAIntegration::F110IntegrationAlg::m_kernelTime
std::atomic< cl_ulong > m_kernelTime
Time for kernel execution.
Definition: F110IntegrationAlg.h:99
EFTrackingFPGAIntegration::F110IntegrationAlg::ATLAS_THREAD_SAFE
std::vector< cl::Event > m_pixelEDMEndEvents ATLAS_THREAD_SAFE
Definition: F110IntegrationAlg.h:80
IntegrationBase.h
EFTrackingFPGAIntegration::F110IntegrationAlg::m_FPGAStripRDOSize
SG::ReadHandleKey< int > m_FPGAStripRDOSize
Definition: F110IntegrationAlg.h:54
EFTrackingFPGAIntegration::F110IntegrationAlg::ATLAS_THREAD_SAFE
std::vector< cl::Kernel > m_stripClusterKernels ATLAS_THREAD_SAFE
Definition: F110IntegrationAlg.h:85
SG::ReadHandleKey
Property holding a SG store/key/clid from which a ReadHandle is made.
Definition: StoreGate/StoreGate/ReadHandleKey.h:39
EFTrackingFPGAIntegration::F110IntegrationAlg::ATLAS_THREAD_SAFE
std::vector< cl::Buffer > m_stripL2GEDMOutputBufferList ATLAS_THREAD_SAFE
Definition: F110IntegrationAlg.h:110
EFTrackingFPGAIntegration::F110IntegrationAlg::m_pixelOutputTime
std::atomic< cl_ulong > m_pixelOutputTime
Time for pixel output buffer read.
Definition: F110IntegrationAlg.h:97
EFTrackingFPGAIntegration::F110IntegrationAlg::ATLAS_THREAD_SAFE
std::vector< cl::Event > m_pixelClusterEndEvents ATLAS_THREAD_SAFE
Definition: F110IntegrationAlg.h:79
EFTrackingFPGAIntegration::F110IntegrationAlg::ATLAS_THREAD_SAFE
std::vector< cl::Event > m_stripEDMEndEvents ATLAS_THREAD_SAFE
Definition: F110IntegrationAlg.h:77
SCT_RDO_Container.h
SG::WriteHandleKey
Property holding a SG store/key/clid from which a WriteHandle is made.
Definition: StoreGate/StoreGate/WriteHandleKey.h:40
EFTrackingFPGAIntegration::F110IntegrationAlg::m_xclbin
Gaudi::Property< std::string > m_xclbin
Path and name of the xclbin file.
Definition: F110IntegrationAlg.h:61
EFTrackingFPGAIntegration::F110IntegrationAlg::ATLAS_THREAD_SAFE
std::vector< cl::Event > m_stripClusterEndEvents ATLAS_THREAD_SAFE
Definition: F110IntegrationAlg.h:75
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
EFTrackingFPGAIntegration::F110IntegrationAlg::ATLAS_THREAD_SAFE
std::vector< cl::Buffer > m_stripL2GOutputBufferList ATLAS_THREAD_SAFE
Definition: F110IntegrationAlg.h:109
EFTrackingFPGAIntegration::F110IntegrationAlg::m_pixelEdmKernelName
Gaudi::Property< std::string > m_pixelEdmKernelName
Name of the FPGA kernel.
Definition: F110IntegrationAlg.h:63
EFTrackingFPGAIntegration::F110IntegrationAlg::m_pixelClusterKernelName
Gaudi::Property< std::string > m_pixelClusterKernelName
Name of the pixel clustering kernel.
Definition: F110IntegrationAlg.h:67
EFTrackingFPGAIntegration::F110IntegrationAlg::ATLAS_THREAD_SAFE
std::vector< cl::Buffer > m_edmPixelOutputBufferList ATLAS_THREAD_SAFE
Definition: F110IntegrationAlg.h:112
EFTrackingFPGAIntegration
The class for enconding RDO to FPGA format.
Definition: F100DataEncodingAlg.h:27
EFTrackingFPGAIntegration::F110IntegrationAlg::m_pixelEdmPrepTime
std::atomic< cl_ulong > m_pixelEdmPrepTime
Time for pixel EDM preparation.
Definition: F110IntegrationAlg.h:95
EFTrackingFPGAIntegration::F110IntegrationAlg::getListofCUs
void getListofCUs(std::vector< std::string > &cuNames)
Definition: F110IntegrationAlg.cxx:380
EFTrackingFPGAIntegration::F110IntegrationAlg::ATLAS_THREAD_SAFE
std::vector< cl::Buffer > m_stripClusterEDMOutputBufferList ATLAS_THREAD_SAFE
Definition: F110IntegrationAlg.h:107
EFTrackingFPGAIntegration::F110IntegrationAlg::m_FPGAStripRDO
SG::ReadHandleKey< std::vector< uint64_t > > m_FPGAStripRDO
Definition: F110IntegrationAlg.h:51
EFTrackingTransient.h
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:240
EFTrackingFPGAIntegration::F110IntegrationAlg::initialize
virtual StatusCode initialize() override final
Detect the OpenCL devices and prepare OpenCL context.
Definition: F110IntegrationAlg.cxx:15
EFTrackingFPGAIntegration::F110IntegrationAlg::ATLAS_THREAD_SAFE
std::vector< cl::Kernel > m_pixelClusterKernels ATLAS_THREAD_SAFE
Definition: F110IntegrationAlg.h:82
PixelRDO_Container.h
EFTrackingFPGAIntegration::F110IntegrationAlg::execute
virtual StatusCode execute(const EventContext &ctx) const override final
Should be overriden by derived classes to perform meaningful work.
Definition: F110IntegrationAlg.cxx:138
EFTrackingFPGAIntegration::F110IntegrationAlg::m_chronoSvc
ServiceHandle< IChronoSvc > m_chronoSvc
Service for timing the algorithm.
Definition: F110IntegrationAlg.h:48
xAODClusterMaker.h
EFTrackingFPGAIntegration::F110IntegrationAlg::m_FPGAPixelRDOSize
SG::ReadHandleKey< int > m_FPGAPixelRDOSize
Definition: F110IntegrationAlg.h:53
EFTrackingFPGAIntegration::F110IntegrationAlg
This is the class for the benchmark algorithm specific to the FPGA integration and output conversion.
Definition: F110IntegrationAlg.h:38
EFTrackingFPGAIntegration::F110IntegrationAlg::m_FPGAPixelRDO
SG::ReadHandleKey< std::vector< uint64_t > > m_FPGAPixelRDO
Definition: F110IntegrationAlg.h:50
FPGADataFormatTool.h
EFTrackingFPGAIntegration::F110IntegrationAlg::finalize
virtual StatusCode finalize() override final
Definition: F110IntegrationAlg.cxx:358
EFTrackingFPGAIntegration::F110IntegrationAlg::m_stripClusterKernelName
Gaudi::Property< std::string > m_stripClusterKernelName
Name of the strip clustering kernel.
Definition: F110IntegrationAlg.h:69
EFTrackingFPGAIntegration::F110IntegrationAlg::getDepVector
std::vector< cl::Event > getDepVector(std::vector< cl::Event > &endEvents, size_t cu) const
Definition: F110IntegrationAlg.cxx:123
EFTrackingFPGAIntegration::F110IntegrationAlg::ATLAS_THREAD_SAFE
std::vector< cl::Kernel > m_stripEDMKernels ATLAS_THREAD_SAFE
Definition: F110IntegrationAlg.h:86
EFTrackingFPGAIntegration::F110IntegrationAlg::m_pixelClusteringTime
std::atomic< cl_ulong > m_pixelClusteringTime
Time for pixel clustering.
Definition: F110IntegrationAlg.h:92
EFTrackingFPGAIntegration::F110IntegrationAlg::m_FPGAStripOutput
SG::WriteHandleKey< std::vector< uint32_t > > m_FPGAStripOutput
Definition: F110IntegrationAlg.h:57
EFTrackingFPGAIntegration::F110IntegrationAlg::m_stripEdmPrepTime
std::atomic< cl_ulong > m_stripEdmPrepTime
Time for strip EDM preparation.
Definition: F110IntegrationAlg.h:96
EFTrackingFPGAIntegration::F110IntegrationAlg::ATLAS_THREAD_SAFE
std::vector< cl::Buffer > m_pixelClusterInputBufferList ATLAS_THREAD_SAFE
Definition: F110IntegrationAlg.h:102
TestVectorTool.h
EFTrackingFPGAIntegration::F110IntegrationAlg::m_stripL2GKernelName
Gaudi::Property< std::string > m_stripL2GKernelName
Name of the strip L2G kernelS.
Definition: F110IntegrationAlg.h:71
EFTrackingFPGAIntegration::F110IntegrationAlg::ATLAS_THREAD_SAFE
std::vector< cl::Buffer > m_stripClusterInputBufferList ATLAS_THREAD_SAFE
Definition: F110IntegrationAlg.h:103
EFTrackingFPGAIntegration::F110IntegrationAlg::m_FPGAThreads
Gaudi::Property< int > m_FPGAThreads
Definition: F110IntegrationAlg.h:59
EFTrackingFPGAIntegration::F110IntegrationAlg::ATLAS_THREAD_SAFE
std::vector< cl::Buffer > m_stripClusterOutputBufferList ATLAS_THREAD_SAFE
Definition: F110IntegrationAlg.h:105
EFTrackingFPGAIntegration::F110IntegrationAlg::m_stripOutputTime
std::atomic< cl_ulong > m_stripOutputTime
Time for strip output buffer read.
Definition: F110IntegrationAlg.h:98
EFTrackingFPGAIntegration::F110IntegrationAlg::m_numEvents
std::atomic< ulonglong > m_numEvents
Number of events processed.
Definition: F110IntegrationAlg.h:89
TrigRoiDescriptorCollection.h
EFTrackingFPGAIntegration::F110IntegrationAlg::m_stripClusteringTime
std::atomic< cl_ulong > m_stripClusteringTime
Time for strip clustering.
Definition: F110IntegrationAlg.h:93
ServiceHandle< IChronoSvc >