Skip to content

Latest commit

 

History

History
63 lines (56 loc) · 3.07 KB

README.md

File metadata and controls

63 lines (56 loc) · 3.07 KB

Miscellaneous NtupleMaker profiling tools

Time profiling (CPU) - IgProf

First time setup

  • IgProf comes with a nice web GUI which requires some setup. In your ~/public_html/.htaccess file, ensure you have the following
AddHandler cgi-script .cgi .py
Options +ExecCGI

and do

mkdir -p ~/public_html/cgi-bin/data/
cp igprof-navigator.py ~/public_html/cgi-bin/
chmod 755 -R ~/public_html/cgi-bin/

Note that permissions for cgi scripts and folders they reside in are very annoying to get right. If you see issues with the web site, try making the permissions on the data files within data/ 644. Another note, if you get an "Internal error", make sure your gcc in SCRAM_ARCH isn't 630. Going back to 493 works for me. Or 491. E.g.,

cd /cvmfs/cms.cern.ch/slc6_amd64_gcc491/cms/cmssw-patch/CMSSW_7_4_7_patch1
cmsenv
cd -
# comment out the cmsRun line in run_igprof.sh and then run it again

Running

  • Modify the pset to run over the desired number of events. If you run over less than a few thousand, your profiling will be dominated by startup overhead.
  • Modify the parameters in run_igprof.sh to reproduce your local running. Be sure the path to the pset is correct, and it can't hurt to read the script before running it...
  • ./run_igprof.sh
  • Visit the link that gets printed out.

Time profiling (user time)

The poor man's profiling is to run on many events and calculate the event rate from the Begin processing lines. Use the script print_timing.py to do this after you've redirected such output into a log file. The script has other features to be discovered.

Memory profiling (Valgrind)

A good reference for Valgrind with CMSSW is here.

Instructions

  • Modify the pset to run over only a handful of events, as this kind of profiling is quite intensive. Then, put this into the pset:
process.ProfilerService = cms.Service (
        "ProfilerService",
        firstEvent = cms.untracked.int32(3),
        lastEvent = cms.untracked.int32(12),
        paths = cms.untracked.vstring('p1')
        )
  • Execute the following, tweaking the cmsRun statement and arguments to match your local setup
valgrind --leak-check=yes  cmsRun main_pset.py data=False >& log.txt
valgrindMemcheckParser.pl --preset=prod,-prod1+ log.txt  > memory_profiling.html
cp memory_profiling.html ~/public_html/
  • Finally, check the output in your browser.

Storage space

  • ./top_branches.py prints event size and largest branches. Run ./top_branches.py -h for more options.
  • Note, it can be used to see if two ROOT files are identical without actually printing branch content. You can do something like
# use 4 decimals of precision and show the top 2000 branches (should be everything)
# if the diff turns up nothing, then it's highly likely the branches are identical
vimdiff <(top_branches.py  outputs_after/ntuple_2016_mc_94xminiaodv3.root -p 4 -n 2000) <(top_branches.py outputstest/ntuple_2016_mc_94xminiaodv3.root -p 4 -n 2000)