Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2022-02-21 23:14:25

0001 #!/bin/bash
0002 
0003 source xeon_scripts/init-env.sh
0004 source xeon_scripts/throughput-test-common.sh
0005 
0006 ben_arch=${1} # SNB (phi1), KNL (phi2), SKL-SP (phi3)
0007 
0008 if [[ "${ben_arch}" == "KNL" ]]
0009 then
0010     mOpt="-j 64"
0011     maxcore=64
0012     declare -a instruction_sets=(AVX512)
0013     declare -a thread_combo_arr=("1 1" "2 2" "4 4" "8 8" "16 16" "32 32" "64 64" "128 128" "256 256")
0014 elif [[ "${ben_arch}" == "SKL-SP" ]]
0015 then
0016     mOpt="-j 32"
0017     maxcore=32
0018     declare -a instruction_sets=(AVX512)
0019     declare -a thread_combo_arr=("1 1" "2 2" "4 4" "8 8" "16 16" "32 32" "64 64")
0020 elif [[ "${ben_arch}" == "LNX-G" ]]
0021 then
0022     mOpt="-j 32"
0023     maxcore=32
0024     declare -a instruction_sets=(AVX512)
0025     declare -a thread_combo_arr=("1 1" "2 2" "4 4" "8 8" "16 16" "32 32" "64 64")
0026 elif [[ "${ben_arch}" == "LNX-S" ]]
0027 then
0028     mOpt="-j 32"
0029     maxcore=32
0030     declare -a instruction_sets=(AVX512)
0031     declare -a thread_combo_arr=("1 1" "2 2" "4 4" "8 8" "16 16" "32 32" "64 64")
0032 else
0033     echo "${ben_arch} is not a valid architecture! Exiting..."
0034     exit
0035 fi
0036 
0037 
0038 ## Common file setup
0039 dir=/data2/slava77/samples/
0040 subdir=2021/11834.0_TTbar_14TeV+2021/AVE_50_BX01_25ns/
0041 file=memoryFile.fv6.default.211008-c6b7c67.bin
0042 #base_nevents=20 # 7/2 seconds
0043 base_nevents=2000 # 30/10 minutes
0044 
0045 ## Common mkFit options
0046 seeds="--cmssw-n2seeds"
0047 algo="--build-ce"
0048 opts="--silent --loop-over-file --remove-dup --use-dead-modules --backward-fit"
0049 base_exe="./mkFit/mkFit --input-file ${dir}/${subdir}/${file} ${seeds} ${algo} ${opts}"
0050 
0051 ## Output options
0052 base_outname="throughput"
0053 output_file="${base_outname}_results.${ext}"
0054 
0055 ###############
0056 ## Run tests ##
0057 ###############
0058 
0059 ## loop instruction sets (i.e. build minimally)
0060 for instruction_set in "${instruction_sets[@]}"
0061 do
0062     ## compile once, using settings for the given instruction set
0063     make distclean
0064     make ${mOpt} ${!instruction_set}
0065 
0066     echo "Ensuring the input file is fully in the memory caches"
0067     dd if=${dir}/${subdir}/${file} of=/dev/null bs=10M
0068     dd if=${dir}/${subdir}/${file} of=/dev/null bs=10M
0069     dd if=${dir}/${subdir}/${file} of=/dev/null bs=10M
0070     dd if=${dir}/${subdir}/${file} of=/dev/null bs=10M
0071 
0072     ## run thread combo tests (nThreads, nEventsInFlight)
0073     for thread_combo in "${thread_combo_arr[@]}"
0074     do echo "${thread_combo}" | while read -r nth nev
0075         do
0076             ## compute total number of events to process
0077             ncore=${nth}
0078             nproc=$(( ${base_nevents} * ${ncore} ))
0079 
0080             ## print out which test is being performed
0081             test_label="${instruction_set}_${nth_label}${nth}_${nev_label}${nev}"
0082             echo "$(date) Running throughput test for: ${test_label}..."
0083 
0084             ## test executable
0085             test_exe="${base_exe} --num-thr ${nth} --num-thr-ev ${nev}"
0086 
0087             ## output file
0088             tmp_output_file="${base_outname}_${test_label}.${tmp_ext}"
0089 
0090             ## execute test
0091             MkFitThroughput "${test_exe}" "${nproc}" "1" "${tmp_output_file}"
0092             cat ${tmp_output_file}.* > ${tmp_output_file}
0093 
0094             ## add other info about test to tmp file
0095             AppendTmpFile "${tmp_output_file}" "${ncore}" "${nproc}" "1"
0096 
0097 
0098             ## run a test of N jobs, single thread each
0099             njob=${nth}
0100 
0101             ## print out which test is being performed
0102             test_label="${instruction_set}_${njob_label}${njob}"
0103             echo "$(date) Running throughput test for: ${test_label}..."
0104 
0105             ## test executable
0106             test_exe="${base_exe} --num-thr 1 --num-thr-ev 1"
0107 
0108             ## output file
0109             tmp_output_file="${base_outname}_${test_label}.${tmp_ext}"
0110 
0111             ## execute test
0112             MkFitThroughput "${test_exe}" "${base_nevents}" "${njob}" "${tmp_output_file}"
0113             cat ${tmp_output_file}.* > ${tmp_output_file}
0114 
0115             ## add other info about test to tmp file
0116             AppendTmpFile "${tmp_output_file}" "1" "${nproc}" "${njob}"
0117 
0118         done # end loop over reading thread combo
0119     done # end loop over thread combos
0120 
0121 done # end loop over instruction set
0122 
0123 #######################
0124 ## Make Final Output ##
0125 #######################
0126 
0127 ## init output file
0128 > "${output_file}"
0129 echo -e "Throughput test meta-data\n" >> "${output_file}"
0130 echo "ben_arch: ${ben_arch}" >> "${output_file}"
0131 echo "base_exe: ${base_exe}" >> "${output_file}"
0132 echo "base_nevents: ${base_nevents}" >> "${output_file}"
0133 echo -e "\nResults (events/s)\n" >> "${output_file}"
0134 
0135 ## loop over all output files, and append results to single file
0136 for instruction_set in "${instruction_sets[@]}"
0137 do
0138     ## loop over nThread/MEIF tests, and append to single file
0139     for thread_combo in "${thread_combo_arr[@]}"
0140     do echo "${thread_combo}" | while read -r nth nev
0141         do
0142             ## get test label, print it
0143             test_label="${instruction_set}_${nth_label}${nth}_${nev_label}${nev}"
0144             echo "Computing time for: ${test_label}"
0145 
0146             ## get tmp output file name
0147             tmp_output_file="${base_outname}_${test_label}.${tmp_ext}"
0148 
0149             ## dump into output file
0150             DumpIntoFileThroughput "${tmp_output_file}" "${output_file}"
0151 
0152 
0153             njob=${nth}
0154             ## get test label, print it
0155             test_label="${instruction_set}_${njob_label}${njob}"
0156             echo "Computing time for: ${test_label}"
0157 
0158             ## get tmp output file name
0159             tmp_output_file="${base_outname}_${test_label}.${tmp_ext}"
0160 
0161             ## dump into output file
0162             DumpIntoFileThroughput "${tmp_output_file}" "${output_file}"
0163 
0164         done # end loop over reading thread combo
0165     done # end loop over thread combos
0166 done # end loop over instruction set
0167 
0168 #########################################
0169 ## Clean up and Restore Default Status ##
0170 #########################################
0171 
0172 make distclean
0173 
0174 ###################
0175 ## Final Message ##
0176 ###################
0177 
0178 echo "$(date) Finished throughput test!"