ATLAS Offline Software
Loading...
Searching...
No Matches
TrackParticleCalibratorExampleConfig.py
Go to the documentation of this file.
1#!/usr/bin/env athena.py
2#
3# Copyright (C) 2002-2026 CERN for the benefit of the ATLAS collaboration
4#
5# Simple ComponentAccumulator configuration for running
6# AthCUDAExamples::TrackParticleCalibratorExampleAlg, offloading trivial
7# operations on xAOD::TrackParticleContrinaer, to a CUDA device.
8#
9
10# Core import(s).
11from AthenaConfiguration.AllConfigFlags import initConfigFlags
12from AthenaConfiguration.ComponentAccumulator import ComponentAccumulator
13from AthenaConfiguration.ComponentFactory import CompFactory
14from AthenaConfiguration.MainServicesConfig import MainServicesCfg
15from AthenaConfiguration.TestDefaults import defaultTestFiles
16from AthenaCommon.Constants import DEBUG
17
18# I/O import(s).
19from AthenaPoolCnvSvc.PoolReadConfig import PoolReadCfg
20
21# Device/Accelerator import(s).
22from AthDeviceComps.AthDeviceCompsConfig import HostCopyToolCfg
23from AthCUDAServices.AthCUDAServicesConfig import \
24 MemoryResourcesToolCfg, StreamToolCfg
25from AthCUDAServices.AthCUDAServicesConfig import AsyncCopyToolCfg as DeviceCopyToolCfg
26
27# System import(s).
28import sys
29
31 '''Configure the example algorithm for running on a CUDA device.
32 '''
33 # Create an accumulator to hold the configuration.
34 result = ComponentAccumulator()
35 # Create the example algorithm.
36 alg = CompFactory.AthCUDAExamples.TrackParticleCalibratorExampleAlg(**kwargs)
37 memoryResources = MemoryResourcesToolCfg(flags, **kwargs)
38 alg.MemoryResourcesTool = memoryResources.getPrimary()
39 result.merge(memoryResources)
40 hostCopyTool = HostCopyToolCfg(flags, **kwargs)
41 alg.HostCopyTool = hostCopyTool.getPrimary()
42 result.merge(hostCopyTool)
43 deviceCopyTool = DeviceCopyToolCfg(flags, **kwargs)
44 alg.DeviceCopyTool = deviceCopyTool.getPrimary()
45 result.merge(deviceCopyTool)
46 streamTool = StreamToolCfg(flags, **kwargs)
47 alg.StreamTool = streamTool.getPrimary()
48 result.merge(streamTool)
49
50 # Add the algorithm to the accumulator, so that it would eventually be
51 # scheduled to run.
52 result.addEventAlgo(alg)
53 # Return the result to the caller.
54 return result
55
56if __name__ == '__main__':
57
58 # Set up the job's flags.
59 flags = initConfigFlags()
60 flags.Exec.MaxEvents = 100
61 flags.Input.Files = defaultTestFiles.AOD_RUN3_DATA
62 flags.fillFromArgs()
63 flags.lock()
64
65 # Set up the main services.
66 acc = MainServicesCfg(flags)
67
68 # Set up the input file reading.
69 acc.merge(PoolReadCfg(flags))
70
71 # Set up the example algorithm.
72 acc.merge(TrackParticleCalibratorExampleAlgCfg(flags, OutputLevel = DEBUG))
73
74 # Run the configuration.
75 sys.exit(acc.run().isFailure())