ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
Control
AthenaExamples
AthExXRT
src
VectorAddXRTExampleAlg.h
Go to the documentation of this file.
1
//
2
// Copyright (C) 2002-2025 CERN for the benefit of the ATLAS collaboration
3
//
4
#ifndef ATHEXXRT_VECTORADDXRTEXAMPLEALG_H
5
#define ATHEXXRT_VECTORADDXRTEXAMPLEALG_H
6
7
// STL include(s).
8
#include <memory>
9
10
// AthXRT include(s).
11
#include "
AthXRTInterfaces/IDeviceMgmtSvc.h
"
12
#include "
AthXRTInterfaces/StateHandler.h
"
13
14
// Framework include(s).
15
#include "
AthenaBaseComps/AthReentrantAlgorithm.h
"
16
#include "
AthenaKernel/SlotSpecificObj.h
"
17
#include "GaudiKernel/ServiceHandle.h"
18
19
20
namespace
AthExXRT
{
21
30
class
VectorAddXRTExampleAlg
:
public
AthReentrantAlgorithm
,
public
AthXRT::StateHandler
{
31
32
public
:
33
// Inherit the base class's constructor(s).
34
using
AthReentrantAlgorithm::AthReentrantAlgorithm;
35
36
virtual
StatusCode
initialize
()
override
{
37
return
StateHandler::initialize();
38
}
39
40
virtual
StatusCode
initialize_global
()
override
;
41
virtual
StatusCode
initialize_worker
()
override
;
42
43
virtual
StatusCode
execute
(
const
EventContext& ctx)
const override
;
44
45
private
:
46
48
ServiceHandle<AthXRT::IDeviceMgmtSvc>
m_DeviceMgmtSvc
{
49
this
,
"DeviceMgmtSvc"
,
"AthXRT::DeviceMgmtSvc"
,
50
"The XRT device manager service to use"
};
51
52
// Kernel name string
53
static
constexpr
char
s_krnl_name
[] =
"krnl_VectorAdd"
;
54
55
// list of found accelerator devices
56
std::vector<std::shared_ptr<xrt::device>>
m_devices
;
57
58
// Kernel arguments indexes
59
// Must match the kernel arguments order.
60
static
constexpr
int
s_krnl_param_in1
= 0;
61
static
constexpr
int
s_krnl_param_in2
= 1;
62
static
constexpr
int
s_krnl_param_out
= 2;
63
static
constexpr
int
s_krnl_param_size
= 3;
64
65
// Number of uint32_t element in the vectors
66
static
constexpr
int
s_element_count
= 4096;
67
69
struct
SlotData
{
71
std::shared_ptr<xrt::device>
m_device
=
nullptr
;
72
74
std::unique_ptr<xrt::kernel>
m_kernel
=
nullptr
;
75
77
std::unique_ptr<xrt::run>
m_run
=
nullptr
;
78
80
std::unique_ptr<xrt::bo>
m_bo_in1
=
nullptr
;
81
std::unique_ptr<xrt::bo>
m_bo_in2
=
nullptr
;
82
std::unique_ptr<xrt::bo>
m_bo_out
=
nullptr
;
83
};
84
86
SG::SlotSpecificObj<SlotData>
m_slots
;
87
88
};
// class VectorAddXRTExampleAlg
89
90
}
// namespace AthExXRT
91
92
#endif
// ATHEXXRT_VECTORADDXRTEXAMPLEALG_H
AthReentrantAlgorithm.h
SlotSpecificObj.h
Maintain a set of objects, one per slot.
IDeviceMgmtSvc.h
StateHandler.h
AthExXRT::VectorAddXRTExampleAlg
Example algorithm exercising the AthXRT core services.
Definition
VectorAddXRTExampleAlg.h:30
AthExXRT::VectorAddXRTExampleAlg::s_krnl_param_in2
static constexpr int s_krnl_param_in2
Definition
VectorAddXRTExampleAlg.h:61
AthExXRT::VectorAddXRTExampleAlg::s_krnl_param_in1
static constexpr int s_krnl_param_in1
Definition
VectorAddXRTExampleAlg.h:60
AthExXRT::VectorAddXRTExampleAlg::s_element_count
static constexpr int s_element_count
Definition
VectorAddXRTExampleAlg.h:66
AthExXRT::VectorAddXRTExampleAlg::m_devices
std::vector< std::shared_ptr< xrt::device > > m_devices
Definition
VectorAddXRTExampleAlg.h:56
AthExXRT::VectorAddXRTExampleAlg::initialize_worker
virtual StatusCode initialize_worker() override
Initialization per process.
Definition
VectorAddXRTExampleAlg.cxx:28
AthExXRT::VectorAddXRTExampleAlg::initialize
virtual StatusCode initialize() override
Definition
VectorAddXRTExampleAlg.h:36
AthExXRT::VectorAddXRTExampleAlg::m_DeviceMgmtSvc
ServiceHandle< AthXRT::IDeviceMgmtSvc > m_DeviceMgmtSvc
The XRT device manager to use.
Definition
VectorAddXRTExampleAlg.h:48
AthExXRT::VectorAddXRTExampleAlg::initialize_global
virtual StatusCode initialize_global() override
Glocal XRT initialization.
Definition
VectorAddXRTExampleAlg.cxx:10
AthExXRT::VectorAddXRTExampleAlg::s_krnl_param_out
static constexpr int s_krnl_param_out
Definition
VectorAddXRTExampleAlg.h:62
AthExXRT::VectorAddXRTExampleAlg::execute
virtual StatusCode execute(const EventContext &ctx) const override
Definition
VectorAddXRTExampleAlg.cxx:87
AthExXRT::VectorAddXRTExampleAlg::s_krnl_name
static constexpr char s_krnl_name[]
Definition
VectorAddXRTExampleAlg.h:53
AthExXRT::VectorAddXRTExampleAlg::s_krnl_param_size
static constexpr int s_krnl_param_size
Definition
VectorAddXRTExampleAlg.h:63
AthExXRT::VectorAddXRTExampleAlg::m_slots
SG::SlotSpecificObj< SlotData > m_slots
List of slot-specific data.
Definition
VectorAddXRTExampleAlg.h:86
AthReentrantAlgorithm
An algorithm that can be simultaneously executed in multiple threads.
Definition
AthReentrantAlgorithm.h:74
AthXRT::StateHandler
Base class to provide common infrastructure for handling multiprocess state transitions for FPGA.
Definition
StateHandler.h:27
SG::SlotSpecificObj
Maintain a set of objects, one per slot.
Definition
AthenaKernel/AthenaKernel/SlotSpecificObj.h:84
ServiceHandle
Definition
ClusterMakerTool.h:36
AthExXRT
Definition
VectorAddOCLExampleAlg.cxx:11
AthExXRT::VectorAddXRTExampleAlg::SlotData
Slot-specific state.
Definition
VectorAddXRTExampleAlg.h:69
AthExXRT::VectorAddXRTExampleAlg::SlotData::m_bo_in2
std::unique_ptr< xrt::bo > m_bo_in2
Definition
VectorAddXRTExampleAlg.h:81
AthExXRT::VectorAddXRTExampleAlg::SlotData::m_bo_out
std::unique_ptr< xrt::bo > m_bo_out
Definition
VectorAddXRTExampleAlg.h:82
AthExXRT::VectorAddXRTExampleAlg::SlotData::m_kernel
std::unique_ptr< xrt::kernel > m_kernel
Kernel object.
Definition
VectorAddXRTExampleAlg.h:74
AthExXRT::VectorAddXRTExampleAlg::SlotData::m_run
std::unique_ptr< xrt::run > m_run
Kernel run object.
Definition
VectorAddXRTExampleAlg.h:77
AthExXRT::VectorAddXRTExampleAlg::SlotData::m_bo_in1
std::unique_ptr< xrt::bo > m_bo_in1
Buffer objects.
Definition
VectorAddXRTExampleAlg.h:80
AthExXRT::VectorAddXRTExampleAlg::SlotData::m_device
std::shared_ptr< xrt::device > m_device
Device pointer.
Definition
VectorAddXRTExampleAlg.h:71
Generated on
for ATLAS Offline Software by
1.17.0