From 4ee7b30c206f7aec07e9a56625a772ebc3722c6e Mon Sep 17 00:00:00 2001 From: Nicolas Morales Date: Mon, 30 Oct 2023 12:51:41 -0700 Subject: [PATCH] #291: build benchmarks and compiler benchmarks in the CI --- .github/workflows/cmake.yml | 12 ++++++------ comp_bench/CMakeLists.txt | 15 ++++++++++++++- 2 files changed, 20 insertions(+), 7 deletions(-) diff --git a/.github/workflows/cmake.yml b/.github/workflows/cmake.yml index c3c22b99..1d8da8ef 100644 --- a/.github/workflows/cmake.yml +++ b/.github/workflows/cmake.yml @@ -44,27 +44,27 @@ jobs: - name: Create Build Environment run: cmake -E make_directory ${{github.workspace}}/mdspan-build - + - name: Check Out uses: actions/checkout@v2 with: path: ${{github.workspace}}/mdspan-src - + - name: Configure CMake shell: bash working-directory: ${{github.workspace}}/mdspan-build - run: CXX=${{ matrix.compiler_prefix}}/${{ matrix.compiler_driver }} cmake $GITHUB_WORKSPACE/mdspan-src -DCMAKE_BUILD_TYPE=$BUILD_TYPE -DCMAKE_INSTALL_PREFIX=$GITHUB_WORKSPACE/mdspan-install -DMDSPAN_ENABLE_TESTS=ON -DMDSPAN_ENABLE_EXAMPLES=ON -DCMAKE_CXX_FLAGS=${{matrix.cxx_flags_extra}} - + run: CXX=${{ matrix.compiler_prefix}}/${{ matrix.compiler_driver }} cmake $GITHUB_WORKSPACE/mdspan-src -DCMAKE_BUILD_TYPE=$BUILD_TYPE -DCMAKE_INSTALL_PREFIX=$GITHUB_WORKSPACE/mdspan-install -DMDSPAN_ENABLE_TESTS=ON -DMDSPAN_ENABLE_EXAMPLES=ON -DMDSPAN_ENABLE_BENCHMARKS=ON -DMDSPAN_ENABLE_COMP_BENCH=ON -DCMAKE_CXX_FLAGS=${{matrix.cxx_flags_extra}} + - name: Build shell: bash working-directory: ${{github.workspace}}/mdspan-build run: make -j - + - name: Test working-directory: ${{github.workspace}}/mdspan-build shell: bash run: ctest - + - name: Install shell: bash working-directory: ${{github.workspace}}/mdspan-build diff --git a/comp_bench/CMakeLists.txt b/comp_bench/CMakeLists.txt index 667b94f6..cfd27195 100644 --- a/comp_bench/CMakeLists.txt +++ b/comp_bench/CMakeLists.txt @@ -1,10 +1,23 @@ include(metabench) +# C++ standards that our benchmark will actually support +set(_cbench_supported_standards 17 20 23) + +# Obtain the subset that are actually supported by the compiler +set(_cbench_standards "") +foreach(_std IN LISTS _cbench_supported_standards) + if ("cxx_std_${_std}" IN_LIST CMAKE_CXX_COMPILE_FEATURES) + list(APPEND _cbench_standards "${_std}") + endif() +endforeach() + +message(STATUS "Using the following C++ standards for compiler benchmarking: ${_cbench_standards}") + function(add_cxx_comparison name template range) set(all_datasets) - foreach(std IN ITEMS 11 14 17) + foreach(std IN LISTS _cbench_standards) metabench_add_dataset( ${name}_${std} ${template}