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 AthCUDAServices.AthCUDAServicesConfig import \
23 HostMemoryResourceToolCfg, DeviceMemoryResourceToolCfg
24
25# System import(s).
26import sys
27
29 '''Configure the example algorithm for running on a CUDA device.
30 '''
31 # Create an accumulator to hold the configuration.
32 result = ComponentAccumulator()
33 # Create the example algorithm.
34 alg = CompFactory.AthCUDAExamples.TrackParticleCalibratorExampleAlg(**kwargs)
35 hostMR = HostMemoryResourceToolCfg(flags, **kwargs)
36 alg.HostMR = hostMR.getPrimary()
37 result.merge(hostMR)
38 deviceMR = DeviceMemoryResourceToolCfg(flags, **kwargs)
39 alg.DeviceMR = deviceMR.getPrimary()
40 result.merge(deviceMR)
41 # Add the algorithm to the accumulator, so that it would eventually be
42 # scheduled to run.
43 result.addEventAlgo(alg)
44 # Return the result to the caller.
45 return result
46
47if __name__ == '__main__':
48
49 # Set up the job's flags.
50 flags = initConfigFlags()
51 flags.Exec.MaxEvents = 100
52 flags.Input.Files = defaultTestFiles.AOD_RUN3_DATA
53 flags.fillFromArgs()
54 flags.lock()
55
56 # Set up the main services.
57 acc = MainServicesCfg(flags)
58
59 # Set up the input file reading.
60 acc.merge(PoolReadCfg(flags))
61
62 # Set up the example algorithm.
63 acc.merge(TrackParticleCalibratorExampleAlgCfg(flags, OutputLevel = DEBUG))
64
65 # Run the configuration.
66 sys.exit(acc.run().isFailure())