ATLAS Offline Software
F100IntegrationAlg.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2025 CERN for the benefit of the ATLAS collaboration
3  */
4 
6 #include "AthenaKernel/Chrono.h"
8 #include <xrt/xrt_bo.h>
9 #include <xrt/xrt_device.h>
10 #include <xrt/xrt_kernel.h>
11 #include <xrt/xrt_uuid.h>
12 
14 {
16  {
17  ATH_MSG_INFO("Running on the FPGA accelerator");
18 
20 
21  ATH_CHECK(m_chronoSvc.retrieve());
22 
23  {
24  Athena::Chrono chrono("Platform and device initlize", m_chronoSvc.get());
26  }
27 
28  {
29  Athena::Chrono chrono("CL::loadProgram", m_chronoSvc.get());
31  }
32  ATH_MSG_INFO("loading "<<m_xclbin);
33 
34 
37 
40 
41  std::vector<std::string> listofCUs;
42 
43  getListofCUs(listofCUs);
44 
45  cl_int err = 0;
46 
47  unsigned int nthreads = m_FPGAThreads.value();
48 
49  if(m_FPGAThreads.value() < 1){
50  nthreads = SG::getNSlots();
51  }
52 
53  // create the buffers
54  for(unsigned int i = 0; i < nthreads; i++)
55  {
56  m_acc_queues.emplace_back(m_context, m_accelerator, CL_QUEUE_PROFILING_ENABLE | CL_QUEUE_OUT_OF_ORDER_EXEC_MODE_ENABLE, &err);
57 
58  // Input
59  m_pixelClusterInputBufferList.push_back(cl::Buffer(m_context, CL_MEM_READ_ONLY, EFTrackingTransient::PIXEL_CONTAINER_INPUT_BUF_SIZE * sizeof(uint64_t), NULL, &err));
60  m_stripClusterInputBufferList.push_back(cl::Buffer(m_context, CL_MEM_READ_ONLY, EFTrackingTransient::STRIP_CONTAINER_INPUT_BUF_SIZE * sizeof(uint64_t), NULL, &err));
61 
62  // Clustering
63  if (!m_doF110) {
64  m_pixelClusterOutputBufferList.push_back(cl::Buffer(m_context, CL_MEM_READ_WRITE, EFTrackingTransient::PIXEL_BLOCK_BUF_SIZE * sizeof(uint64_t), NULL, &err));
65  }
66  m_stripClusterOutputBufferList.push_back(cl::Buffer(m_context, CL_MEM_READ_WRITE, EFTrackingTransient::STRIP_BLOCK_BUF_SIZE * sizeof(uint64_t), NULL, &err));
67  m_pixelClusterEDMOutputBufferList.push_back(cl::Buffer(m_context, CL_MEM_READ_WRITE,EFTrackingTransient::PIXEL_BLOCK_BUF_SIZE * sizeof(uint64_t), NULL, &err));
68  m_stripClusterEDMOutputBufferList.push_back(cl::Buffer(m_context, CL_MEM_READ_WRITE, EFTrackingTransient::STRIP_BLOCK_BUF_SIZE * sizeof(uint64_t), NULL, &err));
69  // L2G
70  if (!m_doF110) {
71  m_pixelL2GOutputBufferList.push_back(cl::Buffer(m_context, CL_MEM_READ_WRITE, EFTrackingTransient::PIXEL_BLOCK_BUF_SIZE * sizeof(uint64_t), NULL, &err));
72  m_pixelL2GEDMOutputBufferList.push_back(cl::Buffer(m_context, CL_MEM_READ_WRITE, EFTrackingTransient::PIXEL_BLOCK_BUF_SIZE * sizeof(uint64_t), NULL, &err));
73  }
74  m_stripL2GOutputBufferList.push_back(cl::Buffer(m_context, CL_MEM_READ_WRITE, EFTrackingTransient::STRIP_BLOCK_BUF_SIZE * sizeof(uint64_t), NULL, &err));
75  m_stripL2GEDMOutputBufferList.push_back(cl::Buffer(m_context, CL_MEM_READ_WRITE, EFTrackingTransient::STRIP_BLOCK_BUF_SIZE * sizeof(uint64_t), NULL, &err));
76  // EDMPrep
77  m_edmPixelOutputBufferList.push_back(cl::Buffer(m_context, CL_MEM_READ_WRITE, EFTrackingTransient::PIXEL_CONTAINER_BUF_SIZE * sizeof(uint64_t), NULL, &err));
78  m_edmStripOutputBufferList.push_back(cl::Buffer(m_context, CL_MEM_READ_WRITE, EFTrackingTransient::STRIP_CONTAINER_BUF_SIZE * sizeof(uint64_t), NULL, &err));
79  }
80 
81  // Create kernels for each one of CUs that is inside device
82  for (const auto& cuName: listofCUs)
83  {
84  // Pixel clustering
85  if(cuName.find(m_pixelClusterKernelName.value()) != std::string::npos) m_pixelClusteringKernels.emplace_back(cl::Kernel(m_program, cuName.c_str()));
86 
87  // Strip clustering
88  else if(cuName.find(m_stripClusterKernelName.value()) != std::string::npos) m_stripClusteringKernels.emplace_back(cl::Kernel(m_program, cuName.c_str()));
89 
90  // Pixel L2G
91  else if(m_doF110 && cuName.find(m_pixelL2GKernelName.value()) != std::string::npos) m_pixelL2GKernels.emplace_back(cl::Kernel(m_program, cuName.c_str()));
92 
93  // Strip L2G
94  else if(cuName.find(m_stripL2GKernelName.value()) != std::string::npos) m_stripL2GKernels.emplace_back(cl::Kernel(m_program, cuName.c_str()));
95 
96  // EDM prep
97  else if(m_doF110 && cuName.find(m_pixelEdmKernelName.value()) != std::string::npos) m_pixelEdmPrepKernels.emplace_back(cl::Kernel(m_program, cuName.c_str()));
98 
99  else if(m_doF110 && cuName.find(m_stripEdmKernelName.value()) != std::string::npos) m_stripEdmPrepKernels.emplace_back(cl::Kernel(m_program, cuName.c_str()));
100  else if(!m_doF110 && cuName.find(m_edmKernelName.value()) != std::string::npos) m_edmPrepKernels.emplace_back(cl::Kernel(m_program, cuName.c_str()));
101  else
102  {
103  ATH_MSG_WARNING("Do not recognize kernel name: "<<cuName);
104  }
105  }
106 
107  ATH_MSG_INFO(m_pixelClusterKernelName.value()<<" size: "<<m_pixelClusteringKernels.size());
108  ATH_MSG_INFO(m_stripClusterKernelName.value()<<" size: "<<m_stripClusteringKernels.size());
109  ATH_MSG_INFO(m_pixelL2GKernelName.value()<<" size: "<<m_pixelL2GKernels.size());
110  ATH_MSG_INFO(m_stripL2GKernelName.value()<<" size: "<<m_stripL2GKernels.size());
111  ATH_MSG_INFO(m_pixelEdmKernelName.value()<<" size: "<<m_pixelEdmPrepKernels.size());
112  ATH_MSG_INFO(m_stripEdmKernelName.value()<<" size: "<<m_stripEdmPrepKernels.size());
113  ATH_MSG_INFO(m_edmKernelName.value()<<" size: "<<m_edmPrepKernels.size());
114 
115 
116  return StatusCode::SUCCESS;
117  }
118 
119  StatusCode F100IntegrationAlg::execute(const EventContext &ctx) const
120  {
121  ATH_MSG_DEBUG("Executing F100IntegrationAlg");
122  m_numEvents++;
123 
125  const std::vector<uint64_t>* pixelInput{nullptr}, *stripInput{nullptr};
126  ATH_CHECK(SG::get(pixelInput, m_FPGAPixelRDO, ctx));
127  ATH_CHECK(SG::get(stripInput, m_FPGAStripRDO, ctx));
128 
129 
130  // logic
131  unsigned int nthreads = m_FPGAThreads.value();
132 
133  if(m_FPGAThreads.value() < 1){
134  nthreads = SG::getNSlots();
135  }
136 
137  size_t bufferIndex = ctx.slot() % nthreads;
138 
139  // Get index for each of the kernels
140  size_t pixelClusterIndex = ctx.slot() % m_pixelClusteringKernels.size();
141  size_t stripClusterIndex = ctx.slot() % m_stripClusteringKernels.size();
142  size_t stripL2GIndex = ctx.slot() % m_stripL2GKernels.size();
143  size_t pixelL2GIndex = m_pixelL2GKernels.size() ? ctx.slot() % m_pixelL2GKernels.size() : 0;
144  size_t edmIndex = m_edmPrepKernels.size() ? ctx.slot() % m_edmPrepKernels.size() : 0;
145  size_t pixelEDMIndex = m_pixelEdmPrepKernels.size() ? ctx.slot() % m_pixelEdmPrepKernels.size() : 0;
146  size_t stripEDMIndex = m_stripEdmPrepKernels.size() ? ctx.slot() % m_stripEdmPrepKernels.size() : 0;
147 
148  const cl::CommandQueue &acc_queue = m_acc_queues[bufferIndex];
149 
150  ATH_MSG_INFO("Thread number "<<ctx.slot()<<" running on buffer "<<bufferIndex<<" pixelClusterIndex: "<< pixelClusterIndex<<" stripClusterIndex: "<< stripClusterIndex<<" stripL2GIndex: "<< stripL2GIndex<<" pixelL2GIndex: "<< pixelL2GIndex<<" edmIndex: "<< edmIndex<<" pixelEDMIndex: "<< pixelEDMIndex<<" stripEDMIndex: "<< stripEDMIndex);
151 
152  cl::Kernel &pixelClusteringKernel = m_pixelClusteringKernels[pixelClusterIndex];
153  cl::Kernel &stripClusteringKernel = m_stripClusteringKernels[stripClusterIndex];
154  cl::Kernel &stripL2GKernel = m_stripL2GKernels[stripL2GIndex];
155 
156  cl::Kernel *pixelL2GKernel = nullptr;
157  cl::Kernel *edmPrepKernel = nullptr;
158  cl::Kernel *pixelEdmPrepKernel = nullptr;
159  cl::Kernel *stripEdmPrepKernel = nullptr;
160 
161  if (m_doF110) {
162  pixelEdmPrepKernel = &m_pixelEdmPrepKernels[pixelEDMIndex];
163  stripEdmPrepKernel = &m_stripEdmPrepKernels[stripEDMIndex];
164  } else {
165  edmPrepKernel = &m_edmPrepKernels[edmIndex];
166  pixelL2GKernel = &m_pixelL2GKernels[pixelL2GIndex];
167  }
168 
169  // Set kernel arguments
170  pixelClusteringKernel.setArg(0, m_pixelClusterInputBufferList[bufferIndex]);
171  if (m_doF110) {
172  pixelClusteringKernel.setArg(1, m_pixelClusterEDMOutputBufferList[bufferIndex]);
173  } else {
174  pixelClusteringKernel.setArg(1, m_pixelClusterOutputBufferList[bufferIndex]);
175  pixelClusteringKernel.setArg(2, m_pixelClusterEDMOutputBufferList[bufferIndex]);
176  }
177 
178  stripClusteringKernel.setArg(0, m_stripClusterInputBufferList[bufferIndex]);
179  stripClusteringKernel.setArg(1, m_stripClusterOutputBufferList[bufferIndex]);
180  stripClusteringKernel.setArg(2, m_stripClusterEDMOutputBufferList[bufferIndex]);
181  stripClusteringKernel.setArg(3, static_cast<unsigned int>((*stripInput).size()));
182 
183  if (!m_doF110) {
184  pixelL2GKernel->setArg(0, m_pixelClusterOutputBufferList[bufferIndex]);
185  pixelL2GKernel->setArg(1, m_pixelClusterEDMOutputBufferList[bufferIndex]);
186  pixelL2GKernel->setArg(2, m_pixelL2GOutputBufferList[bufferIndex]);
187  pixelL2GKernel->setArg(3, m_pixelL2GEDMOutputBufferList[bufferIndex]);
188  }
189 
190  stripL2GKernel.setArg(0, m_stripClusterOutputBufferList[bufferIndex]);
191  stripL2GKernel.setArg(1, m_stripClusterEDMOutputBufferList[bufferIndex]);
192  stripL2GKernel.setArg(2, m_stripL2GOutputBufferList[bufferIndex]);
193  stripL2GKernel.setArg(3, m_stripL2GEDMOutputBufferList[bufferIndex]);
194 
195  if (m_doF110) {
196  pixelEdmPrepKernel->setArg(0, m_pixelClusterEDMOutputBufferList[bufferIndex]);
197  pixelEdmPrepKernel->setArg(1, m_edmPixelOutputBufferList[bufferIndex]);
198  stripEdmPrepKernel->setArg(0, m_stripL2GEDMOutputBufferList[bufferIndex]);
199  stripEdmPrepKernel->setArg(1, m_edmStripOutputBufferList[bufferIndex]);
200  } else {
201  edmPrepKernel->setArg(0, m_pixelL2GEDMOutputBufferList[bufferIndex]);
202  edmPrepKernel->setArg(1, m_stripL2GEDMOutputBufferList[bufferIndex]);
203  edmPrepKernel->setArg(2, m_edmPixelOutputBufferList[bufferIndex]);
204  edmPrepKernel->setArg(3, m_edmStripOutputBufferList[bufferIndex]);
205  }
206 
207 
208 
209  // Start the transfers
210  cl::Event evt_write_pixel_input;
211  cl::Event evt_write_strip_input;
212 
213  acc_queue.enqueueWriteBuffer(m_pixelClusterInputBufferList[bufferIndex], CL_FALSE, 0, sizeof(uint64_t) * (*pixelInput).size(), (*pixelInput).data(), NULL, &evt_write_pixel_input);
214  acc_queue.enqueueWriteBuffer(m_stripClusterInputBufferList[bufferIndex], CL_FALSE, 0, sizeof(uint64_t) * (*stripInput).size(), (*stripInput).data(), NULL, &evt_write_strip_input);
215  std::vector<cl::Event> evt_vec_pixel_input{evt_write_pixel_input};
216  std::vector<cl::Event> evt_vec_strip_input{evt_write_strip_input};
217 
218 
219  cl::Event evt_pixel_clustering;
220  cl::Event evt_strip_clustering;
221  cl::Event evt_strip_l2g;
222  cl::Event evt_pixel_l2g;
223  cl::Event evt_edm_prep;
224  cl::Event evt_pixel_edm_prep;
225  cl::Event evt_strip_edm_prep;
226  {
227  Athena::Chrono chrono("Kernel execution", m_chronoSvc.get());
228  acc_queue.enqueueTask(pixelClusteringKernel, &evt_vec_pixel_input, &evt_pixel_clustering);
229  acc_queue.enqueueTask(stripClusteringKernel, &evt_vec_strip_input, &evt_strip_clustering);
230 
231  std::vector<cl::Event> evt_vec_pixel_clustering{evt_pixel_clustering};
232  std::vector<cl::Event> evt_vec_strip_clustering{evt_strip_clustering};
233  if (!m_doF110)
234  {
235  acc_queue.enqueueTask(*pixelL2GKernel, &evt_vec_pixel_clustering, &evt_pixel_l2g);
236  }
237  acc_queue.enqueueTask(stripL2GKernel, &evt_vec_strip_clustering, &evt_strip_l2g);
238 
239  if (!m_doF110)
240  {
241  std::vector<cl::Event> evt_vec_l2g{evt_pixel_l2g, evt_strip_l2g};
242  acc_queue.enqueueTask(*edmPrepKernel, &evt_vec_l2g, &evt_edm_prep);
243  }
244  else {
245  std::vector<cl::Event> evt_vec_strip_l2g{evt_strip_l2g};
246  acc_queue.enqueueTask(*pixelEdmPrepKernel, &evt_vec_pixel_clustering, &evt_pixel_edm_prep);
247  acc_queue.enqueueTask(*stripEdmPrepKernel, &evt_vec_strip_l2g, &evt_strip_edm_prep);
248  }
249  }
250 
251  cl::Event evt_pixel_cluster_output;
252  cl::Event evt_strip_cluster_output;
253 
254  std::vector<cl::Event> evt_vec_pixel_edm_prep;
255  std::vector<cl::Event> evt_vec_strip_edm_prep;
256  if(m_doF110)
257  {
258  evt_vec_pixel_edm_prep.push_back(evt_pixel_edm_prep);
259  evt_vec_strip_edm_prep.push_back(evt_strip_edm_prep);
260  }
261  else
262  {
263  evt_vec_pixel_edm_prep.push_back(evt_edm_prep);
264  evt_vec_strip_edm_prep.push_back(evt_edm_prep);
265  }
266 
267  // output handles
268 
270  ATH_CHECK(FPGAPixelOutput.record(std::make_unique<std::vector<uint64_t> >(EFTrackingTransient::PIXEL_CONTAINER_BUF_SIZE, 0)));
271 
273  ATH_CHECK(FPGAStripOutput.record(std::make_unique<std::vector<uint64_t> >(EFTrackingTransient::STRIP_CONTAINER_BUF_SIZE, 0)));
274 
275  acc_queue.enqueueReadBuffer(m_edmPixelOutputBufferList[bufferIndex], CL_FALSE, 0, sizeof(uint64_t) * (*FPGAPixelOutput).size(), (*FPGAPixelOutput).data(), &evt_vec_pixel_edm_prep, &evt_pixel_cluster_output);
276  acc_queue.enqueueReadBuffer(m_edmStripOutputBufferList[bufferIndex], CL_FALSE, 0, sizeof(uint64_t) * (*FPGAStripOutput).size(), (*FPGAStripOutput).data(), &evt_vec_strip_edm_prep, &evt_strip_cluster_output);
277 
278  std::vector<cl::Event> wait_for_reads = { evt_pixel_cluster_output, evt_strip_cluster_output };
279  cl::Event::waitForEvents(wait_for_reads);
280 
281 
282  if(pixelInput->size() == 6) (*FPGAPixelOutput)[0] = 0; // if no pixel input, set the first element to 0
283  if(stripInput->size() == 6) (*FPGAStripOutput)[0] = 0; // if no strip input, set the first element to 0
284 
285 
286  // calculate the time for the kernel execution
287  // get the time of writing pixel input buffer
288  cl_ulong pixel_input_time = evt_write_pixel_input.getProfilingInfo<CL_PROFILING_COMMAND_END>() - evt_write_pixel_input.getProfilingInfo<CL_PROFILING_COMMAND_START>();
289  m_pixelInputTime += pixel_input_time;
290  ATH_MSG_DEBUG("Pixel input buffer write time: " << pixel_input_time / 1e6 << " ms");
291 
292  // get the time of writing strip input buffer
293  cl_ulong strip_input_time = evt_write_strip_input.getProfilingInfo<CL_PROFILING_COMMAND_END>() - evt_write_strip_input.getProfilingInfo<CL_PROFILING_COMMAND_START>();
294  m_stripInputTime += strip_input_time;
295  ATH_MSG_DEBUG("Strip input buffer write time: " << strip_input_time / 1e6 << " ms");
296 
297  // get the time of pixel clustering
298  cl_ulong pixel_clustering_time = evt_pixel_clustering.getProfilingInfo<CL_PROFILING_COMMAND_END>() - evt_pixel_clustering.getProfilingInfo<CL_PROFILING_COMMAND_START>();
299  m_pixelClusteringTime += pixel_clustering_time;
300  ATH_MSG_DEBUG("Pixel clustering time: " << pixel_clustering_time / 1e6 << " ms");
301 
302  // get the time of strip clustering
303  cl_ulong strip_clustering_time = evt_strip_clustering.getProfilingInfo<CL_PROFILING_COMMAND_END>() - evt_strip_clustering.getProfilingInfo<CL_PROFILING_COMMAND_START>();
304  m_stripClusteringTime += strip_clustering_time;
305  ATH_MSG_DEBUG("Strip clustering time: " << strip_clustering_time / 1e6 << " ms");
306 
307  if (!m_doF110) {
308  // get the time of pixel L2G
309  cl_ulong pixel_l2g_time = evt_pixel_l2g.getProfilingInfo<CL_PROFILING_COMMAND_END>() - evt_pixel_l2g.getProfilingInfo<CL_PROFILING_COMMAND_START>();
310  m_pixelL2GTime += pixel_l2g_time;
311  ATH_MSG_DEBUG("Pixel L2G time: " << pixel_l2g_time / 1e6 << " ms");
312  }
313 
314  // get the time of strip L2G
315  cl_ulong strip_l2g_time = evt_strip_l2g.getProfilingInfo<CL_PROFILING_COMMAND_END>() - evt_strip_l2g.getProfilingInfo<CL_PROFILING_COMMAND_START>();
316  m_stripL2GTime += strip_l2g_time;
317  ATH_MSG_DEBUG("Strip L2G time: " << strip_l2g_time / 1e6 << " ms");
318 
319  // get the time of EDMPrep
320  if (m_doF110) {
321  cl_ulong pixel_edm_prep_time = evt_pixel_edm_prep.getProfilingInfo<CL_PROFILING_COMMAND_END>() - evt_pixel_edm_prep.getProfilingInfo<CL_PROFILING_COMMAND_START>();
322  cl_ulong strip_edm_prep_time = evt_strip_edm_prep.getProfilingInfo<CL_PROFILING_COMMAND_END>() - evt_strip_edm_prep.getProfilingInfo<CL_PROFILING_COMMAND_START>();
323 
324  m_pixelEdmPrepTime += pixel_edm_prep_time;
325  ATH_MSG_DEBUG("PixelEDMPrep time: " << pixel_edm_prep_time / 1e6 << " ms");
326 
327  m_stripEdmPrepTime += strip_edm_prep_time;
328  ATH_MSG_DEBUG("StripEDMPrep time: " << strip_edm_prep_time / 1e6 << " ms");
329  }
330  else {
331  cl_ulong edm_prep_time = evt_edm_prep.getProfilingInfo<CL_PROFILING_COMMAND_END>() - evt_edm_prep.getProfilingInfo<CL_PROFILING_COMMAND_START>();
332 
333  m_edmPrepTime += edm_prep_time;
334  ATH_MSG_DEBUG("EDMPrep time: " << edm_prep_time / 1e6 << " ms");
335  }
336 
337  // get the time of the whole kernel execution
338  cl_ulong kernel_start = evt_pixel_clustering.getProfilingInfo<CL_PROFILING_COMMAND_QUEUED>();
339  cl_ulong kernel_end = m_doF110 ?
340  std::max(evt_pixel_edm_prep.getProfilingInfo<CL_PROFILING_COMMAND_END>(), evt_strip_edm_prep.getProfilingInfo<CL_PROFILING_COMMAND_END>()) :
341  evt_edm_prep.getProfilingInfo<CL_PROFILING_COMMAND_END>();
342  m_kernelTime += (kernel_end - kernel_start);
343  ATH_MSG_DEBUG("Kernel execution time: " << (kernel_end - kernel_start) / 1e6 << " ms");
344 
345  // get the time of reading pixel output buffer
346  cl_ulong pixel_output_time = evt_pixel_cluster_output.getProfilingInfo<CL_PROFILING_COMMAND_END>() - evt_pixel_cluster_output.getProfilingInfo<CL_PROFILING_COMMAND_START>();
347  m_pixelOutputTime += pixel_output_time;
348  ATH_MSG_DEBUG("Pixel output buffer read time: " << pixel_output_time / 1e6 << " ms");
349 
350  // get the time of reading strip output buffer
351  cl_ulong strip_output_time = evt_strip_cluster_output.getProfilingInfo<CL_PROFILING_COMMAND_END>() - evt_strip_cluster_output.getProfilingInfo<CL_PROFILING_COMMAND_START>();
352  m_stripOutputTime += strip_output_time;
353  ATH_MSG_DEBUG("Strip output buffer read time: " << strip_output_time / 1e6 << " ms");
354 
355  return StatusCode::SUCCESS;
356  }
357 
359  {
360 
361  ATH_MSG_INFO("Finalizing F100IntegrationAlg");
362  ATH_MSG_INFO("Number of events: " << m_numEvents);
363 
364  if(m_numEvents > 0){
365  ATH_MSG_INFO("Pixel input ave time: " << m_pixelInputTime / m_numEvents / 1e6 << " ms");
366  ATH_MSG_INFO("Strip input ave time: " << m_stripInputTime / m_numEvents / 1e6 << " ms");
367  ATH_MSG_INFO("Pixel clustering ave time: " << m_pixelClusteringTime / m_numEvents / 1e6 << " ms");
368  ATH_MSG_INFO("Strip clustering ave time: " << m_stripClusteringTime / m_numEvents / 1e6 << " ms");
369  if (!m_doF110) {
370  ATH_MSG_INFO("Pixel L2G ave time: " << m_pixelL2GTime / m_numEvents / 1e6 << " ms");
371  }
372  ATH_MSG_INFO("Strip L2G ave time: " << m_stripL2GTime / m_numEvents / 1e6 << " ms");
373  if (!m_doF110) {
374  ATH_MSG_INFO("EDMPrep ave time: " << m_edmPrepTime / m_numEvents / 1e6 << " ms");
375  } else {
376  ATH_MSG_INFO("PixelEDMPrep ave time: " << m_pixelEdmPrepTime / m_numEvents / 1e6 << " ms");
377  ATH_MSG_INFO("StripEDMPrep ave time: " << m_stripEdmPrepTime / m_numEvents / 1e6 << " ms");
378  }
379  ATH_MSG_INFO("Kernel execution ave time: " << m_kernelTime / m_numEvents / 1e6 << " ms");
380  ATH_MSG_INFO("Pixel output ave time: " << m_pixelOutputTime / m_numEvents / 1e6 << " ms");
381  ATH_MSG_INFO("Strip output ave time: " << m_stripOutputTime / m_numEvents / 1e6 << " ms");
382  }
383 
384  return StatusCode::SUCCESS;
385  }
386 
387  void F100IntegrationAlg::getListofCUs(std::vector<std::string>& cuNames)
388  {
389  xrt::xclbin xrt_xclbin(m_xclbin);
390 
391  ATH_MSG_INFO("xsa name: "<<xrt_xclbin.get_xsa_name());
392  ATH_MSG_INFO("fpga name: "<<xrt_xclbin.get_fpga_device_name());
393  ATH_MSG_INFO("uuid: "<<xrt_xclbin.get_uuid().to_string());
394 
395  for (const xrt::xclbin::kernel &kernel : xrt_xclbin.get_kernels()) {
396  const std::string& kernelName = kernel.get_name();
397 
398  ATH_MSG_INFO("kernelName: "<<kernelName);
399 
400 
401  for (const xrt::xclbin::ip &computeUnit : kernel.get_cus()) {
402  const std::string& computeUnitName = computeUnit.get_name();
403  const std::string computeUnitIsolatedName = computeUnitName.substr(kernelName.size() + 1);
404 
405  const std::string computeUnitUsableName = kernelName + ":{" + computeUnitIsolatedName + "}";
406 
407  ATH_MSG_INFO("CU name: "<<computeUnitUsableName);
408  cuNames.push_back(computeUnitUsableName);
409  }
410  }
411  }
412 
413 } // namespace EFTrackingFPGAIntegration
EFTrackingFPGAIntegration::F100IntegrationAlg::m_kernelTime
std::atomic< cl_ulong > m_kernelTime
Time for kernel execution.
Definition: F100IntegrationAlg.h:93
EFTrackingFPGAIntegration::F100IntegrationAlg::m_FPGAStripOutput
SG::WriteHandleKey< std::vector< uint64_t > > m_FPGAStripOutput
Definition: F100IntegrationAlg.h:48
IntegrationBase::m_accelerator
cl::Device m_accelerator
Device object for the accelerator card.
Definition: IntegrationBase.h:66
IntegrationBase::initialize
virtual StatusCode initialize() override
Detect the OpenCL devices and prepare OpenCL context.
Definition: IntegrationBase.cxx:16
EFTrackingFPGAIntegration::F100IntegrationAlg::m_edmPixelOutputBufferList
std::vector< cl::Buffer > m_edmPixelOutputBufferList
Definition: F100IntegrationAlg.h:123
EFTrackingFPGAIntegration::F100IntegrationAlg::m_pixelL2GOutputBufferList
std::vector< cl::Buffer > m_pixelL2GOutputBufferList
Definition: F100IntegrationAlg.h:118
EFTrackingTransient::PIXEL_CONTAINER_BUF_SIZE
constexpr unsigned long PIXEL_CONTAINER_BUF_SIZE
Definition: EFTrackingTransient.h:36
EFTrackingFPGAIntegration::F100IntegrationAlg::m_stripEdmPrepTime
std::atomic< cl_ulong > m_stripEdmPrepTime
Time for strip EDM preparation.
Definition: F100IntegrationAlg.h:90
EFTrackingFPGAIntegration::F100IntegrationAlg::m_pixelEdmPrepTime
std::atomic< cl_ulong > m_pixelEdmPrepTime
Time for pixel EDM preparation.
Definition: F100IntegrationAlg.h:89
ATH_MSG_INFO
#define ATH_MSG_INFO(x)
Definition: AthMsgStreamMacros.h:31
EFTrackingFPGAIntegration::F100IntegrationAlg::m_stripL2GOutputBufferList
std::vector< cl::Buffer > m_stripL2GOutputBufferList
Definition: F100IntegrationAlg.h:119
make_unique
std::unique_ptr< T > make_unique(Args &&... args)
Definition: SkimmingToolEXOT5.cxx:23
EFTrackingFPGAIntegration::F100IntegrationAlg::m_FPGAStripRDO
SG::ReadHandleKey< std::vector< uint64_t > > m_FPGAStripRDO
Definition: F100IntegrationAlg.h:45
EFTrackingFPGAIntegration::F100IntegrationAlg::m_xclbin
Gaudi::Property< std::string > m_xclbin
Path and name of the xclbin file.
Definition: F100IntegrationAlg.h:52
EFTrackingFPGAIntegration::F100IntegrationAlg::m_pixelL2GTime
std::atomic< cl_ulong > m_pixelL2GTime
Time for pixel L2G.
Definition: F100IntegrationAlg.h:86
max
constexpr double max()
Definition: ap_fixedTest.cxx:33
EFTrackingFPGAIntegration::F100IntegrationAlg::m_FPGAThreads
Gaudi::Property< int > m_FPGAThreads
Definition: F100IntegrationAlg.h:50
JiveXML::Event
struct Event_t Event
Definition: ONCRPCServer.h:65
IntegrationBase::m_context
cl::Context m_context
Context object for the application.
Definition: IntegrationBase.h:67
EFTrackingFPGAIntegration::F100IntegrationAlg::getListofCUs
void getListofCUs(std::vector< std::string > &cuNames)
Definition: F100IntegrationAlg.cxx:387
EFTrackingFPGAIntegration::F100IntegrationAlg::m_pixelEdmKernelName
Gaudi::Property< std::string > m_pixelEdmKernelName
Name of the FPGA kernel.
Definition: F100IntegrationAlg.h:61
EFTrackingFPGAIntegration::F100IntegrationAlg::m_numEvents
std::atomic< ulonglong > m_numEvents
Number of events processed.
Definition: F100IntegrationAlg.h:81
EFTrackingFPGAIntegration::F100IntegrationAlg::m_stripL2GKernelName
Gaudi::Property< std::string > m_stripL2GKernelName
Name of the strip L2G kernelS.
Definition: F100IntegrationAlg.h:76
EFTrackingFPGAIntegration::F100IntegrationAlg::m_pixelClusterKernelName
Gaudi::Property< std::string > m_pixelClusterKernelName
Name of the pixel clustering kernel.
Definition: F100IntegrationAlg.h:67
Chrono.h
Exception-safe IChronoSvc caller.
EFTrackingFPGAIntegration::F100IntegrationAlg::m_stripClusteringTime
std::atomic< cl_ulong > m_stripClusteringTime
Time for strip clustering.
Definition: F100IntegrationAlg.h:85
EFTrackingFPGAIntegration::F100IntegrationAlg::m_stripL2GTime
std::atomic< cl_ulong > m_stripL2GTime
Time for strip L2G.
Definition: F100IntegrationAlg.h:87
EFTrackingFPGAIntegration::F100IntegrationAlg::finalize
virtual StatusCode finalize() override final
Definition: F100IntegrationAlg.cxx:358
EFTrackingFPGAIntegration::F100IntegrationAlg::m_edmKernelName
Gaudi::Property< std::string > m_edmKernelName
Name of the FPGA kernel.
Definition: F100IntegrationAlg.h:58
EFTrackingTransient::PIXEL_BLOCK_BUF_SIZE
constexpr unsigned long PIXEL_BLOCK_BUF_SIZE
Definition: EFTrackingTransient.h:34
EFTrackingTransient::STRIP_CONTAINER_BUF_SIZE
constexpr unsigned long STRIP_CONTAINER_BUF_SIZE
Definition: EFTrackingTransient.h:37
Athena::Chrono
Exception-safe IChronoSvc caller.
Definition: Chrono.h:50
EFTrackingFPGAIntegration::F100IntegrationAlg::m_stripL2GEDMOutputBufferList
std::vector< cl::Buffer > m_stripL2GEDMOutputBufferList
Definition: F100IntegrationAlg.h:121
dqt_zlumi_pandas.err
err
Definition: dqt_zlumi_pandas.py:183
lumiFormat.i
int i
Definition: lumiFormat.py:85
SG::get
const T * get(const ReadCondHandleKey< T > &key, const EventContext &ctx)
Convenience function to retrieve an object given a ReadCondHandleKey.
Definition: ReadCondHandle.h:287
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
ATH_MSG_DEBUG
#define ATH_MSG_DEBUG(x)
Definition: AthMsgStreamMacros.h:29
EFTrackingTransient::PIXEL_CONTAINER_INPUT_BUF_SIZE
constexpr unsigned long PIXEL_CONTAINER_INPUT_BUF_SIZE
Definition: EFTrackingTransient.h:42
find_tgc_unfilled_channelids.ip
ip
Definition: find_tgc_unfilled_channelids.py:3
EFTrackingFPGAIntegration::F100IntegrationAlg::m_edmStripOutputBufferList
std::vector< cl::Buffer > m_edmStripOutputBufferList
Definition: F100IntegrationAlg.h:124
xAOD::uint64_t
uint64_t
Definition: EventInfo_v1.cxx:123
EFTrackingFPGAIntegration::F100IntegrationAlg::m_stripInputTime
std::atomic< cl_ulong > m_stripInputTime
Time for strip input buffer write.
Definition: F100IntegrationAlg.h:83
ATH_CHECK
#define ATH_CHECK
Definition: AthCheckMacros.h:40
F100IntegrationAlg.h
EFTrackingFPGAIntegration::F100IntegrationAlg::m_stripClusterEDMOutputBufferList
std::vector< cl::Buffer > m_stripClusterEDMOutputBufferList
Definition: F100IntegrationAlg.h:116
IntegrationBase::precheck
StatusCode precheck(const std::vector< Gaudi::Property< std::string >> &inputs) const
Check if the the desired Gaudi properties are set.
Definition: IntegrationBase.cxx:154
SG::VarHandleKey::initialize
StatusCode initialize(bool used=true)
If this object is used as a property, then this should be called during the initialize phase.
Definition: AthToolSupport/AsgDataHandles/Root/VarHandleKey.cxx:103
EFTrackingFPGAIntegration
The class for enconding RDO to FPGA format.
Definition: BenchmarkAlg.h:28
EFTrackingFPGAIntegration::F100IntegrationAlg::m_chronoSvc
ServiceHandle< IChronoSvc > m_chronoSvc
Service for timing the algorithm.
Definition: F100IntegrationAlg.h:42
EFTrackingFPGAIntegration::F100IntegrationAlg::m_stripClusterOutputBufferList
std::vector< cl::Buffer > m_stripClusterOutputBufferList
Definition: F100IntegrationAlg.h:114
IntegrationBase::loadProgram
StatusCode loadProgram(const std::string &xclbin)
Find the xclbin file and load it into the OpenCL program object.
Definition: IntegrationBase.cxx:115
EFTrackingTransient::STRIP_CONTAINER_INPUT_BUF_SIZE
constexpr unsigned long STRIP_CONTAINER_INPUT_BUF_SIZE
Definition: EFTrackingTransient.h:43
EFTrackingFPGAIntegration::F100IntegrationAlg::m_pixelClusterInputBufferList
std::vector< cl::Buffer > m_pixelClusterInputBufferList
Definition: F100IntegrationAlg.h:110
EFTrackingFPGAIntegration::F100IntegrationAlg::m_pixelClusteringTime
std::atomic< cl_ulong > m_pixelClusteringTime
Time for pixel clustering.
Definition: F100IntegrationAlg.h:84
EFTrackingFPGAIntegration::F100IntegrationAlg::m_edmPrepTime
std::atomic< cl_ulong > m_edmPrepTime
Time for EDM preparation.
Definition: F100IntegrationAlg.h:88
EFTrackingFPGAIntegration::F100IntegrationAlg::execute
virtual StatusCode execute(const EventContext &ctx) const override final
Should be overriden by derived classes to perform meaningful work.
Definition: F100IntegrationAlg.cxx:119
EFTrackingFPGAIntegration::F100IntegrationAlg::m_FPGAPixelRDO
SG::ReadHandleKey< std::vector< uint64_t > > m_FPGAPixelRDO
Definition: F100IntegrationAlg.h:44
EFTrackingFPGAIntegration::F100IntegrationAlg::m_stripClusterKernelName
Gaudi::Property< std::string > m_stripClusterKernelName
Name of the strip clustering kernel.
Definition: F100IntegrationAlg.h:70
EFTrackingFPGAIntegration::F100IntegrationAlg::m_pixelClusterEDMOutputBufferList
std::vector< cl::Buffer > m_pixelClusterEDMOutputBufferList
Definition: F100IntegrationAlg.h:115
EFTrackingFPGAIntegration::F100IntegrationAlg::m_pixelInputTime
std::atomic< cl_ulong > m_pixelInputTime
Time for pixel input buffer write.
Definition: F100IntegrationAlg.h:82
EFTrackingFPGAIntegration::F100IntegrationAlg::m_stripOutputTime
std::atomic< cl_ulong > m_stripOutputTime
Time for strip output buffer read.
Definition: F100IntegrationAlg.h:92
EFTrackingFPGAIntegration::F100IntegrationAlg::m_pixelL2GEDMOutputBufferList
std::vector< cl::Buffer > m_pixelL2GEDMOutputBufferList
Definition: F100IntegrationAlg.h:120
EFTrackingTransient::STRIP_BLOCK_BUF_SIZE
constexpr unsigned long STRIP_BLOCK_BUF_SIZE
Definition: EFTrackingTransient.h:35
EFTrackingFPGAIntegration::F100IntegrationAlg::initialize
virtual StatusCode initialize() override final
Detect the OpenCL devices and prepare OpenCL context.
Definition: F100IntegrationAlg.cxx:15
SG::WriteHandle
Definition: StoreGate/StoreGate/WriteHandle.h:73
EFTrackingFPGAIntegration::F100IntegrationAlg::m_FPGAPixelOutput
SG::WriteHandleKey< std::vector< uint64_t > > m_FPGAPixelOutput
Definition: F100IntegrationAlg.h:47
SG::WriteHandle::record
StatusCode record(std::unique_ptr< T > data)
Record a const object to the store.
ATH_MSG_WARNING
#define ATH_MSG_WARNING(x)
Definition: AthMsgStreamMacros.h:32
SG::getNSlots
size_t getNSlots()
Return the number of event slots.
Definition: SlotSpecificObj.cxx:64
EFTrackingFPGAIntegration::F100IntegrationAlg::m_pixelL2GKernelName
Gaudi::Property< std::string > m_pixelL2GKernelName
Name of the pixel L2G kernel.
Definition: F100IntegrationAlg.h:73
EFTrackingFPGAIntegration::F100IntegrationAlg::m_pixelOutputTime
std::atomic< cl_ulong > m_pixelOutputTime
Time for pixel output buffer read.
Definition: F100IntegrationAlg.h:91
EFTrackingFPGAIntegration::F100IntegrationAlg::m_acc_queues
std::vector< cl::CommandQueue > m_acc_queues
Definition: F100IntegrationAlg.h:127
SlotSpecificObj.h
Maintain a set of objects, one per slot.
EFTrackingFPGAIntegration::F100IntegrationAlg::m_stripClusterInputBufferList
std::vector< cl::Buffer > m_stripClusterInputBufferList
Definition: F100IntegrationAlg.h:111
EFTrackingFPGAIntegration::F100IntegrationAlg::m_stripEdmKernelName
Gaudi::Property< std::string > m_stripEdmKernelName
Name of the FPGA kernel.
Definition: F100IntegrationAlg.h:64
IntegrationBase::m_program
cl::Program m_program
Program object containing the kernel.
Definition: IntegrationBase.h:68
EFTrackingFPGAIntegration::F100IntegrationAlg::m_doF110
Gaudi::Property< bool > m_doF110
Boolean to run F110 instead of F100.
Definition: F100IntegrationAlg.h:55
EFTrackingFPGAIntegration::F100IntegrationAlg::m_pixelClusterOutputBufferList
std::vector< cl::Buffer > m_pixelClusterOutputBufferList
Definition: F100IntegrationAlg.h:113