diff --git a/ci/common/build.bash b/ci/common/build.bash index 3c258719b..0f6fa8cc2 100755 --- a/ci/common/build.bash +++ b/ci/common/build.bash @@ -188,9 +188,6 @@ case "${COVERAGE_PLAN}" in append CMAKE_FLAGS "-DTHRUST_MULTICONFIG_ENABLE_SYSTEM_CUDA=ON" append CMAKE_FLAGS "-DTHRUST_MULTICONFIG_WORKLOAD=SMALL" append CMAKE_FLAGS "-DTHRUST_INCLUDE_CUB_CMAKE=ON" - append CMAKE_FLAGS "-DCUB_ENABLE_THOROUGH_TESTING=OFF" - append CMAKE_FLAGS "-DCUB_ENABLE_BENCHMARK_TESTING=OFF" - append CMAKE_FLAGS "-DCUB_ENABLE_MINIMAL_TESTING=ON" append CMAKE_FLAGS "-DTHRUST_AUTO_DETECT_COMPUTE_ARCHS=ON" if [[ "${BUILD_TYPE}" == "cpu" ]] && [[ "${CXX_TYPE}" == "nvcxx" ]]; then # If no GPU is automatically detected, NVC++ insists that you explicitly @@ -270,7 +267,7 @@ log "Configure Thrust and CUB..." # Clear out any stale CMake configs: rm -rf CMakeCache.txt CMakeFiles/ -echo_and_run_timed "Configure" cmake .. ${CMAKE_FLAGS} +echo_and_run_timed "Configure" cmake .. --log-level=VERBOSE ${CMAKE_FLAGS} configure_status=$? log "Build Thrust and CUB..." @@ -288,7 +285,7 @@ set -e log "Test Thrust and CUB..." -echo_and_run_timed "Test" ctest ${CTEST_FLAGS} +echo_and_run_timed "Test" ctest ${CTEST_FLAGS} | tee ctest_log test_status=$? ################################################################################ @@ -296,19 +293,27 @@ test_status=$? ################################################################################ if [[ -f ".ninja_log" ]]; then - log "Checking slowest build steps..." + log "Checking slowest build steps:" echo_and_run "CompileTimeInfo" cmake -P ../cmake/PrintNinjaBuildTimes.cmake | head -n 23 fi +################################################################################ +# RUNTIME INFO: Print the 20 longest running test steps +################################################################################ + +if [[ -f "ctest_log" ]]; then + log "Checking slowest test steps:" + echo_and_run "TestTimeInfo" cmake -DLOGFILE=ctest_log -P ../cmake/PrintCTestRunTimes.cmake | head -n 20 +fi + ################################################################################ # SUMMARY - Print status of each step and exit with failure if needed. ################################################################################ log "Summary:" -log "- Configure Error Code: ${configure_status}" -log "- Build Error Code: ${build_status}" -log "- Test Error Code: ${test_status}" - +echo "- Configure Error Code: ${configure_status}" +echo "- Build Error Code: ${build_status}" +echo "- Test Error Code: ${test_status}" if [[ "${configure_status}" != "0" ]] || \ [[ "${build_status}" != "0" ]] || \ diff --git a/cmake/PrintCTestRunTimes.cmake b/cmake/PrintCTestRunTimes.cmake new file mode 100644 index 000000000..bf23b9bb6 --- /dev/null +++ b/cmake/PrintCTestRunTimes.cmake @@ -0,0 +1,109 @@ +## This CMake script parses the output of ctest and prints a formatted list +## of individual test runtimes, sorted longest first. +## +## ctest > ctest_log +## cmake -DLOGFILE=ctest_log \ +## -P PrintCTestRunTimes.cmake +## +################################################################################ + +cmake_minimum_required(VERSION 3.15) + +# Prepend the string with "0" until the string length equals the specified width +function(pad_string_with_zeros string_var width) + set(local_string "${${string_var}}") + string(LENGTH "${local_string}" size) + while(size LESS width) + string(PREPEND local_string "0") + string(LENGTH "${local_string}" size) + endwhile() + set(${string_var} "${local_string}" PARENT_SCOPE) +endfunction() + +################################################################################ + +if (NOT LOGFILE) + message(FATAL_ERROR "Missing -DLOGFILE= argument.") +endif() + +# Check if logfile exists +if (NOT EXISTS "${LOGFILE}") + message(FATAL_ERROR "LOGFILE does not exist ('${LOGFILE}').") +endif() + +string(JOIN "" regex + "^[ ]*[0-9]+/[0-9]+[ ]+Test[ ]+#" + "([0-9]+)" # Test ID + ":[ ]+" + "(.+)" # Test Name + "[ ]+\\.+[ ]+" + "(.+[^ ])" # Result + "[ ]+" + "([0-9]+)" # Seconds + "\\.[0-9]+[ ]+sec[ ]*$" +) + +message(DEBUG "Regex: ${regex}") + +# Read the logfile and generate a map / keylist +set(keys) +file(STRINGS "${LOGFILE}" lines) +foreach(line ${lines}) + + # Parse each build time + string(REGEX MATCH "${regex}" _DUMMY "${line}") + + if (CMAKE_MATCH_COUNT EQUAL 4) + set(test_id "${CMAKE_MATCH_1}") + set(test_name "${CMAKE_MATCH_2}") + set(test_result "${CMAKE_MATCH_3}") + set(tmp "${CMAKE_MATCH_4}") # floor(runtime_seconds) + + # Compute human readable time + math(EXPR days "${tmp} / (60 * 60 * 24)") + math(EXPR tmp "${tmp} - (${days} * 60 * 60 * 24)") + math(EXPR hours "${tmp} / (60 * 60)") + math(EXPR tmp "${tmp} - (${hours} * 60 * 60)") + math(EXPR minutes "${tmp} / (60)") + math(EXPR tmp "${tmp} - (${minutes} * 60)") + math(EXPR seconds "${tmp}") + + # Format time components + pad_string_with_zeros(days 3) + pad_string_with_zeros(hours 2) + pad_string_with_zeros(minutes 2) + pad_string_with_zeros(seconds 2) + + # Construct table entry + # Later values in the file for the same command overwrite earlier entries + string(MAKE_C_IDENTIFIER "${test_id}" key) + string(JOIN " | " ENTRY_${key} + "${days}d ${hours}h ${minutes}m ${seconds}s" + "${test_result}" + "${test_id}: ${test_name}" + ) + + # Record the key: + list(APPEND keys "${key}") + endif() +endforeach() + +list(REMOVE_DUPLICATES keys) + +# Build the entry list: +set(entries) +foreach(key ${keys}) + list(APPEND entries "${ENTRY_${key}}") +endforeach() + +if (NOT entries) + message(FATAL_ERROR "LOGFILE contained no test times ('${LOGFILE}').") +endif() + +# Sort in descending order: +list(SORT entries ORDER DESCENDING) + +# Dump table: +foreach(entry ${entries}) + message(STATUS ${entry}) +endforeach() diff --git a/dependencies/cub b/dependencies/cub index 0aa1d3587..78d557962 160000 --- a/dependencies/cub +++ b/dependencies/cub @@ -1 +1 @@ -Subproject commit 0aa1d3587729ddd51596a5c311dc5e088dccea69 +Subproject commit 78d557962d5368c6c26e5555da120428378515d5