Skip to content

Commit

Permalink
PR profiling: remove running of IgProf for memory and cpu profiling a…
Browse files Browse the repository at this point in the history
…nd remove running of JeProf for memory profiling. (#2415)

* PR profiling: remove running of igprof to speed up igprof jobs.

* Get correct order of arguments to resouces-diff.py

* Use pull request filename to set html name. Set BASENAME in second loop.

* Put back compareProducts.* so compareProducts.awk is copied
  • Loading branch information
gartung authored Jan 20, 2025
1 parent 5e4e255 commit 3f5f038
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 31 deletions.
16 changes: 8 additions & 8 deletions comparisons/resources-diff.py
Original file line number Diff line number Diff line change
Expand Up @@ -150,13 +150,13 @@ def diff_from(metrics, data, data_total, dest, dest_total, res):
"</tr>",
"<td>%s</td>" % prdata["total"]["type"],
"<td>%s</td>" % prdata["total"]["label"],
'<td align="right">%0.6f<br>%0.6f<br>%0.6f</td>'
'<td align="right">%0.2f<br>%0.2f<br>%0.2f</td>'
% (
prdata["total"]["time_real"],
ibdata["total"]["time_real"],
results["total"]["time_real_diff"],
),
'<td align="right">%0.6f<br>%0.6f<br>%0.6f</td>'
'<td align="right">%0.2f<br>%0.2f<br>%0.2f</td>'
% (
prdata["total"]["time_thread"],
ibdata["total"]["time_thread"],
Expand Down Expand Up @@ -212,26 +212,26 @@ def diff_from(metrics, data, data_total, dest, dest_total, res):
"<tr>",
"<td> %s</td>" % moduleres["type"],
"<td> %s</td>" % moduleres["label"],
'<td align="right"> %0.6f<br> %0.6f<br> %0.6f</td>'
'<td align="right"> %0.2f<br> %0.2f<br> %0.2f</td>'
% (
moduleib["time_real"],
modulepr["time_real"],
moduleres["time_real_diff"],
),
'<td align="right"> %0.6f%%<br> %0.6f%%<br> %0.6f%%</td>'
'<td align="right"> %0.2f%%<br> %0.2f%%<br> %0.2f%%</td>'
% (
moduleib["time_real_frac"],
modulepr["time_real_frac"],
moduleres["time_real_frac_diff"],
),
'<td align="right"> %0.6f<br> %0.6f<br> %0.6f</td>'
'<td align="right"> %0.2f<br> %0.2f<br> %0.2f</td>'
% (
moduleib["time_thread"],
modulepr["time_thread"],
moduleres["time_thread_diff"],
),
cellString
+ "%0.6f%%<br> %0.6f%%<br> %0.6f%%</td>"
+ "%0.2f%%<br> %0.2f%%<br> %0.2f%%</td>"
% (
moduleib["time_thread_frac"],
modulepr["time_thread_frac"],
Expand All @@ -249,11 +249,11 @@ def diff_from(metrics, data, data_total, dest, dest_total, res):
summaryLines += []
summaryLines += ["</body></html>"]

summaryFile = os.path.dirname(sys.argv[1]) + "/diff-" + os.path.basename(sys.argv[1]) + ".html"
summaryFile = os.path.dirname(sys.argv[2]) + "/diff-" + os.path.basename(sys.argv[2]) + ".html"
with open(summaryFile, "w") as g:
for summaryLine in summaryLines:
print(summaryLine, file=g)

dumpfile = os.path.dirname(sys.argv[1]) + "/diff-" + os.path.basename(sys.argv[1])
dumpfile = os.path.dirname(sys.argv[2]) + "/diff-" + os.path.basename(sys.argv[2])
with open(dumpfile, "w") as f:
json.dump(results, f, indent=2)
28 changes: 5 additions & 23 deletions pr_testing/run-pr-profiling.sh
Original file line number Diff line number Diff line change
Expand Up @@ -49,24 +49,13 @@ for PROFILING_WORKFLOW in $WORKFLOWS;do
b=$(basename $f)
cp -v $f $WORKSPACE/$CMSSW_VERSION/$PROFILING_WORKFLOW/$CMSSW_VERSION-$b || true
done
$WORKSPACE/profiling/Gen_tool/runall.sh $CMSSW_VERSION || true
$WORKSPACE/profiling/Gen_tool/runall_cpu.sh $CMSSW_VERSION || true
$WORKSPACE/profiling/Gen_tool/runall_mem_GC.sh $CMSSW_VERSION || true
$WORKSPACE/profiling/Gen_tool/runall_mem_JE.sh $CMSSW_VERSION || true
if [ ! -d $WORKSPACE/$CMSSW_VERSION/$PROFILING_WORKFLOW ] ; then
mark_commit_status_all_prs "profiling wf $PROFILING_WORKFLOW" 'success' -u "${BUILD_URL}" -d "Error: failed to run profiling"
echo "<li>$PROFILING_WORKFLOW: No such directory</li>" >> $WORKSPACE/upload/profiling/index-$PROFILING_WORKFLOW.html
PROF_RES="ERROR"
continue
fi
pushd $WORKSPACE/$CMSSW_VERSION/$PROFILING_WORKFLOW
$WORKSPACE/profiling/Gen_tool/profile_igpp.sh $CMSSW_VERSION || true
$WORKSPACE/profiling/Gen_tool/profile_igmp.sh $CMSSW_VERSION || true
$WORKSPACE/profiling/Gen_tool/profile_mem_jemalloc.sh $CMSSW_VERSION || true
echo "<li><a href=\"$PROFILING_WORKFLOW/\">$PROFILING_WORKFLOW/</a> </li>" >> $WORKSPACE/upload/profiling/index-$PROFILING_WORKFLOW.html
get_jenkins_artifacts igprof/${CMSSW_VERSION}/${SCRAM_ARCH}/profiling/${PROFILING_WORKFLOW}/RES_CPU_step3.txt ${CMSSW_VERSION}_RES_CPU_step3.txt || true
$WORKSPACE/profiling/Gen_tool/compare_cpu_txt.py --old ${CMSSW_VERSION}_RES_CPU_step3.txt --new RES_CPU_step3.txt > RES_CPU_compare_$PROFILING_WORKFLOW.txt || true
echo "<li><a href=\"$PROFILING_WORKFLOW/RES_CPU_compare_$PROFILING_WORKFLOW.txt\">Igprof Comparison cpu usage RECO produce methods.</a> </li>" >> $WORKSPACE/upload/profiling/index-$PROFILING_WORKFLOW.html
cp $WORKSPACE/cms-bot/comparisons/compareProducts.* ./
get_jenkins_artifacts igprof/${CMSSW_VERSION}/${SCRAM_ARCH}/profiling/${PROFILING_WORKFLOW}/step3_sizes_${PROFILING_WORKFLOW}.txt step3_sizes_${CMSSW_VERSION}_${PROFILING_WORKFLOW}.txt || true
if [ $(ls -d step3_sizes_${CMSSW_VERSION}_${PROFILING_WORKFLOW}.txt | wc -l) -gt 0 ]; then
Expand All @@ -91,17 +80,7 @@ for PROFILING_WORKFLOW in $WORKFLOWS;do
fi #DEBUG
popd
pushd $WORKSPACE/$CMSSW_VERSION || true
for f in $(find $PROFILING_WORKFLOW -type f -name '*.sql3') ; do
d=$(dirname $f)
mkdir -p $WORKSPACE/upload/profiling/$d || true
cp -p $f $WORKSPACE/upload/profiling/$d/ || true
mkdir -p $LOCALREL/igprof/${CMSSW_VERSION}/${SCRAM_ARCH}/profiling/${PROFILING_WORKFLOW}/${UPLOAD_UNIQ_ID} || true
BASENAME=$(basename $f)
ln -s /data/sdt/SDT/jenkins-artifacts/pull-request-integration/${UPLOAD_UNIQ_ID}/profiling/$d/$BASENAME $LOCALREL/igprof/${CMSSW_VERSION}/${SCRAM_ARCH}/profiling/${PROFILING_WORKFLOW}/${UPLOAD_UNIQ_ID}/$BASENAME || true
ls -l $WORKSPACE/igprof/${CMSSW_VERSION}/${SCRAM_ARCH}/profiling/${PROFILING_WORKFLOW}/${UPLOAD_UNIQ_ID}/$BASENAME || true
echo "<li><a href=\"https://cmssdt.cern.ch/SDT/cgi-bin/igprof-navigator/${CMSSW_VERSION}/${SCRAM_ARCH}/profiling/${PROFILING_WORKFLOW}/${UPLOAD_UNIQ_ID}/${BASENAME//.sql3/}\"> $(basename $f)</a> </li>" >> $WORKSPACE/upload/profiling/index-$PROFILING_WORKFLOW.html
done
for f in $(find $PROFILING_WORKFLOW -type f -name 'step*.json' ) ; do
for f in $(find $PROFILING_WORKFLOW -type f -name '*step*_cpu.resources.json' ) ; do
d=$(dirname $f)
mkdir -p $WORKSPACE/upload/profiling/$d || true
cp -p $f $WORKSPACE/upload/profiling/$d/ || true
Expand All @@ -112,7 +91,10 @@ for PROFILING_WORKFLOW in $WORKFLOWS;do
ls -l $LOCALREL/profiling/${CMSSW_VERSION}/${SCRAM_ARCH}/${PROFILING_WORKFLOW}/${UPLOAD_UNIQ_ID}/$BASENAME || true
AMP="&"
echo "<li><a href=\"https://cmssdt.cern.ch/circles/web/piechart.php?data_name=profiling${AMP}filter=${CMSSW_VERSION}${AMP}local=false${AMP}dataset=${CMSSW_VERSION}/${SCRAM_ARCH}/${PROFILING_WORKFLOW}/${UPLOAD_UNIQ_ID}/${BASENAME//.json/}${AMP}resource=time_thread${AMP}colours=default${AMP}groups=reco_PhaseII${AMP}threshold=0\">$BASENAME</a></li>" >> $WORKSPACE/upload/profiling/index-$PROFILING_WORKFLOW.html
$CMS_BOT_DIR/comparisons/resources-diff.py $f $PROFILING_WORKFLOW/$CMSSW_VERSION-$BASENAME >$f.log || true
done
for f in $(find $PROFILING_WORKFLOW -type f -name 'step*_cpu.resources.json' ) ; do
BASENAME=$(basename $f)
$CMS_BOT_DIR/comparisons/resources-diff.py $PROFILING_WORKFLOW/$CMSSW_VERSION-$BASENAME $f >$f.log || true
echo "<li><a href=\"${PROFILING_WORKFLOW}/diff-$BASENAME.html\">diff-$BASENAME</a></li>" >> $WORKSPACE/upload/profiling/index-$PROFILING_WORKFLOW.html || true
done
for f in $(find $PROFILING_WORKFLOW -type f -name '*.log' -o -name '*.txt' -o -name '*.tmp' -o -name '*.heap*' -o -name '*.json' -o -name '*.html') ; do
Expand Down

0 comments on commit 3f5f038

Please sign in to comment.