ATLAS Offline Software
F1X0IntegrationAlg.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(cuName.find(m_pixelEdmKernelName.value()) != std::string::npos) m_pixelEdmPrepKernels.emplace_back(cl::Kernel(m_program, cuName.c_str()));
98 
99  else if(cuName.find(m_stripEdmKernelName.value()) != std::string::npos) m_stripEdmPrepKernels.emplace_back(cl::Kernel(m_program, cuName.c_str()));
100  else
101  {
102  ATH_MSG_WARNING("Do not recognize kernel name: "<<cuName);
103  }
104  }
105 
106  ATH_MSG_INFO(m_pixelClusterKernelName.value()<<" size: "<<m_pixelClusteringKernels.size());
107  ATH_MSG_INFO(m_stripClusterKernelName.value()<<" size: "<<m_stripClusteringKernels.size());
108  ATH_MSG_INFO(m_pixelL2GKernelName.value()<<" size: "<<m_pixelL2GKernels.size());
109  ATH_MSG_INFO(m_stripL2GKernelName.value()<<" size: "<<m_stripL2GKernels.size());
110  ATH_MSG_INFO(m_pixelEdmKernelName.value()<<" size: "<<m_pixelEdmPrepKernels.size());
111  ATH_MSG_INFO(m_stripEdmKernelName.value()<<" size: "<<m_stripEdmPrepKernels.size());
112 
113  if(m_pixelClusteringKernels.size()==0){
114  ATH_MSG_FATAL("No m_pixelClusteringKernels constructed");
115  return StatusCode::FAILURE;
116  }
117 
118  // monitoring
119  if ( !m_monTool.empty() ) {
120  ATH_CHECK(m_monTool.retrieve() );
121  }
122  else {
123  ATH_MSG_INFO("Monitoring tool is empty");
124  }
125 
126  return StatusCode::SUCCESS;
127  }
128 
129  StatusCode F1X0IntegrationAlg::execute(const EventContext &ctx) const
130  {
131  ATH_MSG_DEBUG("Executing F1X0IntegrationAlg");
132  auto mnt_timer_Total = Monitored::Timer<std::chrono::milliseconds>("TIME_Total");
133  auto monTime = Monitored::Group(m_monTool, mnt_timer_Total);
134 
135  mnt_timer_Total.start();
136 
137  m_numEvents++;
138 
140  const std::vector<uint64_t>* pixelInput{nullptr}, *stripInput{nullptr};
141  ATH_CHECK(SG::get(pixelInput, m_FPGAPixelRDO, ctx));
142  ATH_CHECK(SG::get(stripInput, m_FPGAStripRDO, ctx));
143 
144 
145  // logic
146  unsigned int nthreads = m_FPGAThreads.value();
147 
148  if(m_FPGAThreads.value() < 1){
149  nthreads = SG::getNSlots();
150  }
151 
152  size_t bufferIndex = ctx.slot() % nthreads;
153 
154  // Get index for each of the kernels
155  size_t pixelClusterIndex = ctx.slot() % m_pixelClusteringKernels.size();
156  size_t stripClusterIndex = ctx.slot() % m_stripClusteringKernels.size();
157  size_t stripL2GIndex = ctx.slot() % m_stripL2GKernels.size();
158  size_t pixelL2GIndex = m_pixelL2GKernels.size() ? ctx.slot() % m_pixelL2GKernels.size() : 0;
159  size_t pixelEDMIndex = m_pixelEdmPrepKernels.size() ? ctx.slot() % m_pixelEdmPrepKernels.size() : 0;
160  size_t stripEDMIndex = m_stripEdmPrepKernels.size() ? ctx.slot() % m_stripEdmPrepKernels.size() : 0;
161 
162  const cl::CommandQueue &acc_queue = m_acc_queues[bufferIndex];
163 
164  cl::Kernel &pixelClusteringKernel = m_pixelClusteringKernels[pixelClusterIndex];
165  cl::Kernel &stripClusteringKernel = m_stripClusteringKernels[stripClusterIndex];
166  cl::Kernel &stripL2GKernel = m_stripL2GKernels[stripL2GIndex];
167  cl::Kernel &pixelEdmPrepKernel = m_pixelEdmPrepKernels[pixelEDMIndex];
168  cl::Kernel &stripEdmPrepKernel = m_stripEdmPrepKernels[stripEDMIndex];
169  cl::Kernel *pixelL2GKernel = nullptr;
170 
171  if (!m_doF110) pixelL2GKernel = &m_pixelL2GKernels[pixelL2GIndex];
172 
173  // Set kernel arguments
174  pixelClusteringKernel.setArg(0, m_pixelClusterInputBufferList[bufferIndex]);
175  if (m_doF110) {
176  pixelClusteringKernel.setArg(1, m_pixelClusterEDMOutputBufferList[bufferIndex]);
177  } else {
178  pixelClusteringKernel.setArg(1, m_pixelClusterOutputBufferList[bufferIndex]);
179  pixelClusteringKernel.setArg(2, m_pixelClusterEDMOutputBufferList[bufferIndex]);
180 
181  uint32_t hit_vector_size_bytes = sizeof(uint64_t) * (*pixelInput).size();
182  uint32_t cluster_vector_size_bytes = sizeof(uint64_t) * (*pixelInput).size();
183  uint32_t edm_vector_size_bytes = sizeof(uint64_t) * (*pixelInput).size() * 8;
184 
185 
186  pixelClusteringKernel.setArg(3, hit_vector_size_bytes);
187  pixelClusteringKernel.setArg(4, cluster_vector_size_bytes);
188  pixelClusteringKernel.setArg(5, edm_vector_size_bytes);
189  }
190 
191  stripClusteringKernel.setArg(0, m_stripClusterInputBufferList[bufferIndex]);
192  stripClusteringKernel.setArg(1, m_stripClusterOutputBufferList[bufferIndex]);
193  stripClusteringKernel.setArg(2, m_stripClusterEDMOutputBufferList[bufferIndex]);
194  stripClusteringKernel.setArg(3, static_cast<unsigned int>((*stripInput).size()));
195 
196  if (!m_doF110) {
197  pixelL2GKernel->setArg(0, m_pixelClusterOutputBufferList[bufferIndex]);
198  pixelL2GKernel->setArg(1, m_pixelClusterEDMOutputBufferList[bufferIndex]);
199  pixelL2GKernel->setArg(2, m_pixelL2GOutputBufferList[bufferIndex]);
200  pixelL2GKernel->setArg(3, m_pixelL2GEDMOutputBufferList[bufferIndex]);
201  }
202 
203  stripL2GKernel.setArg(0, m_stripClusterOutputBufferList[bufferIndex]);
204  stripL2GKernel.setArg(1, m_stripClusterEDMOutputBufferList[bufferIndex]);
205  stripL2GKernel.setArg(2, m_stripL2GOutputBufferList[bufferIndex]);
206  stripL2GKernel.setArg(3, m_stripL2GEDMOutputBufferList[bufferIndex]);
207 
208 
209  pixelEdmPrepKernel.setArg(0, m_pixelClusterEDMOutputBufferList[bufferIndex]);
210  pixelEdmPrepKernel.setArg(1, m_edmPixelOutputBufferList[bufferIndex]);
211  stripEdmPrepKernel.setArg(0, m_stripL2GEDMOutputBufferList[bufferIndex]);
212  stripEdmPrepKernel.setArg(1, m_edmStripOutputBufferList[bufferIndex]);
213 
214 
215 
216  // Start the transfers
217  cl::Event evt_write_pixel_input;
218  cl::Event evt_write_strip_input;
219 
220  acc_queue.enqueueWriteBuffer(m_pixelClusterInputBufferList[bufferIndex], CL_FALSE, 0, sizeof(uint64_t) * (*pixelInput).size(), (*pixelInput).data(), NULL, &evt_write_pixel_input);
221  acc_queue.enqueueWriteBuffer(m_stripClusterInputBufferList[bufferIndex], CL_FALSE, 0, sizeof(uint64_t) * (*stripInput).size(), (*stripInput).data(), NULL, &evt_write_strip_input);
222  std::vector<cl::Event> evt_vec_pixel_input{evt_write_pixel_input};
223  std::vector<cl::Event> evt_vec_strip_input{evt_write_strip_input};
224 
225 
226  cl::Event evt_pixel_clustering;
227  cl::Event evt_strip_clustering;
228  cl::Event evt_strip_l2g;
229  cl::Event evt_pixel_l2g;
230  cl::Event evt_edm_prep;
231  cl::Event evt_pixel_edm_prep;
232  cl::Event evt_strip_edm_prep;
233  {
234  Athena::Chrono chrono("Kernel execution", m_chronoSvc.get());
235  acc_queue.enqueueTask(pixelClusteringKernel, &evt_vec_pixel_input, &evt_pixel_clustering);
236  acc_queue.enqueueTask(stripClusteringKernel, &evt_vec_strip_input, &evt_strip_clustering);
237 
238  std::vector<cl::Event> evt_vec_strip_clustering{evt_strip_clustering};
239  if (!m_doF110)
240  {
241  std::vector<cl::Event> evt_vec_pixel_clustering{evt_pixel_clustering};
242  acc_queue.enqueueTask(*pixelL2GKernel, &evt_vec_pixel_clustering, &evt_pixel_l2g);
243  }
244  acc_queue.enqueueTask(stripL2GKernel, &evt_vec_strip_clustering, &evt_strip_l2g);
245 
246  std::vector<cl::Event> evt_vec_pixelEDM;
247  if(m_doF110) evt_vec_pixelEDM.push_back(evt_pixel_clustering);
248  else evt_vec_pixelEDM.push_back(evt_pixel_l2g);
249  std::vector<cl::Event> evt_vec_strip_l2g{evt_strip_l2g};
250  acc_queue.enqueueTask(pixelEdmPrepKernel, &evt_vec_pixelEDM, &evt_pixel_edm_prep);
251  acc_queue.enqueueTask(stripEdmPrepKernel, &evt_vec_strip_l2g, &evt_strip_edm_prep);
252 
253  }
254 
255  cl::Event evt_pixel_cluster_output;
256  cl::Event evt_strip_cluster_output;
257 
258  std::vector<cl::Event> evt_vec_pixel_edm_prep;
259  std::vector<cl::Event> evt_vec_strip_edm_prep;
260 
261  evt_vec_pixel_edm_prep.push_back(evt_pixel_edm_prep);
262  evt_vec_strip_edm_prep.push_back(evt_strip_edm_prep);
263 
264 
265  // output handles
266 
268  ATH_CHECK(FPGAPixelOutput.record(std::make_unique<std::vector<uint64_t> >(EFTrackingTransient::PIXEL_CONTAINER_BUF_SIZE, 0)));
269 
271  ATH_CHECK(FPGAStripOutput.record(std::make_unique<std::vector<uint64_t> >(EFTrackingTransient::STRIP_CONTAINER_BUF_SIZE, 0)));
272 
273  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);
274  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);
275 
276  std::vector<cl::Event> wait_for_reads = { evt_pixel_cluster_output, evt_strip_cluster_output };
277  cl::Event::waitForEvents(wait_for_reads);
278 
279  mnt_timer_Total.stop();
280 
281  if(pixelInput->size() == 6) (*FPGAPixelOutput)[0] = 0; // if no pixel input, set the first element to 0
282  if(stripInput->size() == 6) (*FPGAStripOutput)[0] = 0; // if no strip input, set the first element to 0
283 
284 
285  // calculate the time for the kernel execution
286  // get the time of writing pixel input buffer
287  cl_ulong pixel_input_time = evt_write_pixel_input.getProfilingInfo<CL_PROFILING_COMMAND_END>() - evt_write_pixel_input.getProfilingInfo<CL_PROFILING_COMMAND_START>();
288  m_pixelInputTime += pixel_input_time;
289  ATH_MSG_DEBUG("Pixel input buffer write time: " << pixel_input_time / 1e6 << " ms");
290 
291  // get the time of writing strip input buffer
292  cl_ulong strip_input_time = evt_write_strip_input.getProfilingInfo<CL_PROFILING_COMMAND_END>() - evt_write_strip_input.getProfilingInfo<CL_PROFILING_COMMAND_START>();
293  m_stripInputTime += strip_input_time;
294  ATH_MSG_DEBUG("Strip input buffer write time: " << strip_input_time / 1e6 << " ms");
295 
296  // get the time of pixel clustering
297  cl_ulong pixel_clustering_time = evt_pixel_clustering.getProfilingInfo<CL_PROFILING_COMMAND_END>() - evt_pixel_clustering.getProfilingInfo<CL_PROFILING_COMMAND_START>();
298  m_pixelClusteringTime += pixel_clustering_time;
299  ATH_MSG_DEBUG("Pixel clustering time: " << pixel_clustering_time / 1e6 << " ms");
300 
301  // get the time of strip clustering
302  cl_ulong strip_clustering_time = evt_strip_clustering.getProfilingInfo<CL_PROFILING_COMMAND_END>() - evt_strip_clustering.getProfilingInfo<CL_PROFILING_COMMAND_START>();
303  m_stripClusteringTime += strip_clustering_time;
304  ATH_MSG_DEBUG("Strip clustering time: " << strip_clustering_time / 1e6 << " ms");
305 
306  if (!m_doF110) {
307  // get the time of pixel L2G
308  cl_ulong pixel_l2g_time = evt_pixel_l2g.getProfilingInfo<CL_PROFILING_COMMAND_END>() - evt_pixel_l2g.getProfilingInfo<CL_PROFILING_COMMAND_START>();
309  m_pixelL2GTime += pixel_l2g_time;
310  ATH_MSG_DEBUG("Pixel L2G time: " << pixel_l2g_time / 1e6 << " ms");
311  }
312 
313  // get the time of strip L2G
314  cl_ulong strip_l2g_time = evt_strip_l2g.getProfilingInfo<CL_PROFILING_COMMAND_END>() - evt_strip_l2g.getProfilingInfo<CL_PROFILING_COMMAND_START>();
315  m_stripL2GTime += strip_l2g_time;
316  ATH_MSG_DEBUG("Strip L2G time: " << strip_l2g_time / 1e6 << " ms");
317 
318  // get the time of EDMPrep
319  if (m_doF110) {
320  cl_ulong pixel_edm_prep_time = evt_pixel_edm_prep.getProfilingInfo<CL_PROFILING_COMMAND_END>() - evt_pixel_edm_prep.getProfilingInfo<CL_PROFILING_COMMAND_START>();
321  cl_ulong strip_edm_prep_time = evt_strip_edm_prep.getProfilingInfo<CL_PROFILING_COMMAND_END>() - evt_strip_edm_prep.getProfilingInfo<CL_PROFILING_COMMAND_START>();
322 
323  m_pixelEdmPrepTime += pixel_edm_prep_time;
324  ATH_MSG_DEBUG("PixelEDMPrep time: " << pixel_edm_prep_time / 1e6 << " ms");
325 
326  m_stripEdmPrepTime += strip_edm_prep_time;
327  ATH_MSG_DEBUG("StripEDMPrep time: " << strip_edm_prep_time / 1e6 << " ms");
328  }
329  else {
330  cl_ulong edm_prep_time = evt_edm_prep.getProfilingInfo<CL_PROFILING_COMMAND_END>() - evt_edm_prep.getProfilingInfo<CL_PROFILING_COMMAND_START>();
331 
332  m_edmPrepTime += edm_prep_time;
333  ATH_MSG_DEBUG("EDMPrep time: " << edm_prep_time / 1e6 << " ms");
334  }
335 
336  // get the time of the whole kernel execution
337  cl_ulong kernel_start = evt_pixel_clustering.getProfilingInfo<CL_PROFILING_COMMAND_QUEUED>();
338  cl_ulong kernel_end = m_doF110 ?
339  std::max(evt_pixel_edm_prep.getProfilingInfo<CL_PROFILING_COMMAND_END>(), evt_strip_edm_prep.getProfilingInfo<CL_PROFILING_COMMAND_END>()) :
340  evt_edm_prep.getProfilingInfo<CL_PROFILING_COMMAND_END>();
341  m_kernelTime += (kernel_end - kernel_start);
342  ATH_MSG_DEBUG("Kernel execution time: " << (kernel_end - kernel_start) / 1e6 << " ms");
343 
344  // get the time of reading pixel output buffer
345  cl_ulong pixel_output_time = evt_pixel_cluster_output.getProfilingInfo<CL_PROFILING_COMMAND_END>() - evt_pixel_cluster_output.getProfilingInfo<CL_PROFILING_COMMAND_START>();
346  m_pixelOutputTime += pixel_output_time;
347  ATH_MSG_DEBUG("Pixel output buffer read time: " << pixel_output_time / 1e6 << " ms");
348 
349  // get the time of reading strip output buffer
350  cl_ulong strip_output_time = evt_strip_cluster_output.getProfilingInfo<CL_PROFILING_COMMAND_END>() - evt_strip_cluster_output.getProfilingInfo<CL_PROFILING_COMMAND_START>();
351  m_stripOutputTime += strip_output_time;
352  ATH_MSG_DEBUG("Strip output buffer read time: " << strip_output_time / 1e6 << " ms");
353 
354  return StatusCode::SUCCESS;
355  }
356 
358  {
359 
360  ATH_MSG_INFO("Finalizing F1X0IntegrationAlg");
361  ATH_MSG_INFO("Number of events: " << m_numEvents);
362 
363  if(m_numEvents > 0){
364  ATH_MSG_INFO("Pixel input ave time: " << m_pixelInputTime / m_numEvents / 1e6 << " ms");
365  ATH_MSG_INFO("Strip input ave time: " << m_stripInputTime / m_numEvents / 1e6 << " ms");
366  ATH_MSG_INFO("Pixel clustering ave time: " << m_pixelClusteringTime / m_numEvents / 1e6 << " ms");
367  ATH_MSG_INFO("Strip clustering ave time: " << m_stripClusteringTime / m_numEvents / 1e6 << " ms");
368  if (!m_doF110) {
369  ATH_MSG_INFO("Pixel L2G ave time: " << m_pixelL2GTime / m_numEvents / 1e6 << " ms");
370  }
371  ATH_MSG_INFO("Strip L2G ave time: " << m_stripL2GTime / m_numEvents / 1e6 << " ms");
372  if (!m_doF110) {
373  ATH_MSG_INFO("EDMPrep ave time: " << m_edmPrepTime / m_numEvents / 1e6 << " ms");
374  } else {
375  ATH_MSG_INFO("PixelEDMPrep ave time: " << m_pixelEdmPrepTime / m_numEvents / 1e6 << " ms");
376  ATH_MSG_INFO("StripEDMPrep ave time: " << m_stripEdmPrepTime / m_numEvents / 1e6 << " ms");
377  }
378  ATH_MSG_INFO("Kernel execution ave time: " << m_kernelTime / m_numEvents / 1e6 << " ms");
379  ATH_MSG_INFO("Pixel output ave time: " << m_pixelOutputTime / m_numEvents / 1e6 << " ms");
380  ATH_MSG_INFO("Strip output ave time: " << m_stripOutputTime / m_numEvents / 1e6 << " ms");
381  }
382 
383  return StatusCode::SUCCESS;
384  }
385 
386  void F1X0IntegrationAlg::getListofCUs(std::vector<std::string>& cuNames)
387  {
388  xrt::xclbin xrt_xclbin(m_xclbin.value());
389 
390  ATH_MSG_INFO("xsa name: "<<xrt_xclbin.get_xsa_name());
391  ATH_MSG_INFO("fpga name: "<<xrt_xclbin.get_fpga_device_name());
392  ATH_MSG_INFO("uuid: "<<xrt_xclbin.get_uuid().to_string());
393 
394  for (const xrt::xclbin::kernel &kernel : xrt_xclbin.get_kernels()) {
395  const std::string& kernelName = kernel.get_name();
396 
397  ATH_MSG_INFO("kernelName: "<<kernelName);
398 
399 
400  for (const xrt::xclbin::ip &computeUnit : kernel.get_cus()) {
401  const std::string& computeUnitName = computeUnit.get_name();
402  const std::string computeUnitIsolatedName = computeUnitName.substr(kernelName.size() + 1);
403 
404  const std::string computeUnitUsableName = kernelName + ":{" + computeUnitIsolatedName + "}";
405 
406  ATH_MSG_INFO("CU name: "<<computeUnitUsableName);
407  cuNames.push_back(computeUnitUsableName);
408  }
409  }
410  }
411 
412 } // namespace EFTrackingFPGAIntegration
EFTrackingFPGAIntegration::F1X0IntegrationAlg::m_xclbin
Gaudi::Property< std::string > m_xclbin
Path and name of the xclbin file.
Definition: F1X0IntegrationAlg.h:54
EFTrackingFPGAIntegration::F1X0IntegrationAlg::m_kernelTime
std::atomic< cl_ulong > m_kernelTime
Time for kernel execution.
Definition: F1X0IntegrationAlg.h:92
EFTrackingFPGAIntegration::F1X0IntegrationAlg::m_pixelClusterKernelName
Gaudi::Property< std::string > m_pixelClusterKernelName
Name of the pixel clustering kernel.
Definition: F1X0IntegrationAlg.h:66
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
ATH_MSG_FATAL
#define ATH_MSG_FATAL(x)
Definition: AthMsgStreamMacros.h:34
TrigDefs::Group
Group
Properties of a chain group.
Definition: GroupProperties.h:13
EFTrackingFPGAIntegration::F1X0IntegrationAlg::m_edmPixelOutputBufferList
std::vector< cl::Buffer > m_edmPixelOutputBufferList
Definition: F1X0IntegrationAlg.h:121
EFTrackingFPGAIntegration::F1X0IntegrationAlg::m_doF110
Gaudi::Property< bool > m_doF110
Boolean to run F110 instead of F100.
Definition: F1X0IntegrationAlg.h:57
EFTrackingTransient::PIXEL_CONTAINER_BUF_SIZE
constexpr unsigned long PIXEL_CONTAINER_BUF_SIZE
Definition: EFTrackingTransient.h:38
EFTrackingFPGAIntegration::F1X0IntegrationAlg::m_pixelEdmPrepTime
std::atomic< cl_ulong > m_pixelEdmPrepTime
Time for pixel EDM preparation.
Definition: F1X0IntegrationAlg.h:88
EFTrackingFPGAIntegration::F1X0IntegrationAlg::m_stripClusterKernelName
Gaudi::Property< std::string > m_stripClusterKernelName
Name of the strip clustering kernel.
Definition: F1X0IntegrationAlg.h:69
ATH_MSG_INFO
#define ATH_MSG_INFO(x)
Definition: AthMsgStreamMacros.h:31
EFTrackingFPGAIntegration::F1X0IntegrationAlg::m_stripClusterInputBufferList
std::vector< cl::Buffer > m_stripClusterInputBufferList
Definition: F1X0IntegrationAlg.h:109
xAOD::uint32_t
setEventNumber uint32_t
Definition: EventInfo_v1.cxx:127
make_unique
std::unique_ptr< T > make_unique(Args &&... args)
Definition: SkimmingToolEXOT5.cxx:23
EFTrackingFPGAIntegration::F1X0IntegrationAlg::m_pixelInputTime
std::atomic< cl_ulong > m_pixelInputTime
Time for pixel input buffer write.
Definition: F1X0IntegrationAlg.h:81
max
constexpr double max()
Definition: ap_fixedTest.cxx:33
EFTrackingFPGAIntegration::F1X0IntegrationAlg::finalize
virtual StatusCode finalize() override final
Definition: F1X0IntegrationAlg.cxx:357
EFTrackingFPGAIntegration::F1X0IntegrationAlg::execute
virtual StatusCode execute(const EventContext &ctx) const override final
Should be overriden by derived classes to perform meaningful work.
Definition: F1X0IntegrationAlg.cxx:129
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::F1X0IntegrationAlg::m_acc_queues
std::vector< cl::CommandQueue > m_acc_queues
Definition: F1X0IntegrationAlg.h:125
EFTrackingFPGAIntegration::F1X0IntegrationAlg::m_pixelL2GEDMOutputBufferList
std::vector< cl::Buffer > m_pixelL2GEDMOutputBufferList
Definition: F1X0IntegrationAlg.h:118
EFTrackingFPGAIntegration::F1X0IntegrationAlg::getListofCUs
void getListofCUs(std::vector< std::string > &cuNames)
Definition: F1X0IntegrationAlg.cxx:386
Chrono.h
Exception-safe IChronoSvc caller.
EFTrackingFPGAIntegration::F1X0IntegrationAlg::m_pixelL2GOutputBufferList
std::vector< cl::Buffer > m_pixelL2GOutputBufferList
Definition: F1X0IntegrationAlg.h:116
EFTrackingFPGAIntegration::F1X0IntegrationAlg::m_stripL2GEDMOutputBufferList
std::vector< cl::Buffer > m_stripL2GEDMOutputBufferList
Definition: F1X0IntegrationAlg.h:119
EFTrackingFPGAIntegration::F1X0IntegrationAlg::m_stripL2GKernelName
Gaudi::Property< std::string > m_stripL2GKernelName
Name of the strip L2G kernelS.
Definition: F1X0IntegrationAlg.h:75
EFTrackingFPGAIntegration::F1X0IntegrationAlg::m_pixelClusterOutputBufferList
std::vector< cl::Buffer > m_pixelClusterOutputBufferList
Definition: F1X0IntegrationAlg.h:111
EFTrackingTransient::PIXEL_BLOCK_BUF_SIZE
constexpr unsigned long PIXEL_BLOCK_BUF_SIZE
Definition: EFTrackingTransient.h:36
EFTrackingFPGAIntegration::F1X0IntegrationAlg::m_stripEdmPrepTime
std::atomic< cl_ulong > m_stripEdmPrepTime
Time for strip EDM preparation.
Definition: F1X0IntegrationAlg.h:89
EFTrackingFPGAIntegration::F1X0IntegrationAlg::m_stripL2GTime
std::atomic< cl_ulong > m_stripL2GTime
Time for strip L2G.
Definition: F1X0IntegrationAlg.h:86
EFTrackingTransient::STRIP_CONTAINER_BUF_SIZE
constexpr unsigned long STRIP_CONTAINER_BUF_SIZE
Definition: EFTrackingTransient.h:39
Athena::Chrono
Exception-safe IChronoSvc caller.
Definition: Chrono.h:50
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
EFTrackingFPGAIntegration::F1X0IntegrationAlg::m_stripClusterEDMOutputBufferList
std::vector< cl::Buffer > m_stripClusterEDMOutputBufferList
Definition: F1X0IntegrationAlg.h:114
EFTrackingTransient::PIXEL_CONTAINER_INPUT_BUF_SIZE
constexpr unsigned long PIXEL_CONTAINER_INPUT_BUF_SIZE
Definition: EFTrackingTransient.h:47
EFTrackingFPGAIntegration::F1X0IntegrationAlg::m_stripL2GOutputBufferList
std::vector< cl::Buffer > m_stripL2GOutputBufferList
Definition: F1X0IntegrationAlg.h:117
find_tgc_unfilled_channelids.ip
ip
Definition: find_tgc_unfilled_channelids.py:3
xAOD::uint64_t
uint64_t
Definition: EventInfo_v1.cxx:123
ATH_CHECK
#define ATH_CHECK
Definition: AthCheckMacros.h:40
EFTrackingFPGAIntegration::F1X0IntegrationAlg::m_FPGAPixelOutput
SG::WriteHandleKey< std::vector< uint64_t > > m_FPGAPixelOutput
Definition: F1X0IntegrationAlg.h:49
EFTrackingFPGAIntegration::F1X0IntegrationAlg::m_pixelEdmKernelName
Gaudi::Property< std::string > m_pixelEdmKernelName
Name of the FPGA kernel.
Definition: F1X0IntegrationAlg.h:60
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::F1X0IntegrationAlg::m_pixelClusterEDMOutputBufferList
std::vector< cl::Buffer > m_pixelClusterEDMOutputBufferList
Definition: F1X0IntegrationAlg.h:113
EFTrackingFPGAIntegration::F1X0IntegrationAlg::m_FPGAPixelRDO
SG::ReadHandleKey< std::vector< uint64_t > > m_FPGAPixelRDO
Definition: F1X0IntegrationAlg.h:46
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:48
EFTrackingFPGAIntegration::F1X0IntegrationAlg::m_stripInputTime
std::atomic< cl_ulong > m_stripInputTime
Time for strip input buffer write.
Definition: F1X0IntegrationAlg.h:82
EFTrackingFPGAIntegration::F1X0IntegrationAlg::m_stripClusteringTime
std::atomic< cl_ulong > m_stripClusteringTime
Time for strip clustering.
Definition: F1X0IntegrationAlg.h:84
EFTrackingFPGAIntegration::F1X0IntegrationAlg::m_pixelL2GTime
std::atomic< cl_ulong > m_pixelL2GTime
Time for pixel L2G.
Definition: F1X0IntegrationAlg.h:85
EFTrackingFPGAIntegration::F1X0IntegrationAlg::m_edmPrepTime
std::atomic< cl_ulong > m_edmPrepTime
Time for EDM preparation.
Definition: F1X0IntegrationAlg.h:87
EFTrackingFPGAIntegration::F1X0IntegrationAlg::m_pixelClusterInputBufferList
std::vector< cl::Buffer > m_pixelClusterInputBufferList
Definition: F1X0IntegrationAlg.h:108
EFTrackingTransient::STRIP_BLOCK_BUF_SIZE
constexpr unsigned long STRIP_BLOCK_BUF_SIZE
Definition: EFTrackingTransient.h:37
SG::WriteHandle
Definition: StoreGate/StoreGate/WriteHandle.h:73
EFTrackingFPGAIntegration::F1X0IntegrationAlg::m_monTool
ToolHandle< GenericMonitoringTool > m_monTool
Definition: F1X0IntegrationAlg.h:78
EFTrackingFPGAIntegration::F1X0IntegrationAlg::m_stripEdmKernelName
Gaudi::Property< std::string > m_stripEdmKernelName
Name of the FPGA kernel.
Definition: F1X0IntegrationAlg.h:63
SG::WriteHandle::record
StatusCode record(std::unique_ptr< T > data)
Record a const object to the store.
EFTrackingFPGAIntegration::F1X0IntegrationAlg::m_FPGAThreads
Gaudi::Property< int > m_FPGAThreads
Definition: F1X0IntegrationAlg.h:52
EFTrackingFPGAIntegration::F1X0IntegrationAlg::m_pixelL2GKernelName
Gaudi::Property< std::string > m_pixelL2GKernelName
Name of the pixel L2G kernel.
Definition: F1X0IntegrationAlg.h:72
EFTrackingFPGAIntegration::F1X0IntegrationAlg::m_pixelOutputTime
std::atomic< cl_ulong > m_pixelOutputTime
Time for pixel output buffer read.
Definition: F1X0IntegrationAlg.h:90
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::F1X0IntegrationAlg::m_chronoSvc
ServiceHandle< IChronoSvc > m_chronoSvc
Service for timing the algorithm.
Definition: F1X0IntegrationAlg.h:44
SlotSpecificObj.h
Maintain a set of objects, one per slot.
EFTrackingFPGAIntegration::F1X0IntegrationAlg::m_FPGAStripOutput
SG::WriteHandleKey< std::vector< uint64_t > > m_FPGAStripOutput
Definition: F1X0IntegrationAlg.h:50
EFTrackingFPGAIntegration::F1X0IntegrationAlg::m_FPGAStripRDO
SG::ReadHandleKey< std::vector< uint64_t > > m_FPGAStripRDO
Definition: F1X0IntegrationAlg.h:47
EFTrackingFPGAIntegration::F1X0IntegrationAlg::m_numEvents
std::atomic< ulonglong > m_numEvents
Number of events processed.
Definition: F1X0IntegrationAlg.h:80
EFTrackingFPGAIntegration::F1X0IntegrationAlg::m_stripOutputTime
std::atomic< cl_ulong > m_stripOutputTime
Time for strip output buffer read.
Definition: F1X0IntegrationAlg.h:91
EFTrackingFPGAIntegration::F1X0IntegrationAlg::m_edmStripOutputBufferList
std::vector< cl::Buffer > m_edmStripOutputBufferList
Definition: F1X0IntegrationAlg.h:122
F1X0IntegrationAlg.h
IntegrationBase::m_program
cl::Program m_program
Program object containing the kernel.
Definition: IntegrationBase.h:68
EFTrackingFPGAIntegration::F1X0IntegrationAlg::m_stripClusterOutputBufferList
std::vector< cl::Buffer > m_stripClusterOutputBufferList
Definition: F1X0IntegrationAlg.h:112
Monitored::Timer
A monitored timer.
Definition: MonitoredTimer.h:32
EFTrackingFPGAIntegration::F1X0IntegrationAlg::m_pixelClusteringTime
std::atomic< cl_ulong > m_pixelClusteringTime
Time for pixel clustering.
Definition: F1X0IntegrationAlg.h:83
EFTrackingFPGAIntegration::F1X0IntegrationAlg::initialize
virtual StatusCode initialize() override final
Detect the OpenCL devices and prepare OpenCL context.
Definition: F1X0IntegrationAlg.cxx:15