Skip to content
Snippets Groups Projects

Enable gaudi multithreading and concurrency

Open Wouter Deconinck requested to merge gaudi-multithreading into master
+ 45
5
from Gaudi.Configuration import *
from Configurables import ApplicationMgr, AuditorSvc, EICDataSvc, PodioOutput, GeoSvc
from Configurables import HiveWhiteBoard, HiveSlimEventLoopMgr, AvalancheSchedulerSvc
from Configurables import GaudiSequencer, SequencerTimerTool, ApplicationMgr
from Configurables import AuditorSvc, EICDataSvc, PodioOutput, GeoSvc
from GaudiKernel import SystemOfUnits as units
from GaudiKernel.SystemOfUnits import MeV, GeV, mm, cm, mrad
import json
from math import sqrt
# Detector names, paths, configuration
detector_name = "athena"
if "JUGGLER_DETECTOR_CONFIG" in os.environ :
detector_name = str(os.environ["JUGGLER_DETECTOR_CONFIG"])
@@ -108,7 +110,33 @@ else:
materials="calibrations/materials-map.cbor",
OutputLevel=WARNING))
# data service
services.append(EICDataSvc("EventDataSvc", inputs=input_sims, OutputLevel=WARNING))
services.append(EICDataSvc("EICDataSvc", inputs=input_sims, OutputLevel=WARNING))
# Multithreading
# - threads: total number of threads to use: this determines how many events and
# algorithms can be in flight (run in parallel)
# - evtslots: number of events that may run in parallel, each with its own EventStore
threads = 1
evtslots = 1
if "JUGGLER_N_THREADS" in os.environ:
threads = int(os.environ["JUGGLER_N_THREADS"])
evtslots = int(os.environ["JUGGLER_N_THREADS"])
if "JUGGLER_N_SLOTS" in os.environ:
evtslots = int(os.environ["JUGGLER_N_SLOTS"])
whiteboard = HiveWhiteBoard(
"EventDataSvc",
EventSlots = evtslots
)
slimeventloopmgr = HiveSlimEventLoopMgr(
SchedulerName = "AvalancheSchedulerSvc",
OutputLevel = WARNING
)
scheduler = AvalancheSchedulerSvc(
ThreadPoolSize = threads,
OutputLevel = WARNING
)
services.append(whiteboard)
# juggler components
from Configurables import PodioInput
@@ -990,11 +1018,23 @@ podout.outputCommands = [
]
algorithms.append(podout)
# Sequencer
cardinality = 1
for alg in algorithms:
alg.Cardinality = cardinality
sequencer = GaudiSequencer(
"sequencer",
Members = algorithms,
Sequential = True,
OutputLevel = WARNING)
ApplicationMgr(
TopAlg = algorithms,
TopAlg = [sequencer],
EvtSel = 'NONE',
EvtMax = n_events,
ExtSvc = services,
EventLoop = slimeventloopmgr,
MessageSvcType = "InertMessageSvc",
OutputLevel = WARNING,
AuditAlgorithms = True
)
)
Loading