CMS 3D CMS Logo

Classes | Functions | Variables
edmModuleAllocMonitorAnalyze Namespace Reference

Classes

class  Activity
 
class  AllocInfo
 
class  DummyFile
 
class  EDModuleTransitionParser
 
class  ESModuleTransitionParser
 
class  FrameworkTransitionParser
 
class  ModuleAllocCompactFileParser
 
class  ModuleCentricContainers
 
class  ModuleCentricModuleData
 
class  ModuleCentricVisualizationContainers
 
class  ModuleData
 
class  Phase
 
class  PostEDModuleAcquireParser
 
class  PostEDModuleEventDelayedGetParser
 
class  PostEDModuleTransitionParser
 
class  PostESModuleAcquireParser
 
class  PostESModuleTransitionParser
 
class  PostEventReadFromSourceParser
 
class  PostFrameworkTransitionParser
 
class  PostSourceTransitionParser
 
class  PreEDModuleAcquireParser
 
class  PreEDModuleEventDelayedGetParser
 
class  PreEDModuleTransitionParser
 
class  PreESModuleAcquireParser
 
class  PreESModuleTransitionParser
 
class  PreEventReadFromSourceParser
 
class  PreFrameworkTransitionParser
 
class  PreSourceTransitionParser
 
class  SourceTransitionParser
 
class  SyncValues
 
class  TempModuleTransitionInfos
 
class  TemporalModuleData
 
class  TestModuleCommand
 
class  VisualizationContainers
 

Functions

def activityName (activity)
 
def findMatchingTransition (sync, containers)
 
def jsonInfo (parser, temporal)
 
def jsonModuleTransition (type, id, modID, callID, activity, start, finish=0)
 
def jsonTransition (type, id, sync, start, finish, isSrc=False)
 
def jsonVisualizationInfo (parser)
 
def lineParserFactory (step, payload, moduleNames, esModuleNames, recordNames, moduleCentric)
 
def printHelp ()
 
def processingStepsFromFile (f, moduleNames, esModuleNames, recordNames, moduleCentric)
 
def runTests ()
 
def sortByAttribute (parser, attribute)
 
def startTime (x)
 
def textOutput (parser)
 
def textPrefix_ (time, indentLevel)
 
def transitionIndentLevel (transition)
 
def transitionIsGlobal (transition)
 
def transitionName (transition)
 

Variables

 action
 
 activityNames_
 
 args
 
 default
 
 description
 
 epilog
 
 formatter_class
 
 globalTransitions_
 
 help
 
 indent
 
 kLargestLumiNumber
 
 kMicroToSec
 
 kSourceDelayedRead
 
 kSourceFindEvent
 
 parser
 
 stdout
 
 transitionsToFindMatch_
 
 transitionToIndent_
 
 transitionToNames_
 
 type
 

Function Documentation

◆ activityName()

def edmModuleAllocMonitorAnalyze.activityName (   activity)

Definition at line 99 of file edmModuleAllocMonitorAnalyze.py.

Referenced by edmModuleAllocMonitorAnalyze.ModuleData.toSimpleDict().

99 def activityName(activity):
100  return activityNames_[activity]
101 

◆ findMatchingTransition()

def edmModuleAllocMonitorAnalyze.findMatchingTransition (   sync,
  containers 
)

Definition at line 412 of file edmModuleAllocMonitorAnalyze.py.

References print(), and isotrackApplyRegressor.range.

Referenced by edmModuleAllocMonitorAnalyze.PreFrameworkTransitionParser.jsonVisInfo(), and edmModuleAllocMonitorAnalyze.PostFrameworkTransitionParser.jsonVisInfo().

412 def findMatchingTransition(sync, containers):
413  for i in range(len(containers)):
414  if containers[i][-1]["sync"] == sync:
415  return i
416  #need more exhausting search
417  for i in range(len(containers)):
418  for t in containers[i]:
419  if t["sync"] == sync:
420  return i
421 
422  print("find failed",sync, containers)
423  return None
424 
void print(TMatrixD &m, const char *label=nullptr, bool mathematicaFormat=false)
Definition: Utilities.cc:47

◆ jsonInfo()

def edmModuleAllocMonitorAnalyze.jsonInfo (   parser,
  temporal 
)

Definition at line 1198 of file edmModuleAllocMonitorAnalyze.py.

Referenced by edmModuleAllocMonitorAnalyze.TestModuleCommand.testJson(), and edmModuleAllocMonitorAnalyze.TestModuleCommand.testJsonTemporal().

1198 def jsonInfo(parser, temporal):
1199  sync = SyncValues()
1200  #used to keep track of outstanding module transitions
1201  temp = TempModuleTransitionInfos()
1202  if temporal:
1203  data = TemporalModuleData()
1204  else:
1205  data = ModuleCentricModuleData()
1206  for p in parser.processingSteps():
1207  if hasattr(p, "jsonInfo"):
1208  p.jsonInfo(sync,temp, data)
1209  return data
1210 

◆ jsonModuleTransition()

def edmModuleAllocMonitorAnalyze.jsonModuleTransition (   type,
  id,
  modID,
  callID,
  activity,
  start,
  finish = 0 
)

Definition at line 1191 of file edmModuleAllocMonitorAnalyze.py.

Referenced by edmModuleAllocMonitorAnalyze.EDModuleTransitionParser._preJsonVis(), edmModuleAllocMonitorAnalyze.ESModuleTransitionParser._preJsonVis(), and edmModuleAllocMonitorAnalyze.PostEDModuleAcquireParser.jsonVisInfo().

1191 def jsonModuleTransition(type, id, modID, callID, activity, start, finish=0):
1192  return {"type": type, "id": id, "mod": modID, "call": callID, "act": activity, "start": start*kMicroToSec, "finish": finish*kMicroToSec}
1193 
1194 
def jsonModuleTransition(type, id, modID, callID, activity, start, finish=0)

◆ jsonTransition()

def edmModuleAllocMonitorAnalyze.jsonTransition (   type,
  id,
  sync,
  start,
  finish,
  isSrc = False 
)

Definition at line 1188 of file edmModuleAllocMonitorAnalyze.py.

Referenced by edmModuleAllocMonitorAnalyze.PreFrameworkTransitionParser.jsonVisInfo().

1188 def jsonTransition(type, id, sync, start, finish, isSrc=False):
1189  return {"type": type, "id": id, "sync": sync, "start": start*kMicroToSec, "finish": finish*kMicroToSec, "isSrc":isSrc}
1190 
def jsonTransition(type, id, sync, start, finish, isSrc=False)

◆ jsonVisualizationInfo()

def edmModuleAllocMonitorAnalyze.jsonVisualizationInfo (   parser)

Definition at line 1221 of file edmModuleAllocMonitorAnalyze.py.

References mps_setup.append.

Referenced by edmModuleAllocMonitorAnalyze.TestModuleCommand.testFullVisualization(), and edmModuleAllocMonitorAnalyze.TestModuleCommand.testModuleCentricVisualization().

1221 def jsonVisualizationInfo(parser):
1222  if parser._moduleCentric:
1223  data = ModuleCentricContainers()
1224  else:
1225  data = VisualizationContainers()
1226  for p in parser.processingSteps():
1227  p.jsonVisInfo( data)
1228  #make sure everything is sorted
1229  for g in data.allGlobals():
1230  g.sort(key=startTime)
1231  final = {"transitions" : [] , "modules": [], "esModules": []}
1232  final["transitions"].append({ "name":"Global", "slots": []})
1233  globals = final["transitions"][-1]["slots"]
1234  for i, g in enumerate(data.allGlobals()):
1235  globals.append(g)
1236  if not parser._moduleCentric:
1237  if len(data._modGlobals) < i+1:
1238  break
1239  for mod in data._modGlobals[i]:
1240  globals.append(mod)
1241  for i,s in enumerate(data.allStreams()):
1242  final["transitions"].append({"name": f"Stream {i}", "slots":[]})
1243  stream = final["transitions"][-1]["slots"]
1244  stream.append(s)
1245  if not parser._moduleCentric:
1246  for mod in data._modStreams[i]:
1247  stream.append(mod)
1248  if parser._moduleCentric:
1249  sourceSlot = data._modules[data._moduleID2Index(0)]
1250  modules = []
1251  for i,m in parser._moduleNames.items():
1252  modules.append({"name": f"{m}", "slots":[]})
1253  slots = modules[-1]["slots"]
1254  foundSlots = data._modules[data._moduleID2Index(i)]
1255  time = 0
1256  for s in foundSlots:
1257  slots.append(s)
1258  for t in s:
1259  if t["act"] !=Activity.prefetch:
1260  time += t["finish"]-t["start"]
1261  modules[-1]['time']=time
1262  for i,m in parser._esModuleNames.items():
1263  modules.append({"name": f"{m}", "slots":[]})
1264  slots = modules[-1]["slots"]
1265  foundSlots = data._modules[data._moduleID2Index(-1*i)]
1266  time = 0
1267  for s in foundSlots:
1268  slots.append(s)
1269  for t in s:
1270  if t["act"] !=Activity.prefetch:
1271  time += t["finish"]-t["start"]
1272  modules[-1]['time']=time
1273  modules.sort(key= lambda x : x['time'], reverse=True)
1274  final['transitions'].append({"name": "source", "slots":sourceSlot})
1275  for m in modules:
1276  final['transitions'].append(m)
1277 
1278  max = 0
1279  for k in parser._moduleNames.keys():
1280  if k > max:
1281  max = k
1282 
1283  final["modules"] =['']*(max+1)
1284  final["modules"][0] = 'source'
1285  for k,v in parser._moduleNames.items():
1286  final["modules"][k]=v
1287 
1288  max = 0
1289  for k in parser._esModuleNames.keys():
1290  if k > max:
1291  max = k
1292  final["esModules"] = ['']*(max+1)
1293  for k,v in parser._esModuleNames.items():
1294  final["esModules"][k] = v
1295  return final
1296 
1297 
1298 
1299 #=======================================

◆ lineParserFactory()

def edmModuleAllocMonitorAnalyze.lineParserFactory (   step,
  payload,
  moduleNames,
  esModuleNames,
  recordNames,
  moduleCentric 
)

Definition at line 893 of file edmModuleAllocMonitorAnalyze.py.

References edm::errors.LogicError.

Referenced by processingStepsFromFile().

893 def lineParserFactory (step, payload, moduleNames, esModuleNames, recordNames, moduleCentric):
894  if step == 'F':
895  parser = PreFrameworkTransitionParser(payload)
896  return parser
897  if step == 'f':
898  return PostFrameworkTransitionParser(payload)
899  if step == 'S':
900  return PreSourceTransitionParser(payload, moduleCentric)
901  if step == 's':
902  return PostSourceTransitionParser(payload, moduleCentric)
903  if step == 'M':
904  return PreEDModuleTransitionParser(payload, moduleNames, moduleCentric)
905  if step == 'm':
906  return PostEDModuleTransitionParser(payload, moduleNames)
907  if step == 'A':
908  return PreEDModuleAcquireParser(payload, moduleNames, moduleCentric)
909  if step == 'a':
910  return PostEDModuleAcquireParser(payload, moduleNames, moduleCentric)
911  if step == 'D':
912  return PreEDModuleEventDelayedGetParser(payload, moduleNames)
913  if step == 'd':
914  return PostEDModuleEventDelayedGetParser(payload, moduleNames)
915  if step == 'R': return PreEventReadFromSourceParser(payload, moduleNames)
916  if step == 'r':
917  return PostEventReadFromSourceParser(payload, moduleNames)
918  if step == 'N':
919  return PreESModuleTransitionParser(payload, moduleNames, esModuleNames, recordNames)
920  if step == 'n':
921  return PostESModuleTransitionParser(payload, moduleNames, esModuleNames, recordNames)
922  if step == 'B':
923  return PreESModuleAcquireParser(payload, moduleNames, esModuleNames, recordNames)
924  if step == 'b':
925  return PostESModuleAcquireParser(payload, moduleNames, esModuleNames, recordNames)
926  raise LogicError("Unknown step '{}'".format(step))
927 
928 #----------------------------------------------
929 
def lineParserFactory(step, payload, moduleNames, esModuleNames, recordNames, moduleCentric)

◆ printHelp()

def edmModuleAllocMonitorAnalyze.printHelp ( )

Definition at line 9 of file edmModuleAllocMonitorAnalyze.py.

9 def printHelp():
10  s = '''
11 To Use: Add the ModuleAllocMonitor Service to the cmsRun job use something like this
12  in the configuration:
13 
14  process.add_(cms.Service("ModuleAllocMonitor", fileName = cms.untracked.string("moduleAlloc.log")))
15 
16  After running the job, execute this script and pass the name of the
17  ModuleAllocMonitor log file to the script.
18 
19  This script will output a more human readable form of the data in the log file.'''
20  return s
21 
22 #these values come from moduleALloc_setupFile.cc
23 #enum class Step : char {
24 # preSourceTransition = 'S',
25 # postSourceTransition = 's',
26 # preModulePrefetching = 'P',
27 # postModulePrefetching = 'p',
28 # preModuleEventAcquire = 'A',
29 # postModuleEventAcquire = 'a',
30 # preModuleTransition = 'M',
31 # preEventReadFromSource = 'R',
32 # postEventReadFromSource = 'r',
33 # preModuleEventDelayedGet = 'D',
34 # postModuleEventDelayedGet = 'd',
35 # postModuleTransition = 'm',
36 # preESModulePrefetching = 'Q',
37 # postESModulePrefetching = 'q',
38 # preESModule = 'N',
39 # postESModule = 'n',
40 # preESModuleAcquire = 'B',
41 # postESModuleAcquire = 'b',
42 # preFrameworkTransition = 'F',
43 # postFrameworkTransition = 'f'
44 #};
45 
46 

◆ processingStepsFromFile()

def edmModuleAllocMonitorAnalyze.processingStepsFromFile (   f,
  moduleNames,
  esModuleNames,
  recordNames,
  moduleCentric 
)

Definition at line 930 of file edmModuleAllocMonitorAnalyze.py.

References lineParserFactory(), and mkLumiAveragedPlots.tuple.

Referenced by edmModuleAllocMonitorAnalyze.ModuleAllocCompactFileParser.processingSteps().

930 def processingStepsFromFile(f,moduleNames, esModuleNames, recordNames, moduleCentric):
931  for rawl in f:
932  l = rawl.strip()
933  if not l or l[0] == '#':
934  continue
935  (step,payload) = tuple(l.split(None,1))
936  payload=payload.split()
937 
938  parser = lineParserFactory(step, payload, moduleNames, esModuleNames, recordNames, moduleCentric)
939  if parser:
940  yield parser
941  return
942 
def lineParserFactory(step, payload, moduleNames, esModuleNames, recordNames, moduleCentric)
def processingStepsFromFile(f, moduleNames, esModuleNames, recordNames, moduleCentric)

◆ runTests()

def edmModuleAllocMonitorAnalyze.runTests ( )

Definition at line 1475 of file edmModuleAllocMonitorAnalyze.py.

1475 def runTests():
1476  return unittest.main(argv=sys.argv[:1])
1477 
1478 #=======================================

◆ sortByAttribute()

def edmModuleAllocMonitorAnalyze.sortByAttribute (   parser,
  attribute 
)

Definition at line 1211 of file edmModuleAllocMonitorAnalyze.py.

Referenced by edmModuleAllocMonitorAnalyze.TestModuleCommand.testSortBy().

1211 def sortByAttribute(parser, attribute):
1212  sync = SyncValues()
1213  #used to keep track of outstanding module transitions
1214  temp = TempModuleTransitionInfos()
1215  data = ModuleCentricModuleData()
1216  for p in parser.processingSteps():
1217  if hasattr(p, "jsonInfo"):
1218  p.jsonInfo(sync,temp, data)
1219  return data.sortModulesBy(attribute)
1220 

◆ startTime()

def edmModuleAllocMonitorAnalyze.startTime (   x)

Definition at line 1195 of file edmModuleAllocMonitorAnalyze.py.

1195 def startTime(x):
1196  return x["start"]
1197 

◆ textOutput()

def edmModuleAllocMonitorAnalyze.textOutput (   parser)

Definition at line 999 of file edmModuleAllocMonitorAnalyze.py.

References print().

999 def textOutput( parser ):
1000  context = {}
1001  for p in parser.processingSteps():
1002  print(p.text(context))
1003 
void print(TMatrixD &m, const char *label=nullptr, bool mathematicaFormat=false)
Definition: Utilities.cc:47

◆ textPrefix_()

def edmModuleAllocMonitorAnalyze.textPrefix_ (   time,
  indentLevel 
)

Definition at line 190 of file edmModuleAllocMonitorAnalyze.py.

Referenced by edmModuleAllocMonitorAnalyze.FrameworkTransitionParser.textPrefix(), edmModuleAllocMonitorAnalyze.SourceTransitionParser.textPrefix(), edmModuleAllocMonitorAnalyze.EDModuleTransitionParser.textPrefix(), and edmModuleAllocMonitorAnalyze.ESModuleTransitionParser.textPrefix().

190 def textPrefix_(time, indentLevel):
191  #using 11 spaces for time should accomodate a job that runs 24 hrs
192  return f'{time:>11} '+"++"*indentLevel
193 

◆ transitionIndentLevel()

def edmModuleAllocMonitorAnalyze.transitionIndentLevel (   transition)

◆ transitionIsGlobal()

◆ transitionName()

def edmModuleAllocMonitorAnalyze.transitionName (   transition)

Definition at line 132 of file edmModuleAllocMonitorAnalyze.py.

Referenced by edmModuleAllocMonitorAnalyze.ModuleData.toSimpleDict().

132 def transitionName(transition):
133  return transitionToNames_[transition]
134 

Variable Documentation

◆ action

edmModuleAllocMonitorAnalyze.action

Definition at line 1492 of file edmModuleAllocMonitorAnalyze.py.

◆ activityNames_

edmModuleAllocMonitorAnalyze.activityNames_

Definition at line 93 of file edmModuleAllocMonitorAnalyze.py.

◆ args

edmModuleAllocMonitorAnalyze.args

Definition at line 1508 of file edmModuleAllocMonitorAnalyze.py.

◆ default

edmModuleAllocMonitorAnalyze.default

Definition at line 1495 of file edmModuleAllocMonitorAnalyze.py.

◆ description

edmModuleAllocMonitorAnalyze.description

Definition at line 1485 of file edmModuleAllocMonitorAnalyze.py.

◆ epilog

edmModuleAllocMonitorAnalyze.epilog

Definition at line 1487 of file edmModuleAllocMonitorAnalyze.py.

◆ formatter_class

edmModuleAllocMonitorAnalyze.formatter_class

Definition at line 1486 of file edmModuleAllocMonitorAnalyze.py.

◆ globalTransitions_

edmModuleAllocMonitorAnalyze.globalTransitions_

Definition at line 166 of file edmModuleAllocMonitorAnalyze.py.

◆ help

edmModuleAllocMonitorAnalyze.help

Definition at line 1490 of file edmModuleAllocMonitorAnalyze.py.

◆ indent

edmModuleAllocMonitorAnalyze.indent

Definition at line 1515 of file edmModuleAllocMonitorAnalyze.py.

◆ kLargestLumiNumber

edmModuleAllocMonitorAnalyze.kLargestLumiNumber

Definition at line 52 of file edmModuleAllocMonitorAnalyze.py.

◆ kMicroToSec

edmModuleAllocMonitorAnalyze.kMicroToSec

Definition at line 47 of file edmModuleAllocMonitorAnalyze.py.

◆ kSourceDelayedRead

edmModuleAllocMonitorAnalyze.kSourceDelayedRead

Definition at line 50 of file edmModuleAllocMonitorAnalyze.py.

◆ kSourceFindEvent

edmModuleAllocMonitorAnalyze.kSourceFindEvent

Definition at line 49 of file edmModuleAllocMonitorAnalyze.py.

◆ parser

edmModuleAllocMonitorAnalyze.parser

Definition at line 1485 of file edmModuleAllocMonitorAnalyze.py.

◆ stdout

edmModuleAllocMonitorAnalyze.stdout

Definition at line 1515 of file edmModuleAllocMonitorAnalyze.py.

◆ transitionsToFindMatch_

edmModuleAllocMonitorAnalyze.transitionsToFindMatch_

Definition at line 425 of file edmModuleAllocMonitorAnalyze.py.

◆ transitionToIndent_

edmModuleAllocMonitorAnalyze.transitionToIndent_

Definition at line 135 of file edmModuleAllocMonitorAnalyze.py.

◆ transitionToNames_

edmModuleAllocMonitorAnalyze.transitionToNames_

Definition at line 102 of file edmModuleAllocMonitorAnalyze.py.

◆ type

edmModuleAllocMonitorAnalyze.type

Definition at line 1489 of file edmModuleAllocMonitorAnalyze.py.