Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add build-time publish step to cpu build script #9927

Merged
merged 38 commits into from
Jan 10, 2022
Merged
Show file tree
Hide file tree
Changes from 33 commits
Commits
Show all changes
38 commits
Select commit Hold shift + click to select a range
f72218e
Add build-time publish step to cpu build script
davidwendt Dec 17, 2021
fc00e28
remove unneeded xml copy
davidwendt Dec 17, 2021
8b0b888
temporarily clear ccache
davidwendt Dec 17, 2021
92825d0
remove ccache clear
davidwendt Dec 17, 2021
d390db1
broke something; trying again
davidwendt Dec 17, 2021
b636402
add some debug output messages
davidwendt Dec 17, 2021
e1222f2
remove copy metrics after libcudf pkg
davidwendt Dec 17, 2021
aec614f
searching for log html
davidwendt Dec 17, 2021
1aa0ff5
found ninja-log html file
davidwendt Dec 17, 2021
fe3c2e7
temp clear ccache again
davidwendt Dec 18, 2021
7db99ac
add style to table elements
davidwendt Dec 18, 2021
f6f328b
testing output table style
davidwendt Dec 18, 2021
9b36a49
going old school since jenkins does not support custom html styles
davidwendt Dec 18, 2021
5cb6848
retry with cleared cache
davidwendt Dec 18, 2021
f5e38d2
fix summary table
davidwendt Dec 19, 2021
5e1360e
add some build info to the output
davidwendt Dec 19, 2021
17adcf7
convert 4 ranges to 3
davidwendt Dec 19, 2021
e2826a0
remove ccache clear
davidwendt Dec 19, 2021
82ce7c3
fix env var cmd
davidwendt Dec 19, 2021
62291f0
try getting env vars again
davidwendt Dec 20, 2021
c92ade8
fix script again
davidwendt Dec 20, 2021
0f2bd3b
remove unresolved message vars
davidwendt Dec 20, 2021
ce222a9
test recompile-everything technique
davidwendt Dec 20, 2021
f91343e
report cache hit rate
davidwendt Dec 20, 2021
fad7cf2
check cache hit rate
davidwendt Dec 20, 2021
8033c58
Merge branch 'branch-22.02' into build-time-publish-html
davidwendt Dec 20, 2021
e0666d1
remove temporary recompile test
davidwendt Dec 21, 2021
192e0f1
remove commented out code
davidwendt Dec 22, 2021
42d37a8
Merge branch 'branch-22.02' into build-time-publish-html
davidwendt Jan 4, 2022
226d355
Merge branch 'branch-22.02' into build-time-publish-html
davidwendt Jan 4, 2022
40d0479
add libcudf.so size to metrics output
davidwendt Jan 5, 2022
01c0a3b
report libcudf.so size only if found
davidwendt Jan 5, 2022
0a03c23
add build-metrics parameters to build.sh
davidwendt Jan 6, 2022
8c1f89a
Merge branch 'branch-22.02' into build-time-publish-html
davidwendt Jan 6, 2022
3b840d4
reset metrics defaults to OFF
davidwendt Jan 7, 2022
18f2990
pass new parameters to build.sh
davidwendt Jan 7, 2022
06f9d50
remove debugging echo statements
davidwendt Jan 7, 2022
6e1b79b
Merge branch 'branch-22.02' into build-time-publish-html
davidwendt Jan 7, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
40 changes: 34 additions & 6 deletions build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,8 @@ HELP="$0 [clean] [libcudf] [cudf] [dask_cudf] [benchmarks] [tests] [libcudf_kafk
--disable_nvtx - disable inserting NVTX profiling ranges
--show_depr_warn - show cmake deprecation warnings
--ptds - enable per-thread default stream
--build_metrics - generate build metrics report for libcudf
davidwendt marked this conversation as resolved.
Show resolved Hide resolved
--incl_cache_stats - include cache statistics in build metrics report
--cmake-args=\\\"<args>\\\" - pass arbitrary list of CMake configuration options (escape all quotes in argument)
-h | --h[elp] - print this text

Expand All @@ -61,6 +63,8 @@ BUILD_NVTX=ON
BUILD_TESTS=OFF
BUILD_DISABLE_DEPRECATION_WARNING=ON
BUILD_PER_THREAD_DEFAULT_STREAM=OFF
BUILD_REPORT_METRICS=ON
BUILD_REPORT_INCL_CACHE_STATS=ON

# Set defaults for vars that may not have been defined externally
# FIXME: if INSTALL_PREFIX is not set, check PREFIX, then check
Expand Down Expand Up @@ -144,6 +148,14 @@ fi
if hasArg --ptds; then
BUILD_PER_THREAD_DEFAULT_STREAM=ON
fi
if hasArg --build_metrics; then
BUILD_REPORT_METRICS=ON
fi

if hasArg --incl_cache_stats; then
BUILD_REPORT_INCL_CACHE_STATS=ON
fi


# If clean given, run it prior to any other steps
if hasArg clean; then
Expand Down Expand Up @@ -174,8 +186,11 @@ if buildAll || hasArg libcudf; then

# get the current count before the compile starts
FILES_IN_CCACHE=""
if [ -x "$(command -v ccache)" ]; then
if [[ "$BUILD_REPORT_INCL_CACHE_STATS"=="ON" && -x "$(command -v ccache)" ]]; then
FILES_IN_CCACHE=$(ccache -s | grep "files in cache")
echo "$FILES_IN_CCACHE"
# zero the ccache statistics
ccache -z
fi

cmake -S $REPODIR/cpp -B ${LIB_BUILD_DIR} \
Expand All @@ -189,6 +204,7 @@ if buildAll || hasArg libcudf; then
-DCMAKE_BUILD_TYPE=${BUILD_TYPE} \
${CMAKE_ARGS}

echo "LIB_BUILD_DIR=$LIB_BUILD_DIR"
cd ${LIB_BUILD_DIR}

compile_start=$(date +%s)
Expand All @@ -197,12 +213,24 @@ if buildAll || hasArg libcudf; then
compile_total=$(( compile_end - compile_start ))

# Record build times
if [[ -f "${LIB_BUILD_DIR}/.ninja_log" ]]; then
echo "Formatting build times"
if [[ "$BUILD_REPORT_METRICS"=="ON" && -f "${LIB_BUILD_DIR}/.ninja_log" ]]; then
echo "Formatting build metrics"
python ${REPODIR}/cpp/scripts/sort_ninja_log.py ${LIB_BUILD_DIR}/.ninja_log --fmt xml > ${LIB_BUILD_DIR}/ninja_log.xml
message="$FILES_IN_CCACHE <p>$PARALLEL_LEVEL parallel build time is $compile_total seconds"
echo "$message"
python ${REPODIR}/cpp/scripts/sort_ninja_log.py ${LIB_BUILD_DIR}/.ninja_log --fmt html --msg "$message" > ${LIB_BUILD_DIR}/ninja_log.html
MSG="<p>"
robertmaynard marked this conversation as resolved.
Show resolved Hide resolved
# get some ccache stats after the compile
if [[ "$BUILD_REPORT_INCL_CACHE_STATS"=="ON" && -x "$(command -v ccache)" ]]; then
MSG="${MSG}<br/>$FILES_IN_CCACHE"
HIT_RATE=$(ccache -s | grep "cache hit rate")
MSG="${MSG}<br/>${HIT_RATE}"
fi
MSG="${MSG}<br/>parallel setting: $PARALLEL_LEVEL"
MSG="${MSG}<br/>parallel build time: $compile_total seconds"
if [[ -f "${LIB_BUILD_DIR}/libcudf.so" ]]; then
LIBCUDF_FS=$(ls -lh ${LIB_BUILD_DIR}/libcudf.so | awk '{print $5}')
MSG="${MSG}<br/>libcudf.so size: $LIBCUDF_FS"
fi
echo "$MSG"
python ${REPODIR}/cpp/scripts/sort_ninja_log.py ${LIB_BUILD_DIR}/.ninja_log --fmt html --msg "$MSG" > ${LIB_BUILD_DIR}/ninja_log.html
fi

if [[ ${INSTALL_TARGET} != "" ]]; then
Expand Down
8 changes: 8 additions & 0 deletions ci/cpu/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,14 @@ if [ "$BUILD_LIBCUDF" == '1' ]; then
mkdir -p ${CONDA_BLD_DIR}/libcudf/work
cp -r ${CONDA_BLD_DIR}/work/* ${CONDA_BLD_DIR}/libcudf/work

# Copy libcudf build metrics results
LIBCUDF_BUILD_DIR=$CONDA_BLD_DIR/libcudf/work/cpp/build
echo "Checking for build metrics log $LIBCUDF_BUILD_DIR/ninja_log.html"
if [[ -f "$LIBCUDF_BUILD_DIR/ninja_log.html" ]]; then
gpuci_logger "Copying build metrics results"
mkdir -p "$WORKSPACE/build-metrics"
cp "$LIBCUDF_BUILD_DIR/ninja_log.html" "$WORKSPACE/build-metrics/BuildMetrics.html"
fi

gpuci_logger "Build conda pkg for libcudf_kafka"
gpuci_conda_retry build --no-build-id --croot ${CONDA_BLD_DIR} conda/recipes/libcudf_kafka $CONDA_BUILD_ARGS
Expand Down
7 changes: 3 additions & 4 deletions ci/gpu/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -181,12 +181,11 @@ else
done

# Copy libcudf build time results
echo "Checking for build time log $LIB_BUILD_DIR/ninja_log.html"
if [[ -f "$LIB_BUILD_DIR/ninja_log.html" ]]; then
echo "Checking for build time log $LIB_BUILD_DIR/ninja_log.xml"
if [[ -f "$LIB_BUILD_DIR/ninja_log.xml" ]]; then
gpuci_logger "Copying build time results"
echo "LIB_BUILD_DIR=$LIB_BUILD_DIR"
cp "$LIB_BUILD_DIR/ninja_log.xml" "$WORKSPACE/test-results/buildtimes-junit.xml"
mkdir -p "$WORKSPACE/build-metrics"
cp "$LIB_BUILD_DIR/ninja_log.html" "$WORKSPACE/build-metrics/BuildMetrics.html"
fi

################################################################################
Expand Down
33 changes: 29 additions & 4 deletions cpp/scripts/sort_ninja_log.py
Original file line number Diff line number Diff line change
Expand Up @@ -88,21 +88,38 @@
elif output_fmt == "html":
# output results in HTML format
print("<html><head><title>Sorted Ninja Build Times</title>")
print("<style>", "table, th, td { border:1px solid black; }", "</style>")
# Note: Jenkins does not support style defined in the html
# https://www.jenkins.io/doc/book/security/configuring-content-security-policy/
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh. This is why fancy tables doesn't work in html page! 😢

print("</head><body>")
if args.msg is not None:
print("<p>", args.msg, "</p>")
print("<table>")
print(
"<tr><th>File</th>",
"<th align='right'>Compile time (ms)</th>",
"<th align='right'>Size (bytes)</th><tr>",
"<th>Compile time<br/>(ms)</th>",
"<th>Size<br/>(bytes)</th><tr>",
sep="",
)
summary = {"red": 0, "yellow": 0, "green": 0}
red = "bgcolor='#FFBBD0'"
yellow = "bgcolor='#FFFF80'"
green = "bgcolor='#AAFFBD'"
for key in sl:
result = entries[key]
elapsed = result[0]
color = green
if elapsed > 300000: # 5 minutes
color = red
summary["red"] += 1
elif elapsed > 120000: # 2 minutes
color = yellow
summary["yellow"] += 1
else:
summary["green"] += 1
print(
"<tr><td>",
"<tr ",
color,
"><td>",
key,
"</td><td align='right'>",
result[0],
Expand All @@ -111,6 +128,14 @@
"</td></tr>",
sep="",
)
print("</table><br/><table border='2'>")
# include summary table with color legend
print("<tr><td", red, ">time &gt; 5 minutes</td>")
print("<td align='right'>", summary["red"], "</td></tr>")
print("<tr><td", yellow, ">2 minutes &lt; time &lt; 5 minutes</td>")
print("<td align='right'>", summary["yellow"], "</td></tr>")
print("<tr><td", green, ">time &lt; 2 minutes</td>")
print("<td align='right'>", summary["green"], "</td></tr>")
print("</table></body></html>")

else:
Expand Down