diff --git a/.github/workflows/benchmark_compare.yml b/.github/workflows/benchmark_compare.yml index 0f31a48582..6f3dc5bd30 100644 --- a/.github/workflows/benchmark_compare.yml +++ b/.github/workflows/benchmark_compare.yml @@ -37,7 +37,7 @@ jobs: steps: - name: Get PR details id: pr - uses: actions/github-script@v8 + uses: actions/github-script@v9 with: script: | const pullRequestNumber = context.eventName === 'workflow_dispatch' @@ -60,7 +60,7 @@ jobs: }; - name: Create status check - uses: actions/github-script@v8 + uses: actions/github-script@v9 with: script: | const prData = ${{ steps.pr.outputs.result }}; @@ -75,7 +75,7 @@ jobs: }); - name: Checkout base repository - uses: actions/checkout@v6 + uses: actions/checkout@v7 with: fetch-depth: 0 @@ -96,7 +96,7 @@ jobs: echo "timestamp=$(date -u +'%Y-%m-%d-%H;%M;%S')" >> $GITHUB_OUTPUT - name: Setup ccache cache files - uses: actions/cache@v5 + uses: actions/cache@v6 with: path: ${{github.workspace}}/build/.ccache key: benchmark-ccache-${{ steps.ccache_cache_timestamp.outputs.timestamp }} @@ -114,7 +114,7 @@ jobs: - name: Upload Results if: always() - uses: actions/upload-artifact@v6 + uses: actions/upload-artifact@v7 with: name: benchmark-data-${{ github.run_id }} path: | @@ -125,7 +125,7 @@ jobs: - name: Post Results if: success() - uses: actions/github-script@v8 + uses: actions/github-script@v9 with: script: | const fs = require('fs'); @@ -156,7 +156,7 @@ jobs: - name: Update status check - Success if: success() - uses: actions/github-script@v8 + uses: actions/github-script@v9 with: script: | const prData = ${{ steps.pr.outputs.result }}; @@ -172,7 +172,7 @@ jobs: - name: Notify on Failure if: failure() - uses: actions/github-script@v8 + uses: actions/github-script@v9 with: script: | const prData = ${{ steps.pr.outputs.result }}; diff --git a/.github/workflows/cmake.yml b/.github/workflows/cmake.yml index 286dfca43e..f153c8fb16 100644 --- a/.github/workflows/cmake.yml +++ b/.github/workflows/cmake.yml @@ -63,14 +63,14 @@ jobs: -DSEQUANT_PYTHON=${{ !matrix.valgrind && !matrix.sanitize }} -DSEQUANT_ASSERT_BEHAVIOR=${{ matrix.valgrind && 'IGNORE' || 'THROW' }} steps: - - uses: actions/checkout@v6 + - uses: actions/checkout@v7 - name: free up disk space on Ubuntu runner if: ${{ matrix.os == 'ubuntu-24.04' }} uses: jlumbroso/free-disk-space@main - name: Setup Python - uses: actions/setup-python@v6 + uses: actions/setup-python@v7 with: python-version: '3.x' @@ -106,7 +106,7 @@ jobs: run: echo "timestamp=$(date -u +'%Y-%m-%d-%H-%M-%S')" >> $GITHUB_OUTPUT - name: Setup ccache cache files - uses: actions/cache@v5 + uses: actions/cache@v6 with: path: ${{github.workspace}}/build/.ccache key: ${{ matrix.config.name }}-ccache-${{ steps.ccache_cache_timestamp.outputs.timestamp }} @@ -121,7 +121,7 @@ jobs: # Note the current convention is to use the -S and -B options here to specify source # and build directories, but this is only available with CMake 3.13 and higher. # The CMake binaries on the Github Actions machines are (as of this writing) 3.12 - run: cmake $GITHUB_WORKSPACE -DCMAKE_BUILD_TYPE=$BUILD_TYPE $BUILD_CONFIG + run: cmake $GITHUB_WORKSPACE -DCMAKE_BUILD_TYPE=$BUILD_TYPE $BUILD_CONFIG -DSEQUANT_QUICK_BENCHMARKS=ON - name: Build @@ -136,6 +136,12 @@ jobs: shell: bash run: ctest --output-on-failure -R "^sequant" + - name: Ensure benchmarks not broken + if: ${{ !matrix.valgrind && !matrix.sanitize }} + working-directory: ${{github.workspace}}/build + shell: bash + run: ./benchmarks/sequant_benchmarks --benchmark_dry_run=true + - name: Test (+ Valgrind) if: ${{ matrix.valgrind }} working-directory: ${{github.workspace}}/build diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.yml index ff35a34f2a..f8fdc24e65 100644 --- a/.github/workflows/docs.yml +++ b/.github/workflows/docs.yml @@ -16,8 +16,8 @@ jobs: -DSEQUANT_BUILD_DOCS=ON -DSEQUANT_BUILD_DOCS_API_BREATHEEXHALE=ON steps: - - uses: actions/checkout@v6 - - uses: actions/setup-python@v6 + - uses: actions/checkout@v7 + - uses: actions/setup-python@v7 with: python-version: '>=3.9' # Breathe needs 3.9 or later cache: 'pip' diff --git a/.github/workflows/formatting_check.yml b/.github/workflows/formatting_check.yml index d74b45bc51..5eebd01ace 100644 --- a/.github/workflows/formatting_check.yml +++ b/.github/workflows/formatting_check.yml @@ -7,7 +7,7 @@ jobs: name: "Check formatting" runs-on: "ubuntu-latest" steps: - - uses: actions/checkout@v6 + - uses: actions/checkout@v7 - name: Install clang-format-17 run: | diff --git a/CMakeLists.txt b/CMakeLists.txt index f119f10dbc..59a4bbc67f 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -95,6 +95,7 @@ macro(sequant_add_library _module) get_target_property(_type SeQuant-${_module} TYPE) if (NOT _type STREQUAL "INTERFACE_LIBRARY") target_set_warning_flags(SeQuant-${_module}) + target_set_optimization_flags(SeQuant-${_module}) endif() endmacro() @@ -272,6 +273,7 @@ add_library(SeQuant-bliss set_target_properties(SeQuant-bliss PROPERTIES EXPORT_NAME bliss) set_target_properties(SeQuant-bliss PROPERTIES CXX_SCAN_FOR_MODULES OFF) add_library(SeQuant::bliss ALIAS SeQuant-bliss) +target_set_optimization_flags(SeQuant-bliss) target_link_libraries(SeQuant-bliss PUBLIC range-v3::range-v3 Boost::headers) if (SEQUANT_USE_SYSTEM_BOOST_HASH) target_compile_definitions(SeQuant-bliss PUBLIC SEQUANT_USE_SYSTEM_BOOST_HASH=1) diff --git a/SeQuant/core/eval/eval.hpp b/SeQuant/core/eval/eval.hpp index 96e3ffbea9..5609603c6e 100644 --- a/SeQuant/core/eval/eval.hpp +++ b/SeQuant/core/eval/eval.hpp @@ -557,7 +557,8 @@ ResultPtr evaluate(Node const& node, // bool checked; Stage stage = Stage::Enter; bool store_after = false; - ResultPtr left, right; + ResultPtr left = {}; + ResultPtr right = {}; }; // Finalize a freshly computed Phase-B result: if this Checked node needs diff --git a/SeQuant/domain/mbpt/op.cpp b/SeQuant/domain/mbpt/op.cpp index 50f7b295d4..171981c375 100644 --- a/SeQuant/domain/mbpt/op.cpp +++ b/SeQuant/domain/mbpt/op.cpp @@ -580,14 +580,14 @@ ExprPtr OpMaker::operator()( if (!dep && csv) { if (opclass == OpClass::Ex) { if constexpr (assert_enabled()) { - for (auto&& s : cre_spaces_) { + for ([[maybe_unused]] const auto& s : cre_spaces_) { SEQUANT_ASSERT(isr->contains_unoccupied(s)); } } dep = UseDepIdx::Bra; } else if (opclass == OpClass::Deex) { if constexpr (assert_enabled()) { - for (auto&& s : ann_spaces_) { + for ([[maybe_unused]] const auto& s : ann_spaces_) { SEQUANT_ASSERT(isr->contains_unoccupied(s)); } } diff --git a/benchmarks/CMakeLists.txt b/benchmarks/CMakeLists.txt index 4bc71463cf..5f854bc81f 100644 --- a/benchmarks/CMakeLists.txt +++ b/benchmarks/CMakeLists.txt @@ -11,8 +11,23 @@ add_executable(sequant_benchmarks "wick.cpp" ) +target_set_warning_flags(sequant_benchmarks) +target_set_optimization_flags(sequant_benchmarks) + set_target_properties(sequant_benchmarks PROPERTIES CXX_SCAN_FOR_MODULES OFF) +option(SEQUANT_QUICK_BENCHMARKS "Whether to exclude computational expensive benchmarks" OFF) + +# Running benchmarks in Debug mode doesn't make a lot of sense but in case someone does, +# we at least want to exclude benchmarks that are likely to take forever in this setup +if (CMAKE_BUILD_TYPE STREQUAL "Debug" OR SEQUANT_QUICK_BENCHMARKS) + target_compile_definitions(sequant_benchmarks + PRIVATE + SEQUANT_BENCH_MAX_CC_RANK=3 + SEQUANT_BENCH_MAX_WICK_INPUTS=2 + ) +endif() + # The benchmark implementations contain a bunch of same-name symbol definition that # ought to be local to the individual translation unit. Hence, we must not combine # all of them into a single translation unit. diff --git a/benchmarks/coupled_cluster.cpp b/benchmarks/coupled_cluster.cpp index d5168ee4c5..63be09e748 100644 --- a/benchmarks/coupled_cluster.cpp +++ b/benchmarks/coupled_cluster.cpp @@ -2,7 +2,11 @@ #include +#ifdef SEQUANT_BENCH_MAX_CC_RANK +static constexpr std::size_t maxRank = SEQUANT_BENCH_MAX_CC_RANK; +#else static constexpr std::size_t maxRank = 10; +#endif using namespace sequant; using namespace sequant::mbpt; diff --git a/benchmarks/main.cpp b/benchmarks/main.cpp index 820ab9a74b..76a4eb5915 100644 --- a/benchmarks/main.cpp +++ b/benchmarks/main.cpp @@ -2,6 +2,7 @@ #include #include +#include #include using namespace sequant; @@ -17,6 +18,9 @@ int main(int argc, char *argv[]) { .vacuum = Vacuum::SingleProduct}); set_default_context(fermi_ctx); + mbpt::Context mbpt_ctx({.op_registry_ptr = mbpt::make_minimal_registry()}); + mbpt::set_default_mbpt_context(std::move(mbpt_ctx)); + Context bose_einstein_ctx = Context( {.index_space_registry_shared_ptr = idxreg, .vacuum = Vacuum::Physical}); diff --git a/benchmarks/wick.cpp b/benchmarks/wick.cpp index 48cd4e375c..20d58516d7 100644 --- a/benchmarks/wick.cpp +++ b/benchmarks/wick.cpp @@ -13,7 +13,11 @@ using namespace sequant; using namespace sequant::mbpt; +#ifdef SEQUANT_BENCH_MAX_WICK_INPUTS +static constexpr std::size_t nInputs = SEQUANT_BENCH_MAX_WICK_INPUTS; +#else static constexpr std::size_t nInputs = 5; +#endif template ExprPtr get_op_sequence(std::size_t i) { @@ -147,8 +151,9 @@ VacAvPair get_mbpt_expr(std::size_t i) { } static void mbpt_vac_av(benchmark::State &state, bool csv) { - auto ctx = sequant::mbpt::set_scoped_default_mbpt_context( - mbpt::Context({.csv = csv ? CSV::Yes : CSV::No})); + auto base = mbpt::get_default_mbpt_context(); + base.set(csv ? CSV::Yes : CSV::No); + auto ctx = sequant::mbpt::set_scoped_default_mbpt_context(base); VacAvPair input = get_mbpt_expr(state.range(0)); diff --git a/cmake/compiler.cmake b/cmake/compiler.cmake index 1a3b8f9cde..5bc42fae8b 100644 --- a/cmake/compiler.cmake +++ b/cmake/compiler.cmake @@ -60,3 +60,66 @@ function(target_set_warning_flags TARGET) target_compile_options("${TARGET}" PRIVATE "-Wno-unused-lambda-capture") endif() endfunction() + + + +function(target_set_optimization_flags TARGET) + if (CMAKE_BUILD_TYPE STREQUAL "Debug") + return() + endif() + + get_target_property(TARGET_TYPE "${TARGET}" TYPE) + + if (TARGET_TYPE STREQUAL "INTERFACE_LIBRARY") + message(WARNING "target_set_optimization_flags is not intended to be used on interface targets") + return() + endif() + + include(CheckCXXCompilerFlag) + include(CheckIPOSupported) + + check_ipo_supported(RESULT CMAKE_SUPPORTS_COMPILER_LTO LANGUAGES CXX) + + set(CMAKE_TRY_COMPILE_TARGET_TYPE "STATIC_LIBRARY") + check_cxx_compiler_flag("-flto" SEQUANT_LTO_FLAG_SUPPORTED) + check_cxx_compiler_flag("-flto=auto" SEQUANT_LTO_AUTO_SUPPORTED) + check_cxx_compiler_flag("-flto;-ffat-lto-objects" SEQUANT_FAT_LTO_FLAG_SUPPORTED) + + if (DEFINED SEQUANT_LTO) + # Always honor explicit user choice + set(ENABLE_LTO ${SEQUANT_LTO}) + elseif(TARGET_TYPE STREQUAL "STATIC_LIBRARY" OR TARGET_TYPE STREQUAL "OBJECT_LIBRARY") + # For static/object libraries we only want to enable LTO by default, if we can create + # "fat" object files. Those can still be linked without LTO and hence shouldn't + # break any downstream use. + set(ENABLE_LTO ${SEQUANT_FAT_LTO_FLAG_SUPPORTED}) + elseif(SEQUANT_LTO_FLAG_SUPPORTED OR CMAKE_SUPPORTS_COMPILER_LTO) + # Anything but static/object libraries is also linked by us and + # hence enabling LTO doesn't affect downstream compatibility + set(ENABLE_LTO ON) + endif() + + if (ENABLE_LTO) + if (SEQUANT_LTO_FLAG_SUPPORTED) + # We prefer to manually set the LTO flag(s) rather than CMake doing it for us + # due to https://gitlab.kitware.com/cmake/cmake/-/work_items/23136 + # On some compilers, the thin LTO type requested by CMake is incompatible + # with explicitly asking for fat LTO object files. + # Besides, it seems like full LTO achieves quite a bit better optimizations + # with Clang. + if (SEQUANT_LTO_AUTO_SUPPORTED) + target_compile_options("${TARGET}" PRIVATE -flto=auto) + target_link_options("${TARGET}" PRIVATE -flto=auto) + else() + target_compile_options("${TARGET}" PRIVATE -flto) + target_link_options("${TARGET}" PRIVATE -flto) + endif() + + if (SEQUANT_FAT_LTO_FLAG_SUPPORTED) + target_compile_options("${TARGET}" PRIVATE -ffat-lto-objects) + endif() + else() + set_target_properties("${TARGET}" PROPERTIES INTERPROCEDURAL_OPTIMIZATION ON) + endif() + endif() +endfunction() diff --git a/doc/user/getting_started/installing.rst b/doc/user/getting_started/installing.rst index d4822c02f8..e1389b1c12 100644 --- a/doc/user/getting_started/installing.rst +++ b/doc/user/getting_started/installing.rst @@ -110,6 +110,9 @@ Useful CMake Variables - ``ABORT`` in ``Debug`` mode, ``IGNORE`` otherwise - Controls how assertions within SeQuant's code are handled. Valid options are ``ABORT``, ``THROW`` and ``IGNORE``. The latter disables assertions, whereas the former keep them active and either abort the program or throw an exception on violation respectively. + * - SEQUANT_LTO + - `ON` if the compiler supportes "fat" LTO objects, `OFF` otherwise + - Controls whether SeQuant will be built with link-time optimizations (LTO) Configuring and Building diff --git a/external/versions.cmake b/external/versions.cmake index 5e9cd164fd..e7325b8210 100644 --- a/external/versions.cmake +++ b/external/versions.cmake @@ -11,12 +11,12 @@ set(SEQUANT_TRACKED_LIBPERM_TAG cada3e185549896203cf4d0c7f26ea22c7de428f) set(SEQUANT_TRACKED_POLYMORPHICVARIANT_TAG 010c69786104c07c5faccffe0e99f99de5a69fd8) -set(SEQUANT_TRACKED_UTFCPP_TAG v4.0.6) +set(SEQUANT_TRACKED_UTFCPP_TAG v4.1.1) -set(SEQUANT_TRACKED_CLI11_TAG v2.5.0) +set(SEQUANT_TRACKED_CLI11_TAG v2.7.2) set(SEQUANT_OLDEST_CLI11_VERSION 2) -set(SEQUANT_TRACKED_SPDLOG_TAG v1.15.3) +set(SEQUANT_TRACKED_SPDLOG_TAG v1.17.0) set(SEQUANT_TRACKED_JSON_TAG v3.12.0) set(SEQUANT_OLDEST_JSON_VERSION 3) @@ -27,13 +27,13 @@ set(SEQUANT_OLDEST_JSON_VERSION 3) # Recent stdlibs have removed this class when using C++17 (e.g. Apple Clang 15) set(SEQUANT_OLDEST_BOOST_VERSION 1.81) -set(SEQUANT_TRACKED_CATCH2_TAG v3.9.1) +set(SEQUANT_TRACKED_CATCH2_TAG v3.15.3) set(SEQUANT_OLDEST_CATCH2_VERSION 3.3) -set(SEQUANT_TRACKED_GOOGLEBENCHMARK_TAG v1.9.4) +set(SEQUANT_TRACKED_GOOGLEBENCHMARK_TAG v1.9.5) set(SEQUANT_OLDEST_GOOGLEBENCHMARK_VERSION 1.9.3) -set(SEQUANT_TRACKED_PYBIND11_TAG v3.0.1) +set(SEQUANT_TRACKED_PYBIND11_TAG v3.1.0) set(SEQUANT_OLDEST_PYBIND11_VERSION 3) # oldest Doxygen we can tolerate ... doxygen-awesome-css requires doxygen 1.9.1 - 1.9.4 or 1.9.6 - 1.14.0, so just use 1.9.6 as the minimum diff --git a/python/CMakeLists.txt b/python/CMakeLists.txt index d73a050b86..e1f6f5c323 100644 --- a/python/CMakeLists.txt +++ b/python/CMakeLists.txt @@ -13,6 +13,7 @@ endif() pybind11_add_module(python-sequant MODULE src/sequant/_sequant.cc) target_link_libraries(python-sequant PRIVATE SeQuant) +target_set_optimization_flags(python-sequant) target_include_directories(python-sequant PRIVATE "${CMAKE_CURRENT_SOURCE_DIR}/include") set_target_properties( diff --git a/tests/integration/CMakeLists.txt b/tests/integration/CMakeLists.txt index cbb387ae94..7f3d30cde9 100644 --- a/tests/integration/CMakeLists.txt +++ b/tests/integration/CMakeLists.txt @@ -56,6 +56,7 @@ foreach(current IN LISTS TEST_CASES) endif() target_set_warning_flags("${test_name}") + target_set_optimization_flags("${test_name}") set(variant_names "") diff --git a/tests/integration/eval/CMakeLists.txt b/tests/integration/eval/CMakeLists.txt index c7e315b6a7..f9ecdb64d8 100644 --- a/tests/integration/eval/CMakeLists.txt +++ b/tests/integration/eval/CMakeLists.txt @@ -23,6 +23,7 @@ if (SEQUANT_HAS_TILEDARRAY) ) set_target_properties(eval_ta PROPERTIES CXX_SCAN_FOR_MODULES OFF) target_link_libraries(eval_ta PRIVATE eval_shared tiledarray) + target_set_optimization_flags(eval_ta) set(test_name "sequant/integration/eval_ta") add_test( @@ -42,6 +43,7 @@ if (SEQUANT_HAS_BTAS) ) set_target_properties(eval_btas PROPERTIES CXX_SCAN_FOR_MODULES OFF) target_link_libraries(eval_btas PRIVATE eval_shared BTAS::BTAS) + target_set_optimization_flags(eval_btas) set(test_name "sequant/integration/eval_btas") add_test( @@ -61,6 +63,7 @@ if (SEQUANT_HAS_TAPP) ) set_target_properties(eval_tapp PROPERTIES CXX_SCAN_FOR_MODULES OFF) target_link_libraries(eval_tapp PRIVATE eval_shared tapp::reference) + target_set_optimization_flags(eval_tapp) set(test_name "sequant/integration/eval_tapp") add_test( diff --git a/tests/unit/CMakeLists.txt b/tests/unit/CMakeLists.txt index 3411d2ee0e..c0ea4d510e 100644 --- a/tests/unit/CMakeLists.txt +++ b/tests/unit/CMakeLists.txt @@ -28,6 +28,8 @@ set(symb_test_sources ) add_library(unit_tests-sequant-symb-obj OBJECT ${symb_test_sources}) +target_set_warning_flags(unit_tests-sequant-symb-obj) +target_set_optimization_flags(unit_tests-sequant-symb-obj) set_target_properties(unit_tests-sequant-symb-obj PROPERTIES CXX_SCAN_FOR_MODULES OFF) target_link_libraries(unit_tests-sequant-symb-obj PUBLIC SeQuant::symb SeQuant::bliss @@ -43,6 +45,8 @@ set(eval_test_sources "test_eval_node.cpp" ) add_library(unit_tests-sequant-eval-obj OBJECT ${eval_test_sources}) +target_set_warning_flags(unit_tests-sequant-eval-obj) +target_set_optimization_flags(unit_tests-sequant-eval-obj) set_target_properties(unit_tests-sequant-eval-obj PROPERTIES CXX_SCAN_FOR_MODULES OFF) target_link_libraries(unit_tests-sequant-eval-obj PUBLIC SeQuant::eval @@ -59,6 +63,8 @@ set(optimize_test_sources "test_optimize.cpp" ) add_library(unit_tests-sequant-optimize-obj OBJECT ${optimize_test_sources}) +target_set_warning_flags(unit_tests-sequant-optimize-obj) +target_set_optimization_flags(unit_tests-sequant-optimize-obj) set_target_properties(unit_tests-sequant-optimize-obj PROPERTIES CXX_SCAN_FOR_MODULES OFF) target_link_libraries(unit_tests-sequant-optimize-obj PUBLIC SeQuant::optimize SeQuant::bliss @@ -75,6 +81,8 @@ set(export_test_sources "test_export_python.cpp" ) add_library(unit_tests-sequant-export-obj OBJECT ${export_test_sources}) +target_set_warning_flags(unit_tests-sequant-export-obj) +target_set_optimization_flags(unit_tests-sequant-export-obj) set_target_properties(unit_tests-sequant-export-obj PROPERTIES CXX_SCAN_FOR_MODULES OFF) target_link_libraries(unit_tests-sequant-export-obj PUBLIC SeQuant::export SeQuant::optimize @@ -93,6 +101,8 @@ set(mbpt_test_sources ) add_library(unit_tests-sequant-mbpt-obj OBJECT ${mbpt_test_sources}) +target_set_warning_flags(unit_tests-sequant-mbpt-obj) +target_set_optimization_flags(unit_tests-sequant-mbpt-obj) set_target_properties(unit_tests-sequant-mbpt-obj PROPERTIES CXX_SCAN_FOR_MODULES OFF) target_link_libraries(unit_tests-sequant-mbpt-obj PUBLIC SeQuant::mbpt @@ -109,6 +119,8 @@ if (SEQUANT_HAS_TILEDARRAY) "test_cache_manager.cpp" ) add_library(unit_tests-sequant-eval-ta-obj OBJECT ${eval_ta_test_sources}) + target_set_warning_flags(unit_tests-sequant-eval-ta-obj) + target_set_optimization_flags(unit_tests-sequant-eval-ta-obj) set_target_properties(unit_tests-sequant-eval-ta-obj PROPERTIES CXX_SCAN_FOR_MODULES OFF) target_link_libraries(unit_tests-sequant-eval-ta-obj PUBLIC SeQuant::eval::ta SeQuant::mbpt @@ -129,6 +141,8 @@ if (SEQUANT_HAS_BTAS) list(APPEND eval_btas_test_sources "test_cache_manager.cpp") endif() add_library(unit_tests-sequant-eval-btas-obj OBJECT ${eval_btas_test_sources}) + target_set_warning_flags(unit_tests-sequant-eval-btas-obj) + target_set_optimization_flags(unit_tests-sequant-eval-btas-obj) set_target_properties(unit_tests-sequant-eval-btas-obj PROPERTIES CXX_SCAN_FOR_MODULES OFF) target_link_libraries(unit_tests-sequant-eval-btas-obj PUBLIC SeQuant::eval::btas SeQuant::mbpt @@ -145,6 +159,8 @@ endif() if (SEQUANT_HAS_TAPP) set(eval_tapp_test_sources "test_eval_tapp.cpp") add_library(unit_tests-sequant-eval-tapp-obj OBJECT ${eval_tapp_test_sources}) + target_set_warning_flags(unit_tests-sequant-eval-tapp-obj) + target_set_optimization_flags(unit_tests-sequant-eval-tapp-obj) set_target_properties(unit_tests-sequant-eval-tapp-obj PROPERTIES CXX_SCAN_FOR_MODULES OFF) target_link_libraries(unit_tests-sequant-eval-tapp-obj PUBLIC SeQuant::eval::tapp SeQuant::mbpt @@ -243,6 +259,7 @@ if (SEQUANT_INTERNAL_SKIP_LONG_TESTS) endif() target_set_warning_flags(unit_tests-sequant) +target_set_optimization_flags(unit_tests-sequant) if (SEQUANT_TESTS) catch_discover_tests( diff --git a/tests/unit/test_cache_manager.cpp b/tests/unit/test_cache_manager.cpp index f2680480c1..940da1db23 100644 --- a/tests/unit/test_cache_manager.cpp +++ b/tests/unit/test_cache_manager.cpp @@ -242,7 +242,7 @@ TEST_CASE("cache_manager_persistent", "[cache_manager]") { // A persistent entry is never drained: arbitrarily many accesses all return // the stored data (unlike an NP entry, whose data is released after its // max_life-th access). - man.store(p, eval_result(20)); + (void)man.store(p, eval_result(20)); for (int i = 0; i < 10; ++i) { auto r = man.access(p); REQUIRE(r); @@ -252,7 +252,7 @@ TEST_CASE("cache_manager_persistent", "[cache_manager]") { // reset() clears the non-persistent entry but keeps the persistent one, so // the latter's data survives across evaluations (e.g. CC iterations). - man.store(np, eval_result(10)); + (void)man.store(np, eval_result(10)); man.reset(); REQUIRE(man.access(np) == nullptr); // NP cleared by reset auto rp = man.access(p); // P survives reset diff --git a/tests/unit/test_optimize.cpp b/tests/unit/test_optimize.cpp index 77087722f7..2fce6a18ae 100644 --- a/tests/unit/test_optimize.cpp +++ b/tests/unit/test_optimize.cpp @@ -727,7 +727,7 @@ TEST_CASE("optimize", "[optimize]") { container::svector targets; auto aux = opt::detail::batchable_index_list(net, is_batchable); std::size_t const m = aux.size(); - auto batch_fn = [batch](Index const&) -> std::size_t { return batch; }; + auto batch_fn = [](Index const&) -> std::size_t { return batch; }; opt::detail::PeakBatchedModel model{idxsz, is_batchable, batch_fn, /*is_volatile_leaf=*/{}}; auto ctx = model.build_context(net, targets); @@ -769,7 +769,7 @@ TEST_CASE("optimize", "[optimize]") { container::svector targets; auto aux = opt::detail::batchable_index_list(net, is_batchable); auto vmask = opt::detail::leaf_volatile_mask(net, {}); - auto batch_fn = [batch](Index const&) -> std::size_t { return batch; }; + auto batch_fn = [](Index const&) -> std::size_t { return batch; }; auto tables = opt::detail::sliced_footprints( net, targets, idxsz, is_batchable, batch_fn, aux); // open_aux[s] via the SAME detail helper the DP uses, so DP and oracle @@ -811,7 +811,7 @@ TEST_CASE("optimize", "[optimize]") { container::svector targets; // recompute the chosen tree's peak by simulation over the pr // back-pointers (independent of the DP's max/+ recurrence): - auto batch_fn = [batch](Index const&) -> std::size_t { return batch; }; + auto batch_fn = [](Index const&) -> std::size_t { return batch; }; double recon = opt::detail::reconstructed_batched_peak( net, targets, idxsz, is_batchable, batch_fn, {}); double dp = opt::detail::peak_cost_batched(net, targets, idxsz, @@ -2342,7 +2342,7 @@ TEST_CASE("fast_flops equals flops_of over all bipartitions (parity)", std::function const ip_off = {}; bool composite_inner_checked = false; - for (std::wstring const term : + for (std::wstring const& term : {std::wstring(L"g{μ̃1;μ̃2;Κ1} C{a1;μ̃1} C{μ̃2;a2} t{a1;i1}"), std::wstring(L"g{i1;a1;Κ1} g{i2;a2;Κ1} t{a1;i1} t{a2;i2}")}) { for (auto const* ip : {&ip_on, &ip_off}) { diff --git a/utilities/CMakeLists.txt b/utilities/CMakeLists.txt index 76b6aad338..eeedd38a39 100644 --- a/utilities/CMakeLists.txt +++ b/utilities/CMakeLists.txt @@ -9,6 +9,7 @@ foreach(current IN LISTS EXECUTABLE_SOURCES) target_link_libraries(${name} SeQuant) target_set_warning_flags("${name}") + target_set_optimization_flags("${name}") endforeach() add_subdirectory(external-interface) diff --git a/utilities/cost_analysis/CMakeLists.txt b/utilities/cost_analysis/CMakeLists.txt index 9501acabaa..ea4c23b449 100644 --- a/utilities/cost_analysis/CMakeLists.txt +++ b/utilities/cost_analysis/CMakeLists.txt @@ -8,6 +8,7 @@ set_target_properties(cost_analysis PROPERTIES target_link_libraries(cost_analysis PRIVATE SeQuant::mbpt nlohmann_json::nlohmann_json CLI11::CLI11) target_set_warning_flags(cost_analysis) +target_set_optimization_flags(cost_analysis) # The tool writes its report (and any dump-tree file) next to the driver, so # the tests run against a build-tree copy of examples/ rather than the source diff --git a/utilities/external-interface/CMakeLists.txt b/utilities/external-interface/CMakeLists.txt index cb1071235d..2cb0c0133c 100644 --- a/utilities/external-interface/CMakeLists.txt +++ b/utilities/external-interface/CMakeLists.txt @@ -22,6 +22,7 @@ target_link_libraries(external_interface ) target_set_warning_flags(external_interface) +target_set_optimization_flags(external_interface) foreach(DRIVER IN ITEMS "ccsd" "nevpt2") add_test(