Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-04-06 12:28:25

0001 #! /bin/bash
0002 
0003 ###########
0004 ## Input ##
0005 ###########
0006 
0007 ben_arch=${1} # SNB, KNL, SKL-SP
0008 suite=${2:-"forPR"} # which set of benchmarks to run: full, forPR, forConf
0009 useARCH=${3:-0}
0010 lnxuser=${4:-${USER}}
0011 
0012 ###################
0013 ## Configuration ##
0014 ###################
0015 
0016 ## Source environment and common variables
0017 source xeon_scripts/common-variables.sh ${suite} ${useARCH} ${lnxuser}
0018 source xeon_scripts/init-env.sh
0019 
0020 ## Platform specific settings
0021 if [[ "${ben_arch}" == "SNB" ]]
0022 then
0023     mOpt="-j 12"
0024     maxth=24
0025     maxvu=8
0026     declare -a nths=("1" "2" "4" "6" "8" "12" "16" "20" "24")
0027     declare -a nvus=("1" "2" "4" "8")
0028     declare -a nevs=("1" "2" "4" "8" "12")
0029 elif [[ "${ben_arch}" == "KNL" ]]
0030 then
0031     mOpt="-j 64 AVX_512:=1"
0032     maxth=256
0033     maxvu=16
0034     declare -a nths=("1" "2" "4" "8" "16" "32" "64" "96" "128" "160" "192" "224" "256")
0035     declare -a nvus=("1" "2" "4" "8" "16")
0036     declare -a nevs=("1" "2" "4" "8" "16" "32" "64" "128")
0037 elif [[ "${ben_arch}" == "SKL-SP" ]]
0038 then
0039     mOpt="-j 32 AVX_512:=1"
0040     maxth=64
0041     maxvu=16
0042     declare -a nths=("1" "2" "4" "8" "16" "32" "48" "64")
0043     declare -a nvus=("1" "2" "4" "8" "16")
0044     declare -a nevs=("1" "2" "4" "8" "16" "32" "64")
0045 elif [[ "${ben_arch}" == "LNX-G" ]]
0046 then 
0047     mOpt="-j 32 AVX_512:=1"
0048     maxth=64
0049     maxvu=16
0050     declare -a nths=("1" "2" "4" "8" "16" "32" "48" "64")
0051     declare -a nvus=("1" "2" "4" "8" "16")
0052     declare -a nevs=("1" "2" "4" "8" "16" "32" "64")
0053 elif [[ "${ben_arch}" == "LNX-S" ]]
0054 then 
0055     mOpt="-j 32 AVX_512:=1"
0056     maxth=64
0057     maxvu=16
0058     declare -a nths=("1" "2" "4" "8" "16" "32" "48" "64")
0059     declare -a nvus=("1" "2" "4" "8" "16")
0060     declare -a nevs=("1" "2" "4" "8" "16" "32" "64")
0061 else 
0062     echo ${ben_arch} "is not a valid architecture! Exiting..."
0063     exit
0064 fi
0065 
0066 ## Common file setup
0067 dir=/data2/slava77/samples/
0068 subdir=2021/11834.0_TTbar_14TeV+2021/AVE_50_BX01_25ns/
0069 file=memoryFile.fv6.default.211008-c6b7c67.bin
0070 nevents=20
0071 
0072 ## Common executable setup
0073 minth=1
0074 minvu=1
0075 seeds="--cmssw-n2seeds"
0076 exe="./mkFit/mkFit ${seeds} --input-file ${dir}/${subdir}/${file}"
0077 
0078 ## Common output setup
0079 dump=DumpForPlots
0080 base=${ben_arch}_${sample}
0081 
0082 ####################
0083 ## Run Benchmarks ##
0084 ####################
0085 
0086 ## compile with appropriate options
0087 make distclean ${mOpt}
0088 make ${mOpt}
0089 
0090 ## Parallelization Benchmarks
0091 for nth in "${nths[@]}"
0092 do
0093     for build in "${th_builds[@]}"
0094     do echo ${!build} | while read -r bN bO
0095         do
0096             ## Base executable
0097             oBase=${base}_${bN}
0098             bExe="${exe} --build-${bO} --num-thr ${nth}"
0099 
0100             ## Building-only benchmark
0101             echo "${oBase}: Benchmark [nTH:${nth}, nVU:${maxvu}int]"
0102             ${bExe} --num-events ${nevents} >& log_${oBase}_NVU${maxvu}int_NTH${nth}.txt
0103 
0104             ## Multiple Events in Flight benchmark
0105             check_meif=$( CheckIfMEIF ${build} )
0106             if [[ "${check_meif}" == "true" ]]
0107             then
0108                 for nev in "${nevs[@]}"
0109                 do
0110                     if (( ${nev} <= ${nth} ))
0111                     then
0112                         nproc=$(( ${nevents} * ${nev} ))
0113                         echo "${oBase}: Benchmark [nTH:${nth}, nVU:${maxvu}int, nEV:${nev}]"
0114                         ${bExe} --silent --num-thr-ev ${nev} --num-events ${nproc} --remove-dup --use-dead-modules --backward-fit >& log_${oBase}_NVU${maxvu}int_NTH${nth}_NEV${nev}.txt
0115                     fi
0116                 done
0117             fi
0118 
0119             ## nHits validation
0120             check_text=$( CheckIfText ${build} )
0121             if (( ${nth} == ${maxth} )) && [[ "${check_text}" == "true" ]]
0122             then
0123                 echo "${oBase}: Text dump for plots [nTH:${nth}, nVU:${maxvu}int]"
0124                 ${bExe} --dump-for-plots --quality-val --read-cmssw-tracks --num-events ${nevents} --remove-dup --use-dead-modules --backward-fit >& log_${oBase}_NVU${maxvu}int_NTH${nth}_${dump}.txt
0125             fi
0126         done
0127     done
0128 done
0129 
0130 ## Vectorization Benchmarks
0131 for nvu in "${nvus[@]}"
0132 do
0133     make clean ${mOpt}
0134     make ${mOpt} USE_INTRINSICS:=-DMPT_SIZE=${nvu}
0135 
0136     for build in "${vu_builds[@]}"
0137     do echo ${!build} | while read -r bN bO
0138         do
0139             ## Common base executable
0140             oBase=${base}_${bN}
0141             bExe="${exe} --build-${bO} --num-thr ${minth} --num-events ${nevents}"
0142 
0143             ## Building-only benchmark
0144             echo "${oBase}: Benchmark [nTH:${minth}, nVU:${nvu}]"
0145             ${bExe} >& log_${oBase}_NVU${nvu}_NTH${minth}.txt
0146 
0147             ## nHits validation
0148             check_text=$( CheckIfText ${build} )
0149             if (( ${nvu} == ${minvu} )) && [[ "${check_text}" == "true" ]]
0150             then
0151                 echo "${oBase}: Text dump for plots [nTH:${minth}, nVU:${nvu}]"
0152                 ${bExe} --dump-for-plots --quality-val --read-cmssw-tracks >& log_${oBase}_NVU${nvu}_NTH${minth}_${dump}.txt
0153             fi
0154         done
0155     done
0156 done
0157 
0158 ## Final cleanup
0159 make distclean ${mOpt}
0160 
0161 ## Final message
0162 echo "Finished compute benchmarks on ${ben_arch}!"