#!/bin/bash # Binds for singularity containers # Mount /afs, /eos, /cvmfs, /etc/grid-security for xrootd export APPTAINER_BINDPATH='/afs,/cvmfs,/cvmfs/grid.cern.ch/etc/grid-security:/etc/grid-security,/eos,/etc/pki/ca-trust,/run/user,/var/run/user' # Dump actual test code to a BPH-Phys14DR-00001_test.sh file that can be run in Singularity cat <<'EndOfTestFile' > BPH-Phys14DR-00001_test.sh #!/bin/bash export SCRAM_ARCH=slc6_amd64_gcc481 source /cvmfs/cms.cern.ch/cmsset_default.sh if [ -r CMSSW_7_2_0/src ] ; then echo release CMSSW_7_2_0 already exists else scram p CMSSW CMSSW_7_2_0 fi cd CMSSW_7_2_0/src eval `scram runtime -sh` mv ../../Configuration . scram b cd ../.. # Maximum validation runtime: 28800s # Minimum validation runtime: 600s # Output events to run for the validation job (from application's setting): 100 # Event efficiency: Computed using the request efficiency and its error. # Event efficiency: `efficiency - (2 * efficiency_error)`: `1 - (2 * 0)` = 1 # Input events: `int(output_events / event_efficiency)`: `int(100 / 1)` = 100 # Time per event (s): Computed adding all the time_per_event values on every sequence # Time per event (s): 111 # Target input events: 100 # Target output events: 100 # This validation will be computed based on the target output events! EVENTS=100 # cmsDriver command cmsDriver.py --eventcontent RAWSIM --inputEventContent REGEN --pileup AVE_40_BX_25ns --customise SLHCUpgradeSimulations/Configuration/postLS1Customs.customisePostLS1,Configuration/DataProcessing/Utils.addMonitoring --datatier GEN-SIM-RAW --conditions PHYS14_25_V1 --step GEN:fixGenInfo,DIGI,L1,DIGI2RAW,HLT:GRun --magField 38T_PostLS1 --python_filename BPH-Phys14DR-00001_1_cfg.py --fileout file:BPH-Phys14DR-00001_0.root --filein "dbs:/JpsiToMuMu_JPsiPt20WithFSR_13TeV-pythia6-evtgen/Fall13-POSTLS162_V1-v1/GEN-SIM" --number 100 --number_out 100 --pileup_input "dbs:/MinBias_TuneA2MB_13TeV-pythia8/Fall13-POSTLS162_V1-v1/GEN-SIM" --no_exec --mc || exit $? ; # Run generated config REPORT_NAME=BPH-Phys14DR-00001_0_report.xml # Run the cmsRun cmsRun -e -j $REPORT_NAME BPH-Phys14DR-00001_1_cfg.py || exit $? ; # Parse values from BPH-Phys14DR-00001_0_report.xml report processedEvents=$(grep -Po "(?<=)" $REPORT_NAME | tail -n 1) producedEvents=$(grep -Po "(?<=)(\d*)(?=)" $REPORT_NAME | tail -n 1) threads=$(grep -Po "(?<=)" $REPORT_NAME | tail -n 1) peakValueRss=$(grep -Po "(?<=)" $REPORT_NAME | tail -n 1) peakValueVsize=$(grep -Po "(?<=)" $REPORT_NAME | tail -n 1) totalSize=$(grep -Po "(?<=)" $REPORT_NAME | tail -n 1) totalSizeAlt=$(grep -Po "(?<=)" $REPORT_NAME | tail -n 1) totalJobTime=$(grep -Po "(?<=)" $REPORT_NAME | tail -n 1) totalJobCPU=$(grep -Po "(?<=)" $REPORT_NAME | tail -n 1) eventThroughput=$(grep -Po "(?<=)" $REPORT_NAME | tail -n 1) avgEventTime=$(grep -Po "(?<=)" $REPORT_NAME | tail -n 1) if [ -z "$threads" ]; then echo "Could not find NumberOfThreads in report, defaulting to 1" threads=1 fi if [ -z "$eventThroughput" ]; then eventThroughput=$(bc -l <<< "scale=4; 1 / ($avgEventTime / $threads)") fi if [ -z "$totalSize" ]; then totalSize=$totalSizeAlt fi if [ -z "$processedEvents" ]; then processedEvents=$EVENTS fi echo "Validation report of BPH-Phys14DR-00001 sequence 1/3" echo "Processed events: $processedEvents" echo "Produced events: $producedEvents" echo "Threads: $threads" echo "Peak value RSS: $peakValueRss MB" echo "Peak value Vsize: $peakValueVsize MB" echo "Total size: $totalSize MB" echo "Total job time: $totalJobTime s" echo "Total CPU time: $totalJobCPU s" echo "Event throughput: $eventThroughput" echo "CPU efficiency: "$(bc -l <<< "scale=2; ($totalJobCPU * 100) / ($threads * $totalJobTime)")" %" echo "Size per event: "$(bc -l <<< "scale=4; ($totalSize * 1024 / $producedEvents)")" kB" echo "Time per event: "$(bc -l <<< "scale=4; (1 / $eventThroughput)")" s" echo "Filter efficiency percent: "$(bc -l <<< "scale=8; ($producedEvents * 100) / $processedEvents")" %" echo "Filter efficiency fraction: "$(bc -l <<< "scale=10; ($producedEvents) / $processedEvents") # cmsDriver command cmsDriver.py --eventcontent AODSIM,DQM --customise SLHCUpgradeSimulations/Configuration/postLS1Customs.customisePostLS1,Configuration/DataProcessing/Utils.addMonitoring --datatier AODSIM,DQMIO --conditions PHYS14_25_V1 --step RAW2DIGI,L1Reco,RECO,EI,DQM:DQMOfflinePOGMC --magField 38T_PostLS1 --python_filename BPH-Phys14DR-00001_2_cfg.py --fileout file:BPH-Phys14DR-00001_1.root --filein file:BPH-Phys14DR-00001_0.root --number 100 --number_out 100 --no_exec --mc || exit $? ; # Run generated config REPORT_NAME=BPH-Phys14DR-00001_1_report.xml # Run the cmsRun cmsRun -e -j $REPORT_NAME BPH-Phys14DR-00001_2_cfg.py || exit $? ; # Parse values from BPH-Phys14DR-00001_1_report.xml report processedEvents=$(grep -Po "(?<=)" $REPORT_NAME | tail -n 1) producedEvents=$(grep -Po "(?<=)(\d*)(?=)" $REPORT_NAME | tail -n 1) threads=$(grep -Po "(?<=)" $REPORT_NAME | tail -n 1) peakValueRss=$(grep -Po "(?<=)" $REPORT_NAME | tail -n 1) peakValueVsize=$(grep -Po "(?<=)" $REPORT_NAME | tail -n 1) totalSize=$(grep -Po "(?<=)" $REPORT_NAME | tail -n 1) totalSizeAlt=$(grep -Po "(?<=)" $REPORT_NAME | tail -n 1) totalJobTime=$(grep -Po "(?<=)" $REPORT_NAME | tail -n 1) totalJobCPU=$(grep -Po "(?<=)" $REPORT_NAME | tail -n 1) eventThroughput=$(grep -Po "(?<=)" $REPORT_NAME | tail -n 1) avgEventTime=$(grep -Po "(?<=)" $REPORT_NAME | tail -n 1) if [ -z "$threads" ]; then echo "Could not find NumberOfThreads in report, defaulting to 1" threads=1 fi if [ -z "$eventThroughput" ]; then eventThroughput=$(bc -l <<< "scale=4; 1 / ($avgEventTime / $threads)") fi if [ -z "$totalSize" ]; then totalSize=$totalSizeAlt fi if [ -z "$processedEvents" ]; then processedEvents=$EVENTS fi echo "Validation report of BPH-Phys14DR-00001 sequence 2/3" echo "Processed events: $processedEvents" echo "Produced events: $producedEvents" echo "Threads: $threads" echo "Peak value RSS: $peakValueRss MB" echo "Peak value Vsize: $peakValueVsize MB" echo "Total size: $totalSize MB" echo "Total job time: $totalJobTime s" echo "Total CPU time: $totalJobCPU s" echo "Event throughput: $eventThroughput" echo "CPU efficiency: "$(bc -l <<< "scale=2; ($totalJobCPU * 100) / ($threads * $totalJobTime)")" %" echo "Size per event: "$(bc -l <<< "scale=4; ($totalSize * 1024 / $producedEvents)")" kB" echo "Time per event: "$(bc -l <<< "scale=4; (1 / $eventThroughput)")" s" echo "Filter efficiency percent: "$(bc -l <<< "scale=8; ($producedEvents * 100) / $processedEvents")" %" echo "Filter efficiency fraction: "$(bc -l <<< "scale=10; ($producedEvents) / $processedEvents") # cmsDriver command cmsDriver.py --eventcontent MINIAODSIM --customise Configuration/DataProcessing/Utils.addMonitoring --datatier MINIAODSIM --conditions PHYS14_25_V1 --step PAT --python_filename BPH-Phys14DR-00001_3_cfg.py --fileout file:BPH-Phys14DR-00001.root --filein file:BPH-Phys14DR-00001_1.root --number 100 --number_out 100 --runUnscheduled --no_exec --mc || exit $? ; # Run generated config REPORT_NAME=BPH-Phys14DR-00001_report.xml # Run the cmsRun cmsRun -e -j $REPORT_NAME BPH-Phys14DR-00001_3_cfg.py || exit $? ; # Parse values from BPH-Phys14DR-00001_report.xml report processedEvents=$(grep -Po "(?<=)" $REPORT_NAME | tail -n 1) producedEvents=$(grep -Po "(?<=)(\d*)(?=)" $REPORT_NAME | tail -n 1) threads=$(grep -Po "(?<=)" $REPORT_NAME | tail -n 1) peakValueRss=$(grep -Po "(?<=)" $REPORT_NAME | tail -n 1) peakValueVsize=$(grep -Po "(?<=)" $REPORT_NAME | tail -n 1) totalSize=$(grep -Po "(?<=)" $REPORT_NAME | tail -n 1) totalSizeAlt=$(grep -Po "(?<=)" $REPORT_NAME | tail -n 1) totalJobTime=$(grep -Po "(?<=)" $REPORT_NAME | tail -n 1) totalJobCPU=$(grep -Po "(?<=)" $REPORT_NAME | tail -n 1) eventThroughput=$(grep -Po "(?<=)" $REPORT_NAME | tail -n 1) avgEventTime=$(grep -Po "(?<=)" $REPORT_NAME | tail -n 1) if [ -z "$threads" ]; then echo "Could not find NumberOfThreads in report, defaulting to 1" threads=1 fi if [ -z "$eventThroughput" ]; then eventThroughput=$(bc -l <<< "scale=4; 1 / ($avgEventTime / $threads)") fi if [ -z "$totalSize" ]; then totalSize=$totalSizeAlt fi if [ -z "$processedEvents" ]; then processedEvents=$EVENTS fi echo "Validation report of BPH-Phys14DR-00001 sequence 3/3" echo "Processed events: $processedEvents" echo "Produced events: $producedEvents" echo "Threads: $threads" echo "Peak value RSS: $peakValueRss MB" echo "Peak value Vsize: $peakValueVsize MB" echo "Total size: $totalSize MB" echo "Total job time: $totalJobTime s" echo "Total CPU time: $totalJobCPU s" echo "Event throughput: $eventThroughput" echo "CPU efficiency: "$(bc -l <<< "scale=2; ($totalJobCPU * 100) / ($threads * $totalJobTime)")" %" echo "Size per event: "$(bc -l <<< "scale=4; ($totalSize * 1024 / $producedEvents)")" kB" echo "Time per event: "$(bc -l <<< "scale=4; (1 / $eventThroughput)")" s" echo "Filter efficiency percent: "$(bc -l <<< "scale=8; ($producedEvents * 100) / $processedEvents")" %" echo "Filter efficiency fraction: "$(bc -l <<< "scale=10; ($producedEvents) / $processedEvents") # End of BPH-Phys14DR-00001_test.sh file EndOfTestFile # Make file executable chmod +x BPH-Phys14DR-00001_test.sh if [ -e "/cvmfs/unpacked.cern.ch/registry.hub.docker.com/cmssw/slc6:amd64" ]; then CONTAINER_NAME="slc6:amd64" elif [ -e "/cvmfs/unpacked.cern.ch/registry.hub.docker.com/cmssw/slc6:x86_64" ]; then CONTAINER_NAME="slc6:x86_64" else echo "Could not find amd64 or x86_64 for slc6" exit 1 fi # Run in singularity container export SINGULARITY_CACHEDIR="/tmp/$(whoami)/singularity" singularity run --home $PWD:$PWD /cvmfs/unpacked.cern.ch/registry.hub.docker.com/cmssw/$CONTAINER_NAME $(echo $(pwd)/BPH-Phys14DR-00001_test.sh)