ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
Control
AthenaExamples
AthExTriton
python
AthExTritonAsync_test.py
Go to the documentation of this file.
1
# Copyright (C) 2002-2026 CERN for the benefit of the ATLAS collaboration
2
3
from
AthenaConfiguration.ComponentAccumulator
import
ComponentAccumulator
4
from
AthenaConfiguration.ComponentFactory
import
CompFactory
5
from
AthenaCommon
import
Constants
6
7
8
def
AthExTritonCfg
(flags, name="AthExTritonExample", **kwargs):
9
acc = ComponentAccumulator()
10
11
from
AthTritonComps.TritonToolConfig
import
TritonToolCfg
12
try
:
13
kwargs.setdefault(
"InferenceTool"
, acc.popToolsAndMerge(
14
TritonToolCfg(flags,
"MNIST_testModel"
,
"localhost"
,
15
name=
"EvaluateModelTritonTool"
)
16
))
17
except
RuntimeError
as
e:
18
import
sys
19
from
AthenaCommon.Logging
import
log
as
msg
20
msg.warning(e)
21
sys.exit(2)
# indicate test is skipped, not failed
22
23
input_data =
"dev/MLTest/2020-03-31/t10k-images-idx3-ubyte"
24
kwargs.setdefault(
"BatchSize"
, 2)
25
kwargs.setdefault(
"InputDataPixel"
, input_data)
26
kwargs.setdefault(
"OutputLevel"
, Constants.DEBUG)
27
acc.addEventAlgo(
28
CompFactory.AthInfer.ExampleAsyncMLInferenceWithTriton(name, **kwargs))
29
30
return
acc
31
32
33
if
__name__ ==
"__main__"
:
34
from
AthenaCommon.Logging
import
log
as
msg
35
from
AthenaConfiguration.AllConfigFlags
import
initConfigFlags
36
from
AthenaConfiguration.MainServicesConfig
import
MainServicesCfg
37
38
msg.setLevel(Constants.DEBUG)
39
40
flags = initConfigFlags()
41
flags.Concurrency.NumOffloadThreads = 4
42
flags.Exec.FPE = -1
43
flags.lock()
44
45
acc = MainServicesCfg(flags)
46
acc.merge(
AthExTritonCfg
(flags))
47
acc.printConfig(withDetails=
True
, summariseProps=
True
)
48
49
acc.store(open(
'test_AthExTritonAsyncCfg.pkl'
,
'wb'
))
50
51
import
sys
52
sys.exit(acc.run(2).isFailure())
AthExTritonAsync_test.AthExTritonCfg
AthExTritonCfg(flags, name="AthExTritonExample", **kwargs)
Definition
AthExTritonAsync_test.py:8
Generated on
for ATLAS Offline Software by
1.17.0