ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
Control
AthenaExamples
AthExXRT
python
KernelExampleConfig.py
Go to the documentation of this file.
1
#!/usr/bin/env athena.py
2
# Copyright (C) 2002-2025 CERN for the benefit of the ATLAS collaboration
3
#
4
# "Standalone" test for exercising AthXRT with multiple kernels (krnl_VectorAdd and krnl_VectorMult).
5
#
6
7
import
os
8
from
AthenaConfiguration.ComponentAccumulator
import
ComponentAccumulator
9
from
AthenaConfiguration.ComponentFactory
import
CompFactory
10
from
AthenaCommon.Logging
import
logging
11
from
AthXRTServices.DeviceMgmtSvcConfig
import
DeviceMgmtSvcCfg
12
log = logging.getLogger(
"AthExXRT.XrtKernelExampleCfg"
)
13
14
def
OCLKernelExampleCfg
(flags):
15
16
result = ComponentAccumulator()
17
18
xclbin_list = [os.path.join(flags.FPGAMgmt.HLSDir,
'krnl_Combined.xclbin'
)]
19
result.merge(DeviceMgmtSvcCfg(flags,
20
xclbin_list))
21
22
OCLVectorAddEx = CompFactory.AthExXRT.VectorAddOCLExampleAlg()
23
result.addEventAlgo(OCLVectorAddEx)
24
25
OCLVectorMulEx = CompFactory.AthExXRT.VectorMultOCLExampleAlg()
26
result.addEventAlgo(OCLVectorMulEx)
27
28
return
result
29
30
def
XrtKernelExampleCfg
(flags):
31
32
result = ComponentAccumulator()
33
34
xclbin_list = [os.path.join(flags.FPGAMgmt.HLSDir,
'krnl_Combined.xclbin'
)]
35
result.merge(DeviceMgmtSvcCfg(flags,
36
xclbin_list))
37
38
XRTVectorAddEx = CompFactory.AthExXRT.VectorAddXRTExampleAlg()
39
result.addEventAlgo(XRTVectorAddEx)
40
41
XRTVectorMulEx = CompFactory.AthExXRT.VectorMultXRTExampleAlg()
42
result.addEventAlgo(XRTVectorMulEx)
43
44
return
result
45
46
def
MultiKernelExampleCfg
(flags):
47
48
result = ComponentAccumulator()
49
result.merge(
XrtKernelExampleCfg
(flags))
50
result.merge(
OCLKernelExampleCfg
(flags))
51
52
return
result
53
54
if
__name__ ==
"__main__"
:
55
from
AthenaConfiguration.MainServicesConfig
import
MainServicesCfg
56
from
AthenaConfiguration.AllConfigFlags
import
initConfigFlags
57
flags = initConfigFlags()
58
flags.Exec.MaxEvents = 10
59
60
from
AthXRTServices.FPGAConfigFlags
import
createFPGAMgmtFlags
61
createFPGAMgmtFlags()
62
63
flags.addFlag(
"FPGAMgmt.doXRT"
,
True
)
64
flags.addFlag(
"FPGAMgmt.doOCL"
,
True
)
65
flags.fillFromArgs()
66
flags.lock()
67
68
cfg = MainServicesCfg(flags)
69
if
flags.FPGAMgmt.doXRT:
70
cfg.merge(
XrtKernelExampleCfg
(flags))
71
if
flags.FPGAMgmt.doOCL:
72
cfg.merge(
OCLKernelExampleCfg
(flags))
73
74
import
sys
75
sys.exit(cfg.run().isFailure())
KernelExampleConfig.XrtKernelExampleCfg
XrtKernelExampleCfg(flags)
Definition
KernelExampleConfig.py:30
KernelExampleConfig.MultiKernelExampleCfg
MultiKernelExampleCfg(flags)
Definition
KernelExampleConfig.py:46
KernelExampleConfig.OCLKernelExampleCfg
OCLKernelExampleCfg(flags)
Definition
KernelExampleConfig.py:14
Generated on
for ATLAS Offline Software by
1.17.0