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::WriteHandleKey<std::vector<uint64_t>> m_FPGAPixelOutput{this, "FPGAOutputPixelKey", "FPGAPixelOutput", "Pixel output from FPGA format"};
54  SG::WriteHandleKey<std::vector<uint64_t>> m_FPGAStripOutput{this, "FPGAOutputStripKey", "FPGAStripOutput", "Strip output from FPGA format"};
55 
56  Gaudi::Property<int> m_FPGAThreads{this, "FPGAThreads", 1, "number of FPGA threads to initialize"};
57 
58  Gaudi::Property<std::string> m_xclbin{this, "xclbin", "", "xclbin path and name"};
59 
60  Gaudi::Property<std::string> m_pixelEdmKernelName{this, "PixelEDMPrepKernelName", "", "Name of the FPGA kernel"};
61 
62  Gaudi::Property<std::string> m_stripEdmKernelName{this, "StripEDMPrepKernelName", "", "Name of the FPGA kernel"};
63 
64  Gaudi::Property<std::string> m_pixelClusterKernelName{this, "PixelClusterKernelName", "", "Name of the pixel clustering kernel"};
65 
66  Gaudi::Property<std::string> m_stripClusterKernelName{this, "StripClusterKernelName", "", "Name of the strip clustering kernel"};
67 
68  Gaudi::Property<std::string> m_stripL2GKernelName{this, "StripL2GKernelName", "", "Name of the strip L2G kernel"};
69 
71 
72  mutable std::vector<cl::Event> m_stripClusterEndEvents ATLAS_THREAD_SAFE;
73  mutable std::vector<cl::Event> m_stripL2GEndEvents ATLAS_THREAD_SAFE;
74  mutable std::vector<cl::Event> m_stripEDMEndEvents ATLAS_THREAD_SAFE;
75 
76  mutable std::vector<cl::Event> m_pixelClusterEndEvents ATLAS_THREAD_SAFE;
77  mutable std::vector<cl::Event> m_pixelEDMEndEvents ATLAS_THREAD_SAFE;
78 
79  mutable std::vector<cl::Kernel> m_pixelClusterKernels ATLAS_THREAD_SAFE;
80  mutable std::vector<cl::Kernel> m_pixelEDMKernels ATLAS_THREAD_SAFE;
81 
82  mutable std::vector<cl::Kernel> m_stripClusterKernels ATLAS_THREAD_SAFE;
83  mutable std::vector<cl::Kernel> m_stripEDMKernels ATLAS_THREAD_SAFE;
84  mutable std::vector<cl::Kernel> m_stripL2GKernels ATLAS_THREAD_SAFE;
85 
86  mutable std::atomic<ulonglong> m_numEvents{0};
87  mutable std::atomic<cl_ulong> m_pixelInputTime{0};
88  mutable std::atomic<cl_ulong> m_stripInputTime{0};
89  mutable std::atomic<cl_ulong> m_pixelClusteringTime{0};
90  mutable std::atomic<cl_ulong> m_stripClusteringTime{0};
91  mutable std::atomic<cl_ulong> m_stripL2GTime{0};
92  mutable std::atomic<cl_ulong> m_pixelEdmPrepTime{0};
93  mutable std::atomic<cl_ulong> m_stripEdmPrepTime{0};
94  mutable std::atomic<cl_ulong> m_pixelOutputTime{0};
95  mutable std::atomic<cl_ulong> m_stripOutputTime{0};
96  mutable std::atomic<cl_ulong> m_kernelTime{0};
97 
98  // Buffers for input
99  mutable std::vector<cl::Buffer> m_pixelClusterInputBufferList ATLAS_THREAD_SAFE;
100  mutable std::vector<cl::Buffer> m_stripClusterInputBufferList ATLAS_THREAD_SAFE;
101  // Buffers for Clustering
102  mutable std::vector<cl::Buffer> m_stripClusterOutputBufferList ATLAS_THREAD_SAFE;
103  mutable std::vector<cl::Buffer> m_pixelClusterEDMOutputBufferList ATLAS_THREAD_SAFE;
104  mutable std::vector<cl::Buffer> m_stripClusterEDMOutputBufferList ATLAS_THREAD_SAFE;
105  // L2G
106  mutable std::vector<cl::Buffer> m_stripL2GOutputBufferList ATLAS_THREAD_SAFE;
107  mutable std::vector<cl::Buffer> m_stripL2GEDMOutputBufferList ATLAS_THREAD_SAFE;
108  // EDMPrep
109  mutable std::vector<cl::Buffer> m_edmPixelOutputBufferList ATLAS_THREAD_SAFE;
110  mutable std::vector<cl::Buffer> m_edmStripOutputBufferList ATLAS_THREAD_SAFE;
111 
112  // Command queue
113  cl::CommandQueue m_acc_queue;
114 
115 
116  void getListofCUs(std::vector<std::string>& cuNames);
117 
118 
119  };
120 }
121 
122 #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:88
EFTrackingFPGAIntegration::F110IntegrationAlg::m_stripEdmKernelName
Gaudi::Property< std::string > m_stripEdmKernelName
Name of the FPGA kernel.
Definition: F110IntegrationAlg.h:62
EFTrackingFPGAIntegration::F110IntegrationAlg::m_acc_queue
cl::CommandQueue m_acc_queue
Definition: F110IntegrationAlg.h:113
IRegSelTool.h
EFTrackingFPGAIntegration::F110IntegrationAlg::ATLAS_THREAD_SAFE
std::vector< cl::Buffer > m_edmStripOutputBufferList ATLAS_THREAD_SAFE
Definition: F110IntegrationAlg.h:110
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:84
EFTrackingFPGAIntegration::F110IntegrationAlg::m_pixelInputTime
std::atomic< cl_ulong > m_pixelInputTime
Time for pixel input buffer write.
Definition: F110IntegrationAlg.h:87
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:73
EFTrackingFPGAIntegration::F110IntegrationAlg::m_stripL2GTime
std::atomic< cl_ulong > m_stripL2GTime
Time for strip L2G.
Definition: F110IntegrationAlg.h:91
EFTrackingFPGAIntegration::F110IntegrationAlg::ATLAS_THREAD_SAFE
std::vector< cl::Kernel > m_pixelEDMKernels ATLAS_THREAD_SAFE
Definition: F110IntegrationAlg.h:80
EFTrackingFPGAIntegration::F110IntegrationAlg::ATLAS_THREAD_SAFE
std::vector< cl::Buffer > m_pixelClusterEDMOutputBufferList ATLAS_THREAD_SAFE
Definition: F110IntegrationAlg.h:103
EFTrackingFPGAIntegration::F110IntegrationAlg::m_fpgaHandleMtx
std::mutex m_fpgaHandleMtx
Definition: F110IntegrationAlg.h:70
EFTrackingFPGAIntegration::F110IntegrationAlg::m_kernelTime
std::atomic< cl_ulong > m_kernelTime
Time for kernel execution.
Definition: F110IntegrationAlg.h:96
EFTrackingFPGAIntegration::F110IntegrationAlg::ATLAS_THREAD_SAFE
std::vector< cl::Event > m_pixelEDMEndEvents ATLAS_THREAD_SAFE
Definition: F110IntegrationAlg.h:77
IntegrationBase.h
EFTrackingFPGAIntegration::F110IntegrationAlg::ATLAS_THREAD_SAFE
std::vector< cl::Kernel > m_stripClusterKernels ATLAS_THREAD_SAFE
Definition: F110IntegrationAlg.h:82
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:107
EFTrackingFPGAIntegration::F110IntegrationAlg::m_pixelOutputTime
std::atomic< cl_ulong > m_pixelOutputTime
Time for pixel output buffer read.
Definition: F110IntegrationAlg.h:94
EFTrackingFPGAIntegration::F110IntegrationAlg::m_FPGAStripOutput
SG::WriteHandleKey< std::vector< uint64_t > > m_FPGAStripOutput
Definition: F110IntegrationAlg.h:54
EFTrackingFPGAIntegration::F110IntegrationAlg::ATLAS_THREAD_SAFE
std::vector< cl::Event > m_pixelClusterEndEvents ATLAS_THREAD_SAFE
Definition: F110IntegrationAlg.h:76
EFTrackingFPGAIntegration::F110IntegrationAlg::ATLAS_THREAD_SAFE
std::vector< cl::Event > m_stripEDMEndEvents ATLAS_THREAD_SAFE
Definition: F110IntegrationAlg.h:74
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:58
EFTrackingFPGAIntegration::F110IntegrationAlg::ATLAS_THREAD_SAFE
std::vector< cl::Event > m_stripClusterEndEvents ATLAS_THREAD_SAFE
Definition: F110IntegrationAlg.h:72
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:106
EFTrackingFPGAIntegration::F110IntegrationAlg::m_pixelEdmKernelName
Gaudi::Property< std::string > m_pixelEdmKernelName
Name of the FPGA kernel.
Definition: F110IntegrationAlg.h:60
EFTrackingFPGAIntegration::F110IntegrationAlg::m_pixelClusterKernelName
Gaudi::Property< std::string > m_pixelClusterKernelName
Name of the pixel clustering kernel.
Definition: F110IntegrationAlg.h:64
EFTrackingFPGAIntegration::F110IntegrationAlg::ATLAS_THREAD_SAFE
std::vector< cl::Buffer > m_edmPixelOutputBufferList ATLAS_THREAD_SAFE
Definition: F110IntegrationAlg.h:109
EFTrackingFPGAIntegration
The class for enconding RDO to FPGA format.
Definition: BenchmarkAlg.h:28
EFTrackingFPGAIntegration::F110IntegrationAlg::m_pixelEdmPrepTime
std::atomic< cl_ulong > m_pixelEdmPrepTime
Time for pixel EDM preparation.
Definition: F110IntegrationAlg.h:92
EFTrackingFPGAIntegration::F110IntegrationAlg::getListofCUs
void getListofCUs(std::vector< std::string > &cuNames)
Definition: F110IntegrationAlg.cxx:373
EFTrackingFPGAIntegration::F110IntegrationAlg::ATLAS_THREAD_SAFE
std::vector< cl::Buffer > m_stripClusterEDMOutputBufferList ATLAS_THREAD_SAFE
Definition: F110IntegrationAlg.h:104
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:79
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:135
EFTrackingFPGAIntegration::F110IntegrationAlg::m_chronoSvc
ServiceHandle< IChronoSvc > m_chronoSvc
Service for timing the algorithm.
Definition: F110IntegrationAlg.h:48
xAODClusterMaker.h
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:351
EFTrackingFPGAIntegration::F110IntegrationAlg::m_stripClusterKernelName
Gaudi::Property< std::string > m_stripClusterKernelName
Name of the strip clustering kernel.
Definition: F110IntegrationAlg.h:66
EFTrackingFPGAIntegration::F110IntegrationAlg::getDepVector
std::vector< cl::Event > getDepVector(std::vector< cl::Event > &endEvents, size_t cu) const
Definition: F110IntegrationAlg.cxx:120
EFTrackingFPGAIntegration::F110IntegrationAlg::ATLAS_THREAD_SAFE
std::vector< cl::Kernel > m_stripEDMKernels ATLAS_THREAD_SAFE
Definition: F110IntegrationAlg.h:83
EFTrackingFPGAIntegration::F110IntegrationAlg::m_pixelClusteringTime
std::atomic< cl_ulong > m_pixelClusteringTime
Time for pixel clustering.
Definition: F110IntegrationAlg.h:89
EFTrackingFPGAIntegration::F110IntegrationAlg::m_stripEdmPrepTime
std::atomic< cl_ulong > m_stripEdmPrepTime
Time for strip EDM preparation.
Definition: F110IntegrationAlg.h:93
EFTrackingFPGAIntegration::F110IntegrationAlg::ATLAS_THREAD_SAFE
std::vector< cl::Buffer > m_pixelClusterInputBufferList ATLAS_THREAD_SAFE
Definition: F110IntegrationAlg.h:99
TestVectorTool.h
EFTrackingFPGAIntegration::F110IntegrationAlg::m_stripL2GKernelName
Gaudi::Property< std::string > m_stripL2GKernelName
Name of the strip L2G kernelS.
Definition: F110IntegrationAlg.h:68
EFTrackingFPGAIntegration::F110IntegrationAlg::ATLAS_THREAD_SAFE
std::vector< cl::Buffer > m_stripClusterInputBufferList ATLAS_THREAD_SAFE
Definition: F110IntegrationAlg.h:100
EFTrackingFPGAIntegration::F110IntegrationAlg::m_FPGAThreads
Gaudi::Property< int > m_FPGAThreads
Definition: F110IntegrationAlg.h:56
EFTrackingFPGAIntegration::F110IntegrationAlg::m_FPGAPixelOutput
SG::WriteHandleKey< std::vector< uint64_t > > m_FPGAPixelOutput
Definition: F110IntegrationAlg.h:53
EFTrackingFPGAIntegration::F110IntegrationAlg::ATLAS_THREAD_SAFE
std::vector< cl::Buffer > m_stripClusterOutputBufferList ATLAS_THREAD_SAFE
Definition: F110IntegrationAlg.h:102
EFTrackingFPGAIntegration::F110IntegrationAlg::m_stripOutputTime
std::atomic< cl_ulong > m_stripOutputTime
Time for strip output buffer read.
Definition: F110IntegrationAlg.h:95
EFTrackingFPGAIntegration::F110IntegrationAlg::m_numEvents
std::atomic< ulonglong > m_numEvents
Number of events processed.
Definition: F110IntegrationAlg.h:86
TrigRoiDescriptorCollection.h
EFTrackingFPGAIntegration::F110IntegrationAlg::m_stripClusteringTime
std::atomic< cl_ulong > m_stripClusteringTime
Time for strip clustering.
Definition: F110IntegrationAlg.h:90
ServiceHandle< IChronoSvc >