ATLAS Offline Software
Loading...
Searching...
No Matches
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
8
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
48 ServiceHandle<IChronoSvc> m_chronoSvc{"ChronoStatSvc", name()};
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
73 mutable std::mutex m_fpgaHandleMtx;
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
This is the class for the benchmark algorithm specific to the FPGA integration and output conversion.
std::vector< cl::Event > getDepVector(std::vector< cl::Event > &endEvents, size_t cu) const
Gaudi::Property< std::string > m_stripL2GKernelName
Name of the strip L2G kernelS.
SG::ReadHandleKey< std::vector< uint64_t > > m_FPGAPixelRDO
std::vector< cl::Event > m_stripClusterEndEvents ATLAS_THREAD_SAFE
SG::WriteHandleKey< std::vector< uint32_t > > m_FPGAPixelOutput
Gaudi::Property< std::string > m_pixelEdmKernelName
Name of the FPGA kernel.
std::atomic< cl_ulong > m_pixelInputTime
Time for pixel input buffer write.
virtual StatusCode initialize() override final
Detect the OpenCL devices and prepare OpenCL context.
std::atomic< cl_ulong > m_stripOutputTime
Time for strip output buffer read.
ServiceHandle< IChronoSvc > m_chronoSvc
Service for timing the algorithm.
Gaudi::Property< std::string > m_xclbin
Path and name of the xclbin file.
std::atomic< cl_ulong > m_pixelClusteringTime
Time for pixel clustering.
std::atomic< cl_ulong > m_kernelTime
Time for kernel execution.
std::atomic< cl_ulong > m_stripInputTime
Time for strip input buffer write.
virtual StatusCode finalize() override final
std::atomic< cl_ulong > m_pixelOutputTime
Time for pixel output buffer read.
SG::WriteHandleKey< std::vector< uint32_t > > m_FPGAStripOutput
Gaudi::Property< std::string > m_stripEdmKernelName
Name of the FPGA kernel.
std::atomic< cl_ulong > m_stripClusteringTime
Time for strip clustering.
Gaudi::Property< std::string > m_pixelClusterKernelName
Name of the pixel clustering kernel.
Gaudi::Property< std::string > m_stripClusterKernelName
Name of the strip clustering kernel.
std::atomic< ulonglong > m_numEvents
Number of events processed.
void getListofCUs(std::vector< std::string > &cuNames)
virtual StatusCode execute(const EventContext &ctx) const override final
Should be overriden by derived classes to perform meaningful work.
std::atomic< cl_ulong > m_pixelEdmPrepTime
Time for pixel EDM preparation.
std::atomic< cl_ulong > m_stripL2GTime
Time for strip L2G.
std::atomic< cl_ulong > m_stripEdmPrepTime
Time for strip EDM preparation.
SG::ReadHandleKey< std::vector< uint64_t > > m_FPGAStripRDO
The base class for the EFTracking FPGA integration development.
Property holding a SG store/key/clid from which a ReadHandle is made.
Property holding a SG store/key/clid from which a WriteHandle is made.
The class for enconding RDO to FPGA format.