ATLAS Offline Software
Loading...
Searching...
No Matches
AthCUDAServicesConfig.py
Go to the documentation of this file.
1# Copyright (C) 2002-2026 CERN for the benefit of the ATLAS collaboration
2
3# Framework import(s).
4from AthenaConfiguration.ComponentFactory import CompFactory
5from AthenaConfiguration.ComponentAccumulator import ComponentAccumulator
6
7
9 acc = ComponentAccumulator()
10 svc = CompFactory.getComp("AthCUDA::GPUSystemInfoSvc")("GPUSystemInfoSvc")
11 acc.addService(svc)
12 return acc
13
14
15def HostMemoryResourceToolCfg(flags, **kwargs):
16 '''Default CUDA host memory resource tool to use
17
18 It makes sure that appropriate caching would be used, as allocating pinned
19 host memory is relatively slow.
20 '''
21
22 # Create an accumulator to hold the configuration.
23 result = ComponentAccumulator()
24
25 # Create the components that would collaborate to provide thread-safe
26 # caching to the "bare" memory resource.
27 hostTool = CompFactory.AthCUDA.HostMemoryResourceTool(**kwargs)
28 cacheSvc = CompFactory.AthDevice.BinaryPageMemoryResourceSvc(
29 'CUDAHostCachedMemoryResourceSvc',
30 MRTool=hostTool)
31 result.addService(cacheSvc)
32 finalTool = CompFactory.AthDevice.MemoryResourceSvcAdaptorTool(
33 'CUDAHostCachedMemoryResourceTool',
34 MRSvc=cacheSvc)
35 result.setPrivateTools(finalTool)
36
37 # Return the CA.
38 return result
39
40
41def DeviceMemoryResourceToolCfg(flags, **kwargs):
42 '''Default CUDA device memory resource tool to use
43
44 It makes sure that appropriate caching would be used, as allocating device
45 memory is relatively slow.
46 '''
47
48 # Create an accumulator to hold the configuration.
49 result = ComponentAccumulator()
50
51 # Create the components that would collaborate to provide thread-safe
52 # caching to the "bare" memory resource.
53 deviceTool = CompFactory.AthCUDA.DeviceMemoryResourceTool(**kwargs)
54 cacheSvc = CompFactory.AthDevice.BinaryPageMemoryResourceSvc(
55 'CUDADeviceCachedMemoryResourceSvc',
56 MRTool=deviceTool)
57 result.addService(cacheSvc)
58 finalTool = CompFactory.AthDevice.MemoryResourceSvcAdaptorTool(
59 'CUDADeviceCachedMemoryResourceTool',
60 MRSvc=cacheSvc)
61 result.setPrivateTools(finalTool)
62
63 # Return the CA.
64 return result
65
66
67def ManagedMemoryResourceToolCfg(flags, **kwargs):
68 '''Default CUDA managed memory resource tool to use
69
70 It makes sure that appropriate caching would be used, as allocating managed
71 memory is relatively slow.
72 '''
73
74 # Create an accumulator to hold the configuration.
75 result = ComponentAccumulator()
76
77 # Create the components that would collaborate to provide thread-safe
78 # caching to the "bare" memory resource.
79 managedTool = CompFactory.AthCUDA.ManagedMemoryResourceTool(**kwargs)
80 cacheSvc = CompFactory.AthDevice.BinaryPageMemoryResourceSvc(
81 'CUDAManagedCachedMemoryResourceSvc',
82 MRTool=managedTool)
83 result.addService(cacheSvc)
84 finalTool = CompFactory.AthDevice.MemoryResourceSvcAdaptorTool(
85 'CUDAManagedCachedMemoryResourceTool',
86 MRSvc=cacheSvc)
87 result.setPrivateTools(finalTool)
88
89 # Return the CA.
90 return result
DeviceMemoryResourceToolCfg(flags, **kwargs)
ManagedMemoryResourceToolCfg(flags, **kwargs)
HostMemoryResourceToolCfg(flags, **kwargs)