]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Performance tests: add ctest wrapper
authorMatthias Maier <tamiko@43-1.org>
Wed, 9 Feb 2022 22:57:42 +0000 (16:57 -0600)
committerMatthias Maier <tamiko@43-1.org>
Fri, 11 Feb 2022 10:10:33 +0000 (04:10 -0600)
tests/performance/collect_measurements [new file with mode: 0755]
tests/run_performance_tests.cmake [new file with mode: 0644]
tests/run_testsuite.cmake

diff --git a/tests/performance/collect_measurements b/tests/performance/collect_measurements
new file mode 100755 (executable)
index 0000000..aecaec5
--- /dev/null
@@ -0,0 +1,51 @@
+#!/bin/bash
+## ---------------------------------------------------------------------
+##
+## Copyright (C) 2022 by the deal.II authors
+##
+## This file is part of the deal.II library.
+##
+## The deal.II library is free software; you can use it, redistribute
+## it, and/or modify it under the terms of the GNU Lesser General
+## Public License as published by the Free Software Foundation; either
+## version 2.1 of the License, or (at your option) any later version.
+## The full text of the license can be found in the file LICENSE.md at
+## the top level directory of deal.II.
+##
+## ---------------------------------------------------------------------
+
+#
+# Performance tests record timing/sensor statistics in the output file
+# "output".
+#
+# This script collects all individual measurements from these files and
+# pretty prints a parsable table to stdout.
+#
+
+for i in tests/performance/*/output tests/performance/*/mpirun*/output
+do
+  # Skip output files that have fewer than 3 lines
+  if [[ "$(wc -l $i 2> /dev/null | awk '{ print $1 }')" -le 2 ]]; then
+    continue
+  fi
+
+  # Recover test name from full file path stored in ${i}
+  test_name=${i##tests/performance/}
+  test_name=${test_name%%/output}
+  test_name=${test_name/.release/}
+  test_name=${test_name/.debug/}
+
+  {
+    read -r test_type # first line of output file contains test type
+    read -r           # skip second line
+
+    # iterate over all remaining lines and output a table:
+    while read -r line
+    do
+      echo -e "$test_name\t$test_type\t${line}"
+    done
+  } < "${i}"
+done | sort |
+  column -s $'\t' -t \
+    -N "test_name,test_type,sensor,min/value,max,mean,std_dev,samples"
+
diff --git a/tests/run_performance_tests.cmake b/tests/run_performance_tests.cmake
new file mode 100644 (file)
index 0000000..b7dfc57
--- /dev/null
@@ -0,0 +1,12 @@
+SET(TRACK "Experimental")
+
+SET(CMAKE_BUILD_TYPE Release)
+SET(DEAL_II_COMPILE_EXAMPLES FALSE)
+SET(TEST_PICKUP_REGEX "^performance")
+
+SET(ENABLE_PERFORMANCE_TESTS TRUE)
+IF(NOT DEFINED SKIP_SUBMISSION)
+  SET(SKIP_SUBMISSION TRUE)
+ENDIF()
+
+INCLUDE(${CMAKE_CURRENT_LIST_DIR}/run_testsuite.cmake)
index 39f6c57c038f1a2ff63e0f9ce9e49838589936a8..098da5e03768760bf0cc0531d2a6e87757f0ec37 100644 (file)
@@ -83,7 +83,7 @@
 #
 #   MEMORYCHECK
 #     - If set to ON the CTEST_MEMORYCHECK() stage will be run.
-#     Test results must go into the "Experimantal" section.
+#     Test results must go into the "Experimental" section.
 #
 #   MAKEOPTS
 #     - Additional options that will be passed directly to make (or ninja).
@@ -270,7 +270,7 @@ ENDIF()
 # Pass all relevant variables down to configure:
 GET_CMAKE_PROPERTY(_variables VARIABLES)
 FOREACH(_var ${_variables})
-  IF( _var MATCHES "^(TEST|DEAL_II|ALLOW|WITH|FORCE|COMPONENT)_" OR
+  IF( _var MATCHES "^(ENABLE|TEST|DEAL_II|ALLOW|WITH|FORCE|COMPONENT)_" OR
       _var MATCHES "^(DOCUMENTATION|EXAMPLES)" OR
       _var MATCHES "^(ADOLC|ARBORX|ARPACK|BOOST|OPENCASCADE|MUPARSER|HDF5|KOKKOS|METIS|MPI)_" OR
       _var MATCHES "^(GINKGO|P4EST|PETSC|SCALAPACK|SLEPC|THREADS|TBB|TRILINOS)_" OR
@@ -577,15 +577,30 @@ Unable to determine test submission files from TAG. Bailing out.
     )
 ENDIF()
 
+#
+# Create performance test report
+#
+IF(ENABLE_PERFORMANCE_TESTS)
+  MESSAGE("-- Collecting performance measurements")
+  EXECUTE_PROCESS(
+    COMMAND bash "${CMAKE_CURRENT_LIST_DIR}/performance/collect_measurements"
+    WORKING_DIRECTORY ${CTEST_BINARY_DIRECTORY}
+    OUTPUT_FILE ${CTEST_BINARY_DIRECTORY}/performance.log
+    )
+ENDIF()
+
+
 #
 # And finally submit:
 #
 
-MESSAGE("-- Running CTEST_SUBMIT()")
-CTEST_SUBMIT(RETURN_VALUE _res)
+IF(NOT ${SKIP_SUBMISSION})
+  MESSAGE("-- Running CTEST_SUBMIT()")
+  CTEST_SUBMIT(RETURN_VALUE _res)
 
-IF("${_res}" STREQUAL "0")
-  MESSAGE("-- Submission successful. Goodbye!")
+  IF("${_res}" STREQUAL "0")
+    MESSAGE("-- Submission successful. Goodbye!")
+  ENDIF()
 ENDIF()
 
-# .oO( This script is freaky 600 lines long... )
+# .oO( This script is freaky 606 lines long... )

In the beginning the Universe was created. This has made a lot of people very angry and has been widely regarded as a bad move.

Douglas Adams


Typeset in Trocchi and Trocchi Bold Sans Serif.