Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-07-13 03:15:50

0001 #!/bin/bash
0002 
0003 numFiles=15
0004 cumRootFile='prova.root'
0005 cumPBFile='prova.pb'
0006 cumPBFile_inROOT='provaPB.root'
0007 cumPBFileThreaded='provaThreaded.pb'
0008 cumPBFileThreaded_inROOT='provaPBThreaded.root'
0009 numThreads=3
0010 timecmd='/usr/bin/time -f %E'
0011 
0012 set_up() {
0013     echo "Removing previous ROOT and PB files"
0014 
0015     rm -fr fastHaddTests
0016     mkdir fastHaddTests
0017     cd fastHaddTests
0018 
0019     return 0
0020 }
0021 
0022 generate() {
0023     echo "Generating files"
0024 
0025     python3 ${LOCAL_TEST_DIR}/test_fastHaddMerge.py -a produce -n $numFiles 2>&1 > /dev/null
0026 
0027     if [ $? -ne 0 ]; then
0028         exit $?
0029     fi
0030 
0031     return 0
0032 }
0033 
0034 convertROOT2PB() {
0035     echo "Converting files to PB format"
0036 
0037     for file in $(ls Merge*root)
0038     do
0039         fastHadd encode -o `basename $file .root`.pb $file
0040 #       cmsRun convertRoot2PB.py $file &> /dev/null
0041         if [ $? -ne 0 ]; then
0042             exit $?
0043         fi
0044     done
0045 
0046     return 0
0047 }
0048 
0049 hadd_merge() {
0050     echo "Merging with hadd"
0051 
0052     if [ -e "$cumRootFile" ]; then
0053         rm $cumRootFile
0054     fi
0055 
0056     $timecmd hadd $cumRootFile $(ls Merge*.root) 2>&1 > /dev/null
0057 
0058     if [ $? -ne 0 ]; then
0059         exit $?
0060     fi
0061 
0062     return 0
0063 }
0064 
0065 check_hadd() {
0066     echo "Checking ROOT result..."
0067 
0068     python3 ${LOCAL_TEST_DIR}/test_fastHaddMerge.py -a check -n $numFiles -c $cumRootFile 2>&1 > /dev/null
0069 
0070     if [ $? -ne 0 ]; then
0071         exit $?
0072     fi
0073 
0074     return 0
0075 }
0076 
0077 fasthadd_merge() {
0078     echo "Merging with fastHadd"
0079 
0080     $timecmd fastHadd -d add -o $cumPBFile $(ls Merge*.pb) 2>&1 > /dev/null
0081 
0082     if [ $? -ne 0 ]; then
0083         exit $?
0084     fi
0085 
0086     return 0
0087 }
0088 
0089 convertPB2ROOT() {
0090     echo "Converting back to ROOT format"
0091 
0092     fastHadd -d convert -o $cumPBFile_inROOT $cumPBFile 2>&1 > /dev/null
0093 
0094     if [ $? -ne 0 ]; then
0095         exit $?
0096     fi
0097 
0098     return 0
0099 }
0100 
0101 check_fasthadd() {
0102     echo "Checking PB result... on ${cumPBFile_inROOT}"
0103 
0104     python3 ${LOCAL_TEST_DIR}/test_fastHaddMerge.py -a check -n $numFiles -c $cumPBFile_inROOT 2>&1 > /dev/null
0105 
0106     if [ $? -ne 0 ]; then
0107         exit $?
0108     fi
0109 
0110     return 0
0111 }
0112 
0113 fasthadd_parallel_merge() {
0114     echo "Merging with parallel fastHadd, $numThreads threads"
0115 
0116     $timecmd fastHadd -d add -j $numThreads -o $cumPBFileThreaded $(ls Merge*.pb) 2>&1 > /dev/null
0117 
0118     if [ $? -ne 0 ]; then
0119         exit $?
0120     fi
0121 
0122     return 0
0123 }
0124 
0125 convert() {
0126     echo "Converting back to ROOT format"
0127 
0128     fastHadd -d convert -o $cumPBFileThreaded_inROOT $cumPBFileThreaded 2>&1 > /dev/null
0129 
0130     if [ $? -ne 0 ]; then
0131         exit $?
0132     fi
0133 }
0134 
0135 check_fasthadd_parallel() {
0136     echo "Checking PB result... on ${cumPBFileThreaded_inROOT}"
0137 
0138     python3 ${LOCAL_TEST_DIR}/test_fastHaddMerge.py -a check -n $numFiles -c $cumPBFileThreaded_inROOT 2>&1 > /dev/null
0139 
0140     if [ $? -ne 0 ]; then
0141         exit $?
0142     fi
0143 
0144     return 0
0145 }
0146 
0147 set_up
0148 
0149 generate
0150 convertROOT2PB
0151 hadd_merge
0152 check_hadd
0153 fasthadd_merge
0154 convertPB2ROOT
0155 check_fasthadd
0156 fasthadd_parallel_merge
0157 convert
0158 check_fasthadd_parallel
0159 
0160 # Local Variables:
0161 # show-trailing-whitespace: t
0162 # truncate-lines: t
0163 # End: