Back to home page

Project CMSSW displayed by LXR

 
 

    


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

0001 #!/bin/bash
0002 
0003 source xeon_scripts/stress-test-common.sh
0004 
0005 ####################
0006 ## Core Test Loop ##
0007 ####################
0008 
0009 function MkFitThroughput ()
0010 {
0011     local test_exe=${1}
0012     local nproc=${2}
0013     local njob=${3}
0014     local tmp_output_file=${4}
0015 
0016     ## launch jobs in parallel to background : let scheduler put jobs all around
0017     for (( ijob = 0 ; ijob < ${njob} ; ijob++ ))
0018     do
0019         ## run the executable
0020         { time ${test_exe} --num-events ${nproc} > /dev/null 2>&1 ; } 2> "${tmp_output_file}.${ijob}" &
0021     done
0022 
0023     ## wait for all background processes to finish --> non-ideal as we would rather "stream" jobs launching
0024     wait
0025 }
0026 export -f MkFitThroughput
0027 
0028 ####################################
0029 ## Dump Tmp Output into Main File ##
0030 ####################################
0031 
0032 function DumpIntoFileThroughput ()
0033 {
0034     local tmp_output_file=${1}
0035     local output_file=${2}
0036 
0037     ## get wall-clock time, split
0038     total_time=0
0039     while read -ra time_arr
0040     do
0041         local tmp_time=${time_arr[1]}
0042         local mins=$( echo "${tmp_time}" | cut -d "m" -f 1 )
0043         local secs=$( echo "${tmp_time}" | cut -d "m" -f 2  | cut -d "s" -f 1 )
0044         local total_time=$( bc -l <<< "${total_time} + ${mins} * 60 + ${secs}" )
0045     done < <(fgrep "real" "${tmp_output_file}")
0046 
0047     ## get physical cores used
0048     local ncore=$( grep "${ncore_label}" "${tmp_output_file}" | cut -d " " -f 2 )
0049 
0050     ## compute total events processed per core
0051     local njob=$( grep "${nloop_label}" "${tmp_output_file}" | cut -d " " -f 2 )
0052     local nproc=$( grep "${nproc_label}" "${tmp_output_file}" | cut -d " " -f 2 )
0053 
0054     ## divide total events by time
0055     local throughput=$( bc -l <<< "(${njob} * ${nproc}) / ${total_time}" )
0056 
0057     ## dump result into final output file
0058     echo "${test_label} ${throughput}" >> "${output_file}"
0059 }
0060 export -f DumpIntoFileThroughput