ATLAS Offline Software
DataLoopTest.py
Go to the documentation of this file.
1 #
2 # Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration
3 #
4 
5 
6 #
7 
9 from AthenaCommon.Logging import log as msg
10 
11 from AthenaCommon.ConcurrencyFlags import jobproperties as jp
12 nThreads = jp.ConcurrencyFlags.NumThreads()
13 if (nThreads < 1) :
14  msg.fatal('numThreads must be >0. Did you set the --threads=N option?')
15  sys.exit(AthenaCommon.ExitCodes.CONFIGURATION_ERROR)
16 
17 #
18 
20 
21 from AthenaServices.AthenaServicesConf import AthenaHiveEventLoopMgr
22 # svcMgr.AthenaHiveEventLoopMgr.OutputLevel = INFO
23 
24 from StoreGate.StoreGateConf import SG__HiveMgrSvc
25 # svcMgr.EventDataSvc.OutputLevel = INFO
26 
27 from GaudiHive.GaudiHiveConf import AlgResourcePool
28 # svcMgr += AlgResourcePool( OutputLevel = INFO );
29 
30 from AthenaCommon.AlgScheduler import AlgScheduler
31 AlgScheduler.OutputLevel( INFO )
32 AlgScheduler.ShowControlFlow( True )
33 AlgScheduler.ShowDataDependencies( True )
34 AlgScheduler.setDataLoaderAlg( "SGInputLoader" )
35 
36 
37 # ThreadPoolService thread local initialization
38 from GaudiHive.GaudiHiveConf import ThreadPoolSvc
39 svcMgr += ThreadPoolSvc("ThreadPoolSvc")
40 svcMgr.ThreadPoolSvc.ThreadInitTools = ["ThreadInitTool"]
41 
42 from GaudiHive.GaudiHiveConf import AlgResourcePool
43 svcMgr += AlgResourcePool(OutputLevel=DEBUG)
44 
45 #---------------------------------------------------------------------------------#
46 
47 #
48 
53 
54 #---------------------------------------------------------------------------------#
55 
56 
57 #
58 
60 
61 from AthenaCommon.AlgSequence import AlgSequence
62 topSequence = AlgSequence()
63 
64 from SGComps.SGCompsConf import SGInputLoader
65 topSequence+=SGInputLoader(OutputLevel=INFO, ShowEventDump=False)
66 
67 from AthExHive.AthExHiveConf import *
68 HA = HiveAlgA("AlgA",OutputLevel=DEBUG,Time=20)
69 HB = HiveAlgB("AlgB",OutputLevel=DEBUG,Time=10)
70 HC = HiveAlgC("AlgC",OutputLevel=DEBUG,Time=190)
71 HE = HiveAlgE("AlgE",OutputLevel=DEBUG,Time=10)
72 
73 # add a data loop in a sequence to test strict ordering
74 from AthenaCommon.AlgSequence import AthSequencer
75 alp = AthSequencer("LoopSeq", OutputLevel=DEBUG, Sequential=True)
76 
77 loopKey = "l2"
78 HL1 = HiveAlgL1("AlgL1",OutputLevel=DEBUG,Key_W1=loopKey,Time=110)
79 HL2 = HiveAlgL2("AlgL2",OutputLevel=DEBUG,Key_R1=loopKey,Key_U1=loopKey,Time=320)
80 HL3 = HiveAlgL3("AlgL3",OutputLevel=DEBUG,Key_U1=loopKey,Time=120)
81 
82 # AlgM tests to see if sequence was ordered properly
83 HM = HiveAlgM("AlgM",OutputLevel=DEBUG,Key_R2=loopKey,Offset=3,Time=30)
84 
85 alp += HL1
86 # alp += HL2
87 # alp += HL3
88 alp += HM
89 topSequence += alp
90 
91 topSequence += HA
92 topSequence += HB
93 topSequence += HC
94 topSequence += HE
95 
96 
97 #--------------------------------------------------------------
98 # Event related parameters
99 #--------------------------------------------------------------
100 
101 theApp.EvtMax = 10
102 
103 nProc = jp.ConcurrencyFlags.NumProcs()
104 if (nProc > 0) :
105 
106  #
107 
109  import AthenaCommon.AtlasUnixGeneratorJob
110 
111  #
112 
114 
115  from AthenaCommon.Logging import log as msg
116  if (theApp.EvtMax == -1) :
117  msg.fatal('EvtMax must be >0 for hybrid configuration')
118  sys.exit(AthenaCommon.ExitCodes.CONFIGURATION_ERROR)
119 
120  if ( theApp.EvtMax % nProc != 0 ) :
121  msg.warning('EvtMax[%s] is not divisible by nProcs[%s]: MP Workers will not process all requested events',theApp.EvtMax,nProc)
122 
123  chunkSize = int (theApp.EvtMax / nProc)
124 
125  from AthenaMP.AthenaMPFlags import jobproperties as jps
126  jps.AthenaMPFlags.PreCountedEvents=theApp.EvtMax
127  jps.AthenaMPFlags.ChunkSize= chunkSize
128 
129  msg.info('AthenaMP workers will process %s events each',chunkSize)
130 
131 
132 
133 print "==========================================================================================\n"
134 
135 #
136 
138 
139 # set algCardinality = 1 to disable cloning for all Algs
140 algCardinality = jp.ConcurrencyFlags.NumThreads()
141 
142 if (algCardinality != 1):
143  for alg in topSequence:
144  name = alg.name()
145  alg.Cardinality = algCardinality
146 
HiveAlgM
Definition: HiveAlgM.h:14
HiveAlgL3
Definition: HiveAlgL3.h:16
python.AlgSequence.AlgSequence
AlgSequence
Definition: PhysicsAnalysis/D3PDTools/AnaAlgorithm/python/AlgSequence.py:7
HiveAlgE
Definition: HiveAlgE.h:21
HiveAlgB
Definition: HiveAlgB.h:23
AthExHiveConf
HiveAlgL2
Definition: HiveAlgL2.h:16
HiveAlgA
Definition: HiveAlgA.h:23
HiveAlgL1
Definition: HiveAlgL1.h:15
python.AlgSequence.AthSequencer
AthSequencer
Definition: Control/AthenaCommon/python/AlgSequence.py:64
HiveAlgC
Definition: HiveAlgC.h:21