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 utility to format ninja-log build times #9631

Merged
merged 58 commits into from
Dec 14, 2021
Merged
Show file tree
Hide file tree
Changes from 13 commits
Commits
Show all changes
58 commits
Select commit Hold shift + click to select a range
f5479fb
Add utility to format ninja-log build times
davidwendt Nov 8, 2021
644a4af
add copyright header
davidwendt Nov 11, 2021
01c4ebd
Merge branch 'branch-22.02' into build-format-ninja-log
davidwendt Nov 11, 2021
88d378e
Merge branch 'branch-22.02' into build-format-ninja-log
davidwendt Nov 12, 2021
461d01c
Merge branch 'branch-22.02' into build-format-ninja-log
davidwendt Nov 12, 2021
d4bab79
Merge branch 'branch-22.02' into build-format-ninja-log
davidwendt Nov 15, 2021
49024ca
Merge branch 'branch-22.02' into build-format-ninja-log
davidwendt Nov 16, 2021
06fa687
make .py executable
davidwendt Nov 16, 2021
639e499
add explicit python invoke
davidwendt Nov 16, 2021
2ed021b
experiment: add clear ccache
davidwendt Nov 16, 2021
a16c167
copy csv to test-results
davidwendt Nov 16, 2021
50d24ea
copy results test 2
davidwendt Nov 16, 2021
5c3cf7b
copy results after gtests
davidwendt Nov 16, 2021
b1265be
Merge branch 'branch-22.02' into build-format-ninja-log
davidwendt Nov 17, 2021
51cc770
remove unused script
davidwendt Nov 17, 2021
9e3bf53
add ccache file size check
davidwendt Nov 18, 2021
7c08e54
Merge branch 'branch-22.02' into build-format-ninja-log
davidwendt Nov 18, 2021
21ad4ee
clear ccache experiment
davidwendt Nov 18, 2021
bc626b5
Merge branch 'branch-22.02' into build-format-ninja-log
davidwendt Nov 19, 2021
6224cba
fix clang-format version check
davidwendt Nov 19, 2021
9be795d
Merge branch 'branch-22.02' into build-format-ninja-log
davidwendt Nov 19, 2021
405c020
remove temp clear cache
davidwendt Nov 19, 2021
71864e5
add fake error to test-results
davidwendt Nov 22, 2021
7bbcb97
Merge branch 'branch-22.02' into build-format-ninja-log
davidwendt Nov 22, 2021
292e523
output build times in xml
davidwendt Nov 22, 2021
754b259
errors test
davidwendt Nov 22, 2021
bb8a6de
experiment: modify threshold
davidwendt Nov 23, 2021
9c06d3f
get some baseline build times
davidwendt Nov 23, 2021
e79d240
exper: change thrust calls in opt-iter
davidwendt Nov 24, 2021
8d534bd
Merge branch 'branch-22.02' into build-format-ninja-log
davidwendt Nov 24, 2021
3da9437
undo exper iter-test changes
davidwendt Nov 29, 2021
3f46cff
Merge branch 'branch-22.02' into build-format-ninja-log
davidwendt Nov 29, 2021
81dbc60
fix script and remove cache clear
davidwendt Nov 29, 2021
334ae7f
Merge branch 'branch-22.02' into build-format-ninja-log
davidwendt Nov 30, 2021
f5726ed
move script to cpp/scripts
davidwendt Nov 30, 2021
8590a12
fix top-50 console output
davidwendt Nov 30, 2021
2df62e0
fix merge conflict
davidwendt Dec 1, 2021
fb57dca
add html output to sort script
davidwendt Dec 2, 2021
4ca9b93
Merge branch 'branch-22.02' into build-format-ninja-log
davidwendt Dec 2, 2021
5ce033a
Merge branch 'branch-22.02' into build-format-ninja-log
davidwendt Dec 3, 2021
906e234
add build sizes to html output
davidwendt Dec 3, 2021
b66f5b7
remove .csv output
davidwendt Dec 6, 2021
d8d0536
Merge branch 'branch-22.02' into build-format-ninja-log
davidwendt Dec 7, 2021
ef54f52
use argparse for python script
davidwendt Dec 7, 2021
0d7e838
Merge branch 'branch-22.02' into build-format-ninja-log
davidwendt Dec 8, 2021
488bcfb
change build-times-results to build-metrics
davidwendt Dec 8, 2021
5f26a41
Merge branch 'branch-22.02' into build-format-ninja-log
davidwendt Dec 9, 2021
4a8b7e7
add total compile-time to output
davidwendt Dec 9, 2021
58e6b2a
temp fix to get past cmake style check
davidwendt Dec 9, 2021
5a771a1
fix typo in build script
davidwendt Dec 9, 2021
2ec30e9
another typo in variable name in build.sh
davidwendt Dec 9, 2021
cbdaefe
check ccache exists before calling it
davidwendt Dec 9, 2021
5a519d2
add parallel-level value to build time message
davidwendt Dec 10, 2021
33e6716
Merge branch 'branch-22.02' into build-format-ninja-log
davidwendt Dec 10, 2021
165ac24
Merge branch 'branch-22.02' into build-format-ninja-log
davidwendt Dec 11, 2021
ed5c2b9
Merge branch 'branch-22.02' into build-format-ninja-log
davidwendt Dec 13, 2021
95324e9
Merge branch 'branch-22.02' into build-format-ninja-log
davidwendt Dec 14, 2021
1d1b8a0
add choices [csv,xml,html] to argparse
davidwendt Dec 14, 2021
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
8 changes: 8 additions & 0 deletions build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -187,6 +187,14 @@ if buildAll || hasArg libcudf; then

cmake --build . -j${PARALLEL_LEVEL} ${VERBOSE_FLAG}

# Record build times
if [[ -f "${LIB_BUILD_DIR}/.ninja_log" ]]; then
echo "Formatting build times"
python ${REPODIR}/ci/utils/sort_ninja_log.py ${LIB_BUILD_DIR}/.ninja_log > ${LIB_BUILD_DIR}/ninja_log.csv
karthikeyann marked this conversation as resolved.
Show resolved Hide resolved
echo "===Top 50 build time offenders==="
cat ${LIB_BUILD_DIR}/ninja_log.csv | head -n 50
fi

if [[ ${INSTALL_TARGET} != "" ]]; then
cmake --build . -j${PARALLEL_LEVEL} --target install ${VERBOSE_FLAG}
fi
Expand Down
18 changes: 17 additions & 1 deletion ci/gpu/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,14 @@ if [[ -z "$PROJECT_FLASH" || "$PROJECT_FLASH" == "0" ]]; then
"$WORKSPACE/build.sh" clean libcudf cudf dask_cudf libcudf_kafka cudf_kafka benchmarks tests -l --ptds
fi

###
echo "Checking for build time log $WORKSPACE/cpp/build/ninja_log.csv"
gpuci_logger "Checking for build time logger $WORKSPACE/cpp/build/ninja_log.csv"
if [[ -f "$WORKSPACE/cpp/build/ninja_log.csv" ]]; then
echo "Copying build time results"
cp "$WORKSPACE/cpp/build/ninja_log.csv" "$WORKSPACE/test-results/."
fi

################################################################################
# TEST - Run GoogleTest
################################################################################
Expand Down Expand Up @@ -166,16 +174,24 @@ else
gpuci_logger "Check GPU usage"
nvidia-smi

gpuci_logger "GoogleTests"
set -x
cd $LIB_BUILD_DIR

gpuci_logger "GoogleTests"

for gt in gtests/* ; do
test_name=$(basename ${gt})
echo "Running GoogleTest $test_name"
${gt} --gtest_output=xml:"$WORKSPACE/test-results/"
done

###
echo "Checking for build time log $LIB_BUILD_DIR/ninja_log.csv"
if [[ -f "$LIB_BUILD_DIR/ninja_log.csv" ]]; then
gpuci_logger "Copying build time results"
cp "$LIB_BUILD_DIR/ninja_log.csv" "$WORKSPACE/test-results/."
fi

CUDF_CONDA_FILE=`find ${CONDA_ARTIFACT_PATH} -name "libcudf-*.tar.bz2"`
CUDF_CONDA_FILE=`basename "$CUDF_CONDA_FILE" .tar.bz2` #get filename without extension
CUDF_CONDA_FILE=${CUDF_CONDA_FILE//-/=} #convert to conda install
Expand Down
33 changes: 33 additions & 0 deletions ci/utils/sort_ninja_log.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
#
# Copyright (c) 2021, NVIDIA CORPORATION.
#
import os
import sys

log_file = ".ninja_log"
if len(sys.argv) > 1:
log_file = sys.argv[1]

# build a map of the log entries
entries = {}
with open(log_file, "r") as log:
for line in log:
entry = line.split()
if len(entry) > 4:
elapsed = int(entry[1]) - int(entry[0])
entries[entry[3]] = elapsed

# check file could be loaded
if len(entries) == 0:
print("Could not parse", log_file)
exit()

# sort the keys by build time (descending order)
keys = list(entries.keys())
sl = sorted(keys, key=lambda k: entries[k], reverse=True)

# output results in CSV format
print("time,file")
for key in sl:
print(entries[key], key, sep=",")