How to time reconstruction and memory consumption
process.load('Configuration/StandardSequences/Services_cff')
process.Timing = cms.Service("Timing")
process.SimpleMemoryCheck = cms.Service('SimpleMemoryCheck',
ignoreTotal=cms.untracked.int32(0),
oncePerEventMode = cms.untracked.bool(True)
)
If the logs are named like
HYDJET_RECO_CENTRAL_#aog
- one can use
grab.pl
to grab the right numbers
--------- grab.pl ------
open (LOG, ">mem_central_reco.log");
for ( $i = 0; $i<100; $i++)
{
@lines = qx( cat HYDJET_RECO_CENTRAL_$i.log | grep "MemoryCheck: event" );
foreach $line (@lines)
{
@a = split " ", $line;
print LOG "$a[7]\n"; }
}
close LOG;
open (LOG, ">time_mb_raw.log");
for ( $i = 0; $i<100; $i++)
{
@lines = qx( cat HYDJET_RECO_CENTRAL_$i.log | grep "TimeEvent>" );
foreach $line (@lines)
{
@a = split " ", $line;
print LOG "$a[3]\n"; }
}
close LOG;
- and
analyze.C
to make the plots
------------- analyze.C -----------
{
ifstream time;
float t;
ifstream rss;
float mem;
TH1F *ht_c_r = new TH1F("ht_c_r","Reconstruction (Central b=0-4) Wall Clock Time per Event",400,0.,400.);
time.open("time_central_reco.log");
for( int i = 0; i<1000; i++)
{
time >> t;
ht_c_r->Fill(t);
}
time.close();
TH1F *hm_c_r = new TH1F("hm_c_r","Reconstruction (Central b=0-4) RSS Memory Usage",200,0.,3000.);
rss.open("mem_central_reco.log");
for( int i = 0; i<1000; i++)
{
rss >> mem;
hm_c_r->Fill(mem);
}
rss.close();
hm_c_r->GetXaxis()->SetTitle("MegaBytes");
ht_c_r->GetXaxis()->SetTitle("Seconds");
}
- I also did a thing were I read the RSS memory usage directly out of the /proc directory ten times a second to see if I could trust SimpleMemoryCheck and I found it to reliably report the peak memory usage during the event.
--
CatherineSilvestre - 05-Feb-2010