From 536066af8a1474cb6e863cb2f1f854b161a4b039 Mon Sep 17 00:00:00 2001 From: Huy Nguyen Date: Fri, 26 Jun 2026 11:08:13 +0000 Subject: [PATCH 1/2] Build script option to change raft active/logging level --- build.sh | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/build.sh b/build.sh index 76a29eb4cb..67a30af6b5 100755 --- a/build.sh +++ b/build.sh @@ -48,6 +48,8 @@ HELP="$0 [ ...] [ ...] [--cmake-args=\"\"] [--cache-tool=\\\" - pass arbitrary list of CMake configuration options (escape all quotes in argument) --cache-tool= - pass the build cache tool (eg: ccache, sccache, distcc) that will be used to speedup the build process. + --logging-level= - set macro "RAFT_LOG_ACTIVE_LEVEL" to RAPIDS_LOGGER_LOG_LEVEL_{given_value}. + Valid values are (TRACE, DEBUG, INFO, WARN, ERROR, CRITICAL, OFF) --time - Enable nvcc compilation time logging into cpp/build/nvcc_compile_log.csv. Results can be interpreted with cpp/scripts/analyze_nvcc_log.py -h - print this text @@ -72,6 +74,7 @@ COMPILE_LIBRARY=OFF INSTALL_TARGET=install BUILD_REPORT_METRICS="" BUILD_REPORT_INCL_CACHE_STATS=OFF +LIBRAFT_LOGGING_LEVEL=INFO TEST_TARGETS="CORE_TEST;\ CORE_TEST_NOCUDA;\ @@ -193,6 +196,21 @@ function limitBench { fi } +function loggingLevel { + if [[ -n $(echo "$ARGS" | { grep -E "\-\-logging\-level" || true; } ) ]]; then + LIBRAFT_LOGGING_LEVEL=$(echo "$ARGS" | sed -e 's/.*--logging-level[= ]//' -e 's/ .*//') + if [[ -n ${LIBRAFT_LOGGING_LEVEL} ]]; then + ARGS=$(echo "$ARGS" | sed -e "s/--logging-level[= ]${LIBRAFT_LOGGING_LEVEL}//") + VALID_LEVELS="TRACE DEBUG INFO WARN ERROR CRITICAL OFF" + if [[ ! " ${VALID_LEVELS} " =~ " ${LIBRAFT_LOGGING_LEVEL} " ]]; then + echo "Invalid --logging-level value: '${LIBRAFT_LOGGING_LEVEL}'. Valid values are: ${VALID_LEVELS}" + exit 1 + fi + echo "Set LIBRAFT_LOGGING_LEVEL to ${LIBRAFT_LOGGING_LEVEL}" + fi + fi +} + function buildMetrics { # Check for multiple build-metrics options if [[ $(echo "$ARGS" | { grep -Eo "\-\-build\-metrics" || true; } | wc -l ) -gt 1 ]]; then @@ -223,6 +241,7 @@ if (( NUMARGS != 0 )); then cacheTool limitTests limitBench + loggingLevel buildMetrics for a in ${ARGS}; do if ! (echo " ${VALIDARGS} " | grep -q " ${a} "); then @@ -406,6 +425,7 @@ if (( NUMARGS == 0 )) || hasArg libraft || hasArg docs || hasArg tests || hasArg -DBUILD_TESTS=${BUILD_TESTS} \ -DBUILD_PRIMS_BENCH=${BUILD_PRIMS_BENCH} \ -DCMAKE_MESSAGE_LOG_LEVEL=${CMAKE_LOG_LEVEL} \ + -DLIBRAFT_LOGGING_LEVEL=${LIBRAFT_LOGGING_LEVEL} \ "${CACHE_ARGS[@]}" \ "${EXTRA_CMAKE_ARGS[@]}" From 251cb4a3803ca6917c2b37f190dd8dfc1c4f76fd Mon Sep 17 00:00:00 2001 From: aamijar Date: Fri, 26 Jun 2026 22:52:41 +0000 Subject: [PATCH 2/2] fix style and shellcheck warnings --- build.sh | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/build.sh b/build.sh index 67a30af6b5..0b97542b3e 100755 --- a/build.sh +++ b/build.sh @@ -48,7 +48,7 @@ HELP="$0 [ ...] [ ...] [--cmake-args=\"\"] [--cache-tool=\\\" - pass arbitrary list of CMake configuration options (escape all quotes in argument) --cache-tool= - pass the build cache tool (eg: ccache, sccache, distcc) that will be used to speedup the build process. - --logging-level= - set macro "RAFT_LOG_ACTIVE_LEVEL" to RAPIDS_LOGGER_LOG_LEVEL_{given_value}. + --logging-level= - set macro \"RAFT_LOG_ACTIVE_LEVEL\" to RAPIDS_LOGGER_LOG_LEVEL_{given_value}. Valid values are (TRACE, DEBUG, INFO, WARN, ERROR, CRITICAL, OFF) --time - Enable nvcc compilation time logging into cpp/build/nvcc_compile_log.csv. Results can be interpreted with cpp/scripts/analyze_nvcc_log.py @@ -200,9 +200,9 @@ function loggingLevel { if [[ -n $(echo "$ARGS" | { grep -E "\-\-logging\-level" || true; } ) ]]; then LIBRAFT_LOGGING_LEVEL=$(echo "$ARGS" | sed -e 's/.*--logging-level[= ]//' -e 's/ .*//') if [[ -n ${LIBRAFT_LOGGING_LEVEL} ]]; then - ARGS=$(echo "$ARGS" | sed -e "s/--logging-level[= ]${LIBRAFT_LOGGING_LEVEL}//") + ARGS="${ARGS//--logging-level[= ]${LIBRAFT_LOGGING_LEVEL}/}" VALID_LEVELS="TRACE DEBUG INFO WARN ERROR CRITICAL OFF" - if [[ ! " ${VALID_LEVELS} " =~ " ${LIBRAFT_LOGGING_LEVEL} " ]]; then + if [[ ! " ${VALID_LEVELS} " == *" ${LIBRAFT_LOGGING_LEVEL} "* ]]; then echo "Invalid --logging-level value: '${LIBRAFT_LOGGING_LEVEL}'. Valid values are: ${VALID_LEVELS}" exit 1 fi @@ -425,7 +425,7 @@ if (( NUMARGS == 0 )) || hasArg libraft || hasArg docs || hasArg tests || hasArg -DBUILD_TESTS=${BUILD_TESTS} \ -DBUILD_PRIMS_BENCH=${BUILD_PRIMS_BENCH} \ -DCMAKE_MESSAGE_LOG_LEVEL=${CMAKE_LOG_LEVEL} \ - -DLIBRAFT_LOGGING_LEVEL=${LIBRAFT_LOGGING_LEVEL} \ + -DLIBRAFT_LOGGING_LEVEL="${LIBRAFT_LOGGING_LEVEL}" \ "${CACHE_ARGS[@]}" \ "${EXTRA_CMAKE_ARGS[@]}"