ATLAS Offline Software
Loading...
Searching...
No Matches
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
7import os
8from AthenaConfiguration.ComponentAccumulator import ComponentAccumulator
9from AthenaConfiguration.ComponentFactory import CompFactory
10from AthenaCommon.Logging import logging
11from AthXRTServices.DeviceMgmtSvcConfig import DeviceMgmtSvcCfg
12log = logging.getLogger("AthExXRT.XrtKernelExampleCfg")
13
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
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
47
48 result = ComponentAccumulator()
49 result.merge(XrtKernelExampleCfg(flags))
50 result.merge(OCLKernelExampleCfg(flags))
51
52 return result
53
54if __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())