Skip to content
Snippets Groups Projects
Commit 937dc991 authored by Domenico Giordano's avatar Domenico Giordano
Browse files

Merge branch 'BMK-150' into 'qa'

Resolve BMK-150

Closes BMK-150

See merge request hep-benchmarks/hep-workloads!252
parents c1c5b399 3f13428e
No related branches found
No related tags found
2 merge requests!255Author list,!252Resolve BMK-150
......@@ -36,6 +36,25 @@ function doOne(){
return $status
}
function getEvents(){
export CMSSW_RELEASE=CMSSW_10_2_9
export VO_CMS_SW_DIR=/cvmfs/cms.cern.ch
source $VO_CMS_SW_DIR/cmsset_default.sh
export SCRAM_ARCH=slc6_amd64_gcc700
[[ ! -e ${CMSSW_RELEASE} ]] && scram project CMSSW ${CMSSW_RELEASE} &> /dev/null
(pushd ${CMSSW_RELEASE}; eval `scramv1 runtime -sh`; popd) &> /dev/null
ln -s ${BMKDIR}/data/*.root .
evts=`python -c "import ROOT;f=ROOT.TFile.Open('gensim.root');print f.Get('Events').GetEntries();"`
STATUS=$?
rm -rf ${CMSSW_RELEASE}
rm -f gensim.root
if [[ $STATUS != 0 ]] ; then
return 0
else
return $evts
fi
}
# Optional function validateInputArguments may be defined in each benchmark
# If it exists, it is expected to set NCOPIES, NTHREADS, NEVENTS_THREAD
# (based on previous defaults and on user inputs USER_NCOPIES, USER_NTHREADS, USER_NEVENTS_THREADS)
......@@ -59,6 +78,17 @@ function validateInputArguments(){
fi
# Number of events per thread
if [ "$USER_NEVENTS_THREAD" != "" ]; then NEVENTS_THREAD=$USER_NEVENTS_THREAD; fi
# Extract number of events in input file
getEvents
evts=$?
if [[ $evts == 0 ]] ; then
s_msg="[ERROR] Cannot extract number of events from input file"
return 1
fi
if [[ $((NEVENTS_THREAD * NTHREADS)) -gt $evts ]] ; then
s_msg="[ERROR] Requested number of events ($((NEVENTS_THREAD * NTHREADS))) exceeds number of input events ($evts)"
return 1
fi
# Return 0 if input arguments are valid, 1 otherwise
# Report any issues to parseResults via s_msg
export s_msg="ok"
......
function generateSummary(){
echo -e "{\"copies\":$NCOPIES , \"threads_per_copy\":$NTHREADS , \"events_per_thread\" : $NEVENTS_THREAD , \"wl-scores\": $res_score, \"wl-stats\": {\"throughput_score\": $res_thr , \"CPU_score\": $res_cpu }, \"log\": \"${s_msg}\", \"app\": `cat $BMKDIR/version.json` }" > ${APP}_summary.json
echo -e "{\"copies\":$NCOPIES , \"threads_per_copy\":$NTHREADS , \"events_per_thread\" : $nevt_thr , \"wl-scores\": $res_score, \"wl-stats\": {\"throughput_score\": $res_thr , \"CPU_score\": $res_cpu }, \"log\": \"${s_msg}\", \"app\": `cat $BMKDIR/version.json` }" > ${APP}_summary.json
cat ${APP}_summary.json
}
......@@ -33,23 +33,23 @@ function parseResults(){
#-----------------------
echo "[parseResults] parsing results from" proc_*/out_*.log
# Documentation of cmssw time report at https://github.com/cms-sw/cmssw/blob/09c3fce6626f70fd04223e7dacebf0b485f73f54/FWCore/Services/plugins/Timing.cc#L240
# Parsing Event Throughput: xxxx ev/s
res_thr=`grep -H "Event Throughput" proc_*/out_*.log | sed -e "s@[^:]*: Event Throughput: \([ 0-9\.]*\) ev/s@\1@" | awk 'BEGIN{amin=1000000;amax=0;count=0;} { val=$1; a[count]=val; count+=1; sum+=val; if(amax<val) amax=val; if(amin>val) amin=val} END{n = asort(a); if (n % 2) { median=a[(n + 1) / 2]; } else {median=(a[(n / 2)] + a[(n / 2) + 1]) / 2.0;};
printf "{\"score\": %.4f, \"avg\": %.4f, \"median\": %.4f, \"min\": %.4f, \"max\": %.4f}", sum, sum/count, median, amin, amax
}' nevt=$NEVENTS_THREAD nthread=$NTHREADS || (echo "{}"; return 1)`
# Parsing Number of Events
nevt_thr=`grep -h "Number of Events" proc_*/out_*.log | sed -e "s@.*:\([ 0-9\.]*\).*@\1@" | awk 'BEGIN{n=0; count=0;} {n+=$1; count+=1} END{print n/count/nthreads}' nthreads=$NTHREADS || (echo "{}"; return 1)`
STATUS_1=$?
#Duplicating above parsing, as quick and dirty. SHoudl be replaced by a python parser
res_score=`grep -H "Event Throughput" proc_*/out_*.log | sed -e "s@[^:]*: Event Throughput: \([ 0-9\.]*\) ev/s@\1@" | awk 'BEGIN{amin=1000000;amax=0;count=0;} { val=$1; a[count]=val; count+=1; sum+=val; if(amax<val) amax=val; if(amin>val) amin=val} END{n = asort(a); if (n % 2) { median=a[(n + 1) / 2]; } else {median=(a[(n / 2)] + a[(n / 2) + 1]) / 2.0;};
printf "{\"digi\": %.4f}", sum
}' nevt=$NEVENTS_THREAD nthread=$NTHREADS || (echo "{}"; return 1)`
# Parsing Event Throughput: xxxx ev/s
res_thr=`grep -H "Event Throughput" proc_*/out_*.log | sed -e "s@[^:]*: Event Throughput: \([ 0-9\.]*\) ev/s@\1@" | awk 'BEGIN{amin=1000000;amax=0;count=0;} { val=$1; a[count]=val; count+=1; sum+=val; if(amax<val) amax=val; if(amin>val) amin=val} END{n = asort(a); if (n % 2) { median=a[(n + 1) / 2]; } else {median=(a[(n / 2)] + a[(n / 2) + 1]) / 2.0;}; printf "{\"score\": %.4f, \"avg\": %.4f, \"median\": %.4f, \"min\": %.4f, \"max\": %.4f}", sum, sum/count, median, amin, amax}' || (echo "{}"; return 1)`
STATUS_2=$?
#Duplicating above parsing, as quick and dirty. Should be replaced by a python parser
res_score=`grep -H "Event Throughput" proc_*/out_*.log | sed -e "s@[^:]*: Event Throughput: \([ 0-9\.]*\) ev/s@\1@" | awk 'BEGIN{amin=1000000;amax=0;count=0;} { val=$1; a[count]=val; count+=1; sum+=val; if(amax<val) amax=val; if(amin>val) amin=val} END{n = asort(a); if (n % 2) { median=a[(n + 1) / 2]; } else {median=(a[(n / 2)] + a[(n / 2) + 1]) / 2.0;}; printf "{\"digi\": %.4f}", sum}' || (echo "{}"; return 1)`
STATUS_3=$?
# Parsing CPU Summary: \n- Total loop:: xxxx seconds of all CPUs
res_cpu=`grep -H -A2 "CPU Summary" proc_*/out_*.log | grep "Total loop" | sed -e "s@.*\sTotal loop: \([ 0-9\.]*\)@\1@" | awk 'BEGIN{amin=1000000;amax=0;count=0;} { val=nevt*nthread/$1; a[count]=val; count+=1; sum+=val; if(amax<val) amax=val; if(amin>val) amin=val} END{n = asort(a); if (n % 2) {median=a[(n + 1) / 2]; } else {median=(a[(n / 2)] + a[(n / 2) + 1]) / 2.0;};
printf "{\"score\": %.4f, \"avg\": %.4f, \"median\": %.4f, \"min\": %.4f, \"max\": %.4f}", sum, sum/count, median, amin, amax
}' nevt=$NEVENTS_THREAD nthread=$NTHREADS || (echo "{}"; return 1)`
STATUS_2=$?
[[ "$STATUS_1" == "0" ]] && [[ "$STATUS_2" == "0" ]]
res_cpu=`grep -H -A2 "CPU Summary" proc_*/out_*.log | grep "Total loop" | sed -e "s@.*\sTotal loop: \([ 0-9\.]*\)@\1@" | awk 'BEGIN{amin=1000000;amax=0;count=0;} { val=nevt*nthreads/$1; a[count]=val; count+=1; sum+=val; if(amax<val) amax=val; if(amin>val) amin=val} END{n = asort(a); if (n % 2) {median=a[(n + 1) / 2]; } else {median=(a[(n / 2)] + a[(n / 2) + 1]) / 2.0;}; printf "{\"score\": %.4f, \"avg\": %.4f, \"median\": %.4f, \"min\": %.4f, \"max\": %.4f}", sum, sum/count, median, amin, amax}' nevt=$nevt_thr nthreads=$NTHREADS || (echo "{}"; return 1)`
STATUS_4=$?
[[ "$STATUS_1" == "0" ]] && [[ "$STATUS_2" == "0" ]] && [[ "$STATUS_3" == "0" ]] && [[ "$STATUS_4" == "0" ]]
STATUS=$?
[[ "$STATUS" != "0" ]] && export s_msg="ERROR"
echo "[parseResults] parsing completed (status=$STATUS)"
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment