ATLAS Offline Software
Loading...
Searching...
No Matches
TracccTritonBootstrap Namespace Reference

Functions

dict bootstrap (int nSlots=1, str sequenceName=DEFAULT_SEQUENCE_NAME)

Detailed Description

Entry point the embedded Athena application uses to configure itself.

Function Documentation

◆ bootstrap()

dict bootstrap ( int nSlots = 1,
str sequenceName = DEFAULT_SEQUENCE_NAME )
Configure and initialize the embedded Athena application.

Raises on failure.

@param nSlots number of event-store slots to create, one per Triton model instance
@param sequenceName name of the AthSequencer holding the device chain; the
       C++ TracccTritonRunner looks this up and executes it per request
@return the StoreGate keys the C++ side needs, as configured above.
        TracccTritonInitializer copies these into its Config, so the names
        live only in TracccTritonBackendConfig and cannot drift.

Definition at line 19 of file TracccTritonBootstrap.py.

20 sequenceName: str = DEFAULT_SEQUENCE_NAME) -> dict:
21 """Configure and initialize the embedded Athena application.
22
23 Raises on failure.
24
25 @param nSlots number of event-store slots to create, one per Triton model instance
26 @param sequenceName name of the AthSequencer holding the device chain; the
27 C++ TracccTritonRunner looks this up and executes it per request
28 @return the StoreGate keys the C++ side needs, as configured above.
29 TracccTritonInitializer copies these into its Config, so the names
30 live only in TracccTritonBackendConfig and cannot drift.
31 """
32
33 if nSlots < 1:
34 raise ValueError(
35 f"TracccTritonBootstrap.bootstrap: nSlots must be >= 1, got {nSlots}"
36 )
37
38 flags = initConfigFlags()
39
40 # GPU device chain.
41 flags.Device.Backend = DeviceBackend.CUDA
42 flags.Acts.Device.doClusterization = True
43 flags.Acts.Device.doSpacePointFormation = True
44 flags.Acts.Device.doSeeding = True
45 flags.Acts.Device.doTrackReconstruction = True
46 flags.CUDA.Stream = CUDAStream.PerEvent
47
48 # The device detector description is converted from the ACTS Gen3 tracking geometry
49 flags.Acts.TrackingGeometry.UseBlueprint = True
50 flags.Acts.TrackingGeometry.BuildDetrayGeometry = True
51
52 # No input / no event loop needed; the Runner drives the algorithms directly
53 flags.Input.Files = []
54 flags.Exec.MaxEvents = 0
55
56 flags.Input.isMC = True
57 flags.GeoModel.AtlasVersion = "ATLAS-P2-RUN4-03-00-01"
58 flags.IOVDb.GlobalTag = "COND-MC21-SDR-RUN4-06"
59
60 # The same detector as the client's job is needed for conversions
61 from InDetConfig.ConfigurationHelpers import OnlyTrackingPreInclude
62 OnlyTrackingPreInclude(flags)
63 flags.Detector.EnableHGTD = False
64
65 # Flag overrides from the tritonserver environment, e.g.
66 # TRACCC_TRITON_FLAGS="Acts.Device.seedingStrategy=SeedingStrategy.Gbts"
67 for flag in os.environ.get("TRACCC_TRITON_FLAGS", "").split(";"):
68 if flag.strip():
69 flags.fillFromString(flag)
70
71 flags.lock()
72
73 acc = MainServicesCfg(flags)
74
75 # One event-store slot per Triton model instance.
76 acc.addService(
77 CompFactory.SG.HiveMgrSvc("EventDataSvc", NSlots=nSlots), create=True
78 )
79
80 from TracccTritonBackend.TracccTritonBackendConfig import (
81 TracccTritonDeviceRecoCfg,
82 )
83 acc.merge(TracccTritonDeviceRecoCfg(flags, sequenceName=sequenceName))
84
85 # SG::getNSlots() caches the number of event slots the first time it is
86 # called, and gives 1 if EventDataSvc cannot be retrieved yet. With
87 # MetaDataSvc as a proxy provider, the first StoreGateSvc (initialized by
88 # GeoModelSvc) creates MetaDataSvc -> OutputStreamSequencerSvc, which asks
89 # before EventDataSvc exists; PerEventStreamSvc then has streams for one
90 # slot only. There is no input file, so no input metadata to provide.
91 pps = acc.getService("ProxyProviderSvc")
92 pps.ProviderNames = [name for name in pps.ProviderNames
93 if "MetaDataSvc" not in name]
94 # MetaDataSvc also created AthenaPoolCnvSvc at initialization. Created
95 # lazily instead, it is created while IOVDbSvc holds the database lock and
96 # registers with IncidentSvc, while another slot's clearStore() holds the
97 # IncidentSvc lock waiting for the database lock: deadlock.
98 acc.addService(acc.getService("AthenaPoolCnvSvc"), create=True)
99
100 # Equivalent to ComponentAccumulator.run() without the the event loop
101 app = acc.createApp()
102 sc = app.initialize()
103 if not sc.isSuccess():
104 raise RuntimeError(
105 "TracccTritonBootstrap.bootstrap: ApplicationMgr.initialize() failed"
106 )
107
108 sc = app.start()
109 if not sc.isSuccess():
110 raise RuntimeError(
111 "TracccTritonBootstrap.bootstrap: ApplicationMgr.start() failed"
112 )
113
114 return dict(STOREGATE_KEYS)
std::vector< std::string > split(const std::string &s, const std::string &t=":")
Definition hcg.cxx:179