11 def __init__(self, name='AthMpEvtLoopMgr', isPileup=False, **kw):
13 from AthenaCommon.AppMgr
import theApp
18 super(MpEvtLoopMgr, self).
__init__(**kw)
20 os.putenv(
'XRD_ENABLEFORKHANDLERS',
'1')
21 os.putenv(
'XRD_RUNFORKHANDLER',
'1')
23 from .AthenaMPFlags
import jobproperties
as jp
36 from AthenaCommon.AppMgr
import theApp
as app
37 app.EventLoop = self.getFullJobOptName()
40 from GaudiSvc.GaudiSvcConf
import FileMgr
41 from AthenaCommon.AppMgr
import ServiceMgr
as svcMgr
42 svcMgr+=FileMgr(LogFile=
"FileManagerLog")
45 if os.path.isfile(
'PoolFileCatalog.xml'):
46 shutil.copyfile(
'PoolFileCatalog.xml',
'PoolFileCatalog.xml.AthenaMP-saved')
51 from .AthenaMPFlags
import jobproperties
as jp
52 import AthenaCommon.ConcurrencyFlags
53 event_range_channel = jp.AthenaMPFlags.EventRangeChannel()
57 msg.warning(
'Nonpositive ChunkSize (%i) caught, setting it to 1', chunk_size)
60 debug_worker = jp.ConcurrencyFlags.DebugWorkers()
61 use_shared_reader = jp.AthenaMPFlags.UseSharedReader()
62 use_shared_writer = jp.AthenaMPFlags.UseSharedWriter()
63 use_parallel_compression = jp.AthenaMPFlags.UseParallelCompression()
64 unique_id = f
"{str(os.getpid())}-{uuid.uuid4().hex}"
67 if strategy ==
'SharedQueue':
68 from AthenaCommon.AthenaCommonFlags
import jobproperties
as ajp
69 if (
not ajp.AthenaCommonFlags.FilesInput.statusOn)
or ajp.AthenaCommonFlags.FilesInput == []:
70 msg.info(
'MP strategy "SharedQueue" will not work without input files when maxEvents=-1. Switching to "RoundRobin" just in case')
71 strategy =
'RoundRobin'
73 if strategy==
'SharedQueue' or strategy==
'RoundRobin':
75 from AthenaCommon.AppMgr
import ServiceMgr
as svcMgr
77 svcMgr.PoolSvc.MaxFilesOpen = 0
79 from AthenaCommon.AppMgr
import ServiceMgr
as svcMgr
80 if 'AthenaPoolCnvSvc.WriteAthenaPool' in sys.modules:
81 from AthenaIPCTools.AthenaIPCToolsConf
import AthenaSharedMemoryTool
82 svcMgr.AthenaPoolCnvSvc.OutputStreamingTool =
AthenaSharedMemoryTool(
"OutputStreamingTool", SharedMemoryName=f
"OutputStream{unique_id}")
83 svcMgr.AthenaPoolCnvSvc.ParallelCompression=use_parallel_compression
85 if strategy==
'SharedQueue':
86 from AthenaMPTools.AthenaMPToolsConf
import SharedEvtQueueProvider
89 EventsBeforeFork=events_before_fork,
90 ChunkSize=chunk_size) ]
95 raise Exception(
'Running pileup digitization in mixed MP+MT currently not supported')
96 from AthenaMPTools.AthenaMPToolsConf
import SharedHiveEvtQueueConsumer
98 EventsBeforeFork=events_before_fork,
101 from AthenaMPTools.AthenaMPToolsConf
import SharedEvtQueueConsumer
103 UseSharedWriter=use_shared_writer,
105 IsRoundRobin=(strategy==
'RoundRobin'),
106 EventsBeforeFork=events_before_fork,
107 ReadEventOrders=jp.AthenaMPFlags.ReadEventOrders(),
108 EventOrdersFile=jp.AthenaMPFlags.EventOrdersFile(),
109 Debug=debug_worker) ]
110 if use_shared_writer:
111 from AthenaMPTools.AthenaMPToolsConf
import SharedWriterTool
114 Debug=debug_worker) ]
115 elif strategy==
'EventService':
116 channelScatterer2Processor =
"AthenaMP_Scatterer2Processor"
117 channelProcessor2EvtSel =
"AthenaMP_Processor2EvtSel"
119 from AthenaMPTools.AthenaMPToolsConf
import EvtRangeScatterer
121 EventRangeChannel = event_range_channel,
122 DoCaching=jp.AthenaMPFlags.EvtRangeScattererCaching()) ]
124 from AthenaMPTools.AthenaMPToolsConf
import EvtRangeProcessor
126 Channel2Scatterer = channelScatterer2Processor,
127 Channel2EvtSel = channelProcessor2EvtSel,
128 Debug=debug_worker) ]
130 msg.warning(
"Unknown strategy. No MP tools will be configured")