ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
Control
AthDevice
AthDeviceComps
python
AthDeviceCompsConfig.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).
4
from
AthenaConfiguration.ComponentFactory
import
CompFactory
5
from
AthenaConfiguration.ComponentAccumulator
import
ComponentAccumulator
6
7
# Local import(s).
8
from
AthDeviceComps.DeviceConfigFlags
import
DeviceBackend
9
10
11
def
HostCopyToolCfg
(flags, **kwargs):
12
'''Default "host side" copy object provider tool
13
'''
14
15
# Create an accumulator to hold the configuration.
16
result = ComponentAccumulator()
17
18
# Create the tool in a simple way.
19
result.setPrivateTools(CompFactory.AthDevice.HostCopyTool(**kwargs))
20
21
# Return the CA.
22
return
result
23
24
25
def
HostMemoryResourceToolCfg
(flags, **kwargs):
26
'''Default "host side" memory resource provider tool
27
'''
28
29
# Create an accumulator to hold the configuration.
30
result = ComponentAccumulator()
31
32
# Make a decision based on the selected backend.
33
if
flags.Device.Backend == DeviceBackend.CUDA:
34
from
AthCUDAServices.AthCUDAServicesConfig \
35
import
HostMemoryResourceToolCfg
as
CUDAHostMemoryResourceToolCfg
36
result.setPrivateTools(result.popToolsAndMerge(
37
CUDAHostMemoryResourceToolCfg(flags, **kwargs)))
38
else
:
39
# For an unknown backend, we just fall back on the generic host memory
40
# resource tool.
41
result.setPrivateTools(
42
CompFactory.AthDevice.HostMemoryResourceTool(**kwargs))
43
pass
44
45
# Return the CA.
46
return
result
47
48
49
def
DeviceMemoryResourceToolCfg
(flags, **kwargs):
50
'''Default "device side" memory resource provider tool
51
'''
52
53
# Create an accumulator to hold the configuration.
54
result = ComponentAccumulator()
55
56
# Make a decision based on the selected backend.
57
if
flags.Device.Backend == DeviceBackend.CUDA:
58
from
AthCUDAServices.AthCUDAServicesConfig \
59
import
DeviceMemoryResourceToolCfg
as
\
60
CUDADeviceMemoryResourceToolCfg
61
result.setPrivateTools(result.popToolsAndMerge(
62
CUDADeviceMemoryResourceToolCfg(flags, **kwargs)))
63
else
:
64
raise
RuntimeError(
'No device memory resource tool is available for '
65
'the selected backend: {}'
.format(
66
flags.Device.Backend))
67
68
# Return the CA.
69
return
result
70
71
72
def
SharedMemoryResourceToolCfg
(flags, **kwargs):
73
'''Default "host/device shared" memory resource provider tool
74
'''
75
76
# Create an accumulator to hold the configuration.
77
result = ComponentAccumulator()
78
79
# Make a decision based on the selected backend.
80
if
flags.Device.Backend == DeviceBackend.CUDA:
81
from
AthCUDAServices.AthCUDAServicesConfig \
82
import
ManagedMemoryResourceToolCfg
as
\
83
CUDAManagedMemoryResourceToolCfg
84
result.setPrivateTools(result.popToolsAndMerge(
85
CUDAManagedMemoryResourceToolCfg(flags, **kwargs)))
86
else
:
87
raise
RuntimeError(
'No shared memory resource tool is available for '
88
'the selected backend: {}'
.format(
89
flags.Device.Backend))
90
91
# Return the CA.
92
return
result
93
94
95
def
MemoryResourcesToolCfg
(flags, **kwargs):
96
'''Default tool providing the IMemoryResourcesTool interface for the
97
selected backend
98
'''
99
100
# Create an accumulator to hold the configuration.
101
result = ComponentAccumulator()
102
103
# Make a decision based on the selected backend.
104
if
flags.Device.Backend == DeviceBackend.CUDA:
105
from
AthCUDAServices.AthCUDAServicesConfig \
106
import
MemoryResourcesToolCfg
as
CUDAMemoryResourcesToolCfg
107
result.setPrivateTools(result.popToolsAndMerge(
108
CUDAMemoryResourcesToolCfg(flags, **kwargs)))
109
else
:
110
raise
RuntimeError(
'No memory resources tool is available for the '
111
'selected backend: {}'
.format(flags.Device.Backend))
112
113
# Return the CA.
114
return
result
115
116
117
def
CopyToolCfg
(flags, **kwargs):
118
'''Default tool providing the ICopyTool interface for the selected backend
119
'''
120
121
# Create an accumulator to hold the configuration.
122
result = ComponentAccumulator()
123
124
# Make a decision based on the selected backend.
125
if
flags.Device.Backend == DeviceBackend.CUDA:
126
from
AthCUDAServices.AthCUDAServicesConfig \
127
import
CopyToolCfg
as
CUDACopyToolCfg
128
result.setPrivateTools(result.popToolsAndMerge(
129
CUDACopyToolCfg(flags, **kwargs)))
130
else
:
131
raise
RuntimeError(
'No copy tool is available for the selected '
132
'backend: {}'
.format(flags.Device.Backend))
133
134
# Return the CA.
135
return
result
136
137
138
def
CopiesToolCfg
(flags, **kwargs):
139
'''Default tool providing the ICopiesTool interface for the selected backend
140
'''
141
142
# Create an accumulator to hold the configuration.
143
result = ComponentAccumulator()
144
145
# Make a decision based on the selected backend.
146
if
flags.Device.Backend == DeviceBackend.CUDA:
147
from
AthCUDAServices.AthCUDAServicesConfig \
148
import
CopiesToolCfg
as
CUDACopiesToolCfg
149
result.setPrivateTools(result.popToolsAndMerge(
150
CUDACopiesToolCfg(flags, **kwargs)))
151
else
:
152
raise
RuntimeError(
'No copies tool is available for the selected '
153
'backend: {}'
.format(flags.Device.Backend))
154
155
# Return the CA.
156
return
result
python.AthDeviceCompsConfig.MemoryResourcesToolCfg
MemoryResourcesToolCfg(flags, **kwargs)
Definition
AthDeviceCompsConfig.py:95
python.AthDeviceCompsConfig.CopyToolCfg
CopyToolCfg(flags, **kwargs)
Definition
AthDeviceCompsConfig.py:117
python.AthDeviceCompsConfig.CopiesToolCfg
CopiesToolCfg(flags, **kwargs)
Definition
AthDeviceCompsConfig.py:138
python.AthDeviceCompsConfig.HostCopyToolCfg
HostCopyToolCfg(flags, **kwargs)
Definition
AthDeviceCompsConfig.py:11
python.AthDeviceCompsConfig.HostMemoryResourceToolCfg
HostMemoryResourceToolCfg(flags, **kwargs)
Definition
AthDeviceCompsConfig.py:25
python.AthDeviceCompsConfig.DeviceMemoryResourceToolCfg
DeviceMemoryResourceToolCfg(flags, **kwargs)
Definition
AthDeviceCompsConfig.py:49
python.AthDeviceCompsConfig.SharedMemoryResourceToolCfg
SharedMemoryResourceToolCfg(flags, **kwargs)
Definition
AthDeviceCompsConfig.py:72
Generated on
for ATLAS Offline Software by
1.17.0