CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_5_2_9/src/Validation/Performance/python/TimeMemoryG4Info.py

Go to the documentation of this file.
00001 #G.Benelli Dec 21 2007
00002 #This fragment is used for the simulation (SIM) step
00003 #It includes a MessageLogger tweak to dump G4msg.log
00004 #in addition to the the SimpleMemoryCheck and Timing
00005 #services output for the log used by the Performance Suite profiling.
00006 #It is meant to be used with the cmsDriver.py option
00007 #--customise in the following fashion:
00008 #E.g.
00009 #./cmsDriver.py MinBias.cfi -n 50 --step=GEN,SIM --customise=Validation/Performance/TimeMemoryG4Info.py >& MinBias_GEN,SIM.log&
00010 #Note there is no need to specify the "python" directory in the path.
00011 
00012 
00013 import FWCore.ParameterSet.Config as cms
00014 def customise(process):
00015     #Adding SimpleMemoryCheck service:
00016     process.SimpleMemoryCheck=cms.Service("SimpleMemoryCheck",
00017                                           ignoreTotal=cms.untracked.int32(1),
00018                                           oncePerEventMode=cms.untracked.bool(True))
00019     #Adding Timing service:
00020     process.Timing=cms.Service("Timing")
00021     
00022     #Tweak Message logger to dump G4cout and G4cerr messages in G4msg.log
00023     #print process.MessageLogger.__dict__
00024     process.MessageLogger.destinations=cms.untracked.vstring('cout'
00025                                                              ,'cerr'
00026                                                              ,'G4msg'
00027                                                              )
00028     process.MessageLogger.categories=cms.untracked.vstring('FwkJob'
00029                                                            ,'FwkReport'
00030                                                            ,'FwkSummary'
00031                                                            ,'Root_NoDictionary'
00032                                                            ,'TimeReport'
00033                                                            ,'TimeModule'
00034                                                            ,'TimeEvent'
00035                                                            ,'MemoryCheck'
00036                                                            ,'PhysicsList'
00037                                                            ,'G4cout'
00038                                                            ,'G4cerr'
00039                                                            )
00040     #Configuring the G4msg.log output
00041     process.MessageLogger.G4msg =  cms.untracked.PSet(
00042         noTimeStamps = cms.untracked.bool(True)
00043         #First eliminate unneeded output
00044         ,threshold = cms.untracked.string('INFO')
00045         ,INFO = cms.untracked.PSet(limit = cms.untracked.int32(0))
00046         ,FwkReport = cms.untracked.PSet(limit = cms.untracked.int32(0))
00047         ,FwkSummary = cms.untracked.PSet(limit = cms.untracked.int32(0))
00048         ,Root_NoDictionary = cms.untracked.PSet(limit = cms.untracked.int32(0))
00049         ,FwkJob = cms.untracked.PSet(limit = cms.untracked.int32(0))
00050         ,TimeReport = cms.untracked.PSet(limit = cms.untracked.int32(0))
00051         ,TimeModule = cms.untracked.PSet(limit = cms.untracked.int32(0))
00052         ,TimeEvent = cms.untracked.PSet(limit = cms.untracked.int32(0))
00053         ,MemoryCheck = cms.untracked.PSet(limit = cms.untracked.int32(0))
00054         #TimeModule, TimeEvent, TimeReport are written to LogAsbolute instead of LogInfo with a category
00055         #so they cannot be eliminated from any destination (!) unless one uses the summaryOnly option
00056         #in the Timing Service... at the price of silencing the output needed for the TimingReport profiling
00057         #
00058         #Then add the wanted ones:
00059         ,PhysicsList = cms.untracked.PSet(limit = cms.untracked.int32(-1))
00060         ,G4cout = cms.untracked.PSet(limit = cms.untracked.int32(-1))
00061         ,G4cerr = cms.untracked.PSet(limit = cms.untracked.int32(-1))
00062         )
00063 
00064     #Add these 3 lines to put back the summary for timing information at the end of the logfile
00065     #(needed for TimeReport report)
00066     process.options = cms.untracked.PSet(
00067         wantSummary = cms.untracked.bool(True)
00068         )
00069 
00070     #Add the configuration for the Igprof running to dump profile snapshots:
00071     process.IgProfService = cms.Service("IgProfService",
00072         reportFirstEvent            = cms.untracked.int32(1), #Dump first event for baseline studies
00073         reportEventInterval         = cms.untracked.int32( ( (process.maxEvents.input.value()-1)/2) ), # dump in the middle of the run
00074         reportToFileAtPostEvent     = cms.untracked.string("| gzip -c > IgProf.%I.gz")
00075         )
00076         
00077     return(process)