diff --git a/.github/workflows/linux_with_bench_test.yml b/.github/workflows/linux_with_bench_test.yml new file mode 100644 index 000000000000..0dd7522661d6 --- /dev/null +++ b/.github/workflows/linux_with_bench_test.yml @@ -0,0 +1,46 @@ +# Copyright (c) 2024 Vedant Nimje +# +# SPDX-License-Identifier: BSL-1.0 +# Distributed under the Boost Software License, Version 1.0. (See accompanying +# file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) + +name: Linux CI (Debug) with Benchmark Test + +on: [pull_request] + + +jobs: + build: + runs-on: ubuntu-latest + container: stellargroup/build_env:14 + + steps: + - uses: actions/checkout@v4 + - name: Configure + shell: bash + run: | + cmake \ + . \ + -Bbuild \ + -GNinja \ + -DCMAKE_BUILD_TYPE=Debug \ + -DHPX_WITH_MALLOC=system \ + -DHPX_WITH_FETCH_ASIO=ON \ + -DHPX_WITH_EXAMPLES=ON \ + -DHPX_WITH_TESTS=ON \ + -DHPX_WITH_TESTS_MAX_THREADS_PER_LOCALITY=2 \ + -DHPX_WITH_CHECK_MODULE_DEPENDENCIES=On + - name: Build + shell: bash + run: | + cmake --build build/ --target tests.performance.modules.segmented_algorithms.minmax_element_performance + - name: Test + shell: bash + run: | + cd build + ./bin/minmax_element_performance_test + - name: Test with detailed output + shell: bash + run: | + cd build + ./bin/minmax_element_performance_test --detailed_bench diff --git a/.github/workflows/linux_with_nanobench_test.yml b/.github/workflows/linux_with_nanobench_test.yml new file mode 100644 index 000000000000..f8cc8213a5f3 --- /dev/null +++ b/.github/workflows/linux_with_nanobench_test.yml @@ -0,0 +1,48 @@ +# Copyright (c) 2024 Vedant Nimje +# +# SPDX-License-Identifier: BSL-1.0 +# Distributed under the Boost Software License, Version 1.0. (See accompanying +# file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) + +name: Linux CI (Debug) with Nanobench Benchmark Test + +on: [pull_request] + + +jobs: + build: + runs-on: ubuntu-latest + container: stellargroup/build_env:14 + + steps: + - uses: actions/checkout@v4 + - name: Configure + shell: bash + run: | + cmake \ + . \ + -Bbuild \ + -GNinja \ + -DCMAKE_BUILD_TYPE=Debug \ + -DHPX_WITH_MALLOC=system \ + -DHPX_WITH_FETCH_ASIO=ON \ + -DHPX_WITH_EXAMPLES=ON \ + -DHPX_WITH_TESTS=ON \ + -DHPX_WITH_NANOBENCH=ON \ + -DHPX_WITH_TESTS_MAX_THREADS_PER_LOCALITY=2 \ + -DHPX_WITH_CHECK_MODULE_DEPENDENCIES=On + - name: Build + shell: bash + run: | + cmake --build build/ --target tests.performance.modules.segmented_algorithms.minmax_element_performance + - name: Test + shell: bash + run: | + cd build + ./bin/minmax_element_performance_test + + - name: Test with detailed output + shell: bash + run: | + cd build + ./bin/minmax_element_performance_test --detailed_bench diff --git a/.jenkins/lsu-perftests/launch_perftests.sh b/.jenkins/lsu-perftests/launch_perftests.sh old mode 100644 new mode 100755 index 5e8c6e0a57e1..b744f600d1cf --- a/.jenkins/lsu-perftests/launch_perftests.sh +++ b/.jenkins/lsu-perftests/launch_perftests.sh @@ -16,13 +16,13 @@ hpx_targets=( hpx_test_options=( "--hpx:ini=hpx.thread_queue.init_threads_count=100 \ --hpx:threads=4 --vector_size=104857 --work_delay=1 \ - --chunk_size=0 --test_count=200" + --chunk_size=0 --test_count=200 --detailed_bench" "--hpx:ini=hpx.thread_queue.init_threads_count=100 \ --hpx:queuing=local-priority --hpx:threads=4 --test-all \ - --repetitions=40 --futures=207270" + --repetitions=40 --futures=207270 --detailed_bench" "--hpx:ini=hpx.thread_queue.init_threads_count=100 \ --vector_size=518176 --hpx:threads=4 --iterations=200 \ - --warmup_iterations=20") + --warmup_iterations=20 --detailed_bench") # Build binaries for performance tests ${perftests_dir}/driver.py -v -l $logfile build -b release -o build \ diff --git a/CMakeLists.txt b/CMakeLists.txt index a83bd619a3bf..a8a829c3bd46 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1050,6 +1050,15 @@ hpx_option( ADVANCED ) +hpx_option( + HPX_WITH_NANOBENCH + BOOL + "Use Nanobench for performance tests. Nanobench will be fetched using FetchContent (default: OFF)" + OFF + CATEGORY "Build Targets" + ADVANCED +) + # cmake-format: off # LibCDS option # NOTE: The libcds option is disabled for the 1.5.0 release as it is not ready @@ -1286,6 +1295,10 @@ if(HPX_WITH_NETWORKING) if(HPX_WITH_PARCELPORT_ACTION_COUNTERS) hpx_add_config_define(HPX_HAVE_PARCELPORT_ACTION_COUNTERS) endif() + if(HPX_WITH_NANOBENCH) + hpx_add_config_define(HPX_HAVE_NANOBENCH) + include(HPX_SetupNanobench) + endif() else(HPX_WITH_NETWORKING) # if networking is off, then allow the option of using our asynchronous MPI # features @@ -2576,6 +2589,10 @@ if(HPX_WITH_PRECOMPILED_HEADERS) ) + if(HPX_WITH_NANOBENCH) + set(system_precompiled_headers ${system_precompiled_headers} ) + endif() + if(HPX_WITH_CXX17_FILESYSTEM) list(APPEND system_precompiled_headers ) endif() diff --git a/cmake/HPX_SetupNanobench.cmake b/cmake/HPX_SetupNanobench.cmake new file mode 100644 index 000000000000..14ba9880a209 --- /dev/null +++ b/cmake/HPX_SetupNanobench.cmake @@ -0,0 +1,47 @@ +include(FetchContent) + +fetchcontent_declare( + nanobench + GIT_REPOSITORY https://github.com/martinus/nanobench.git + GIT_TAG v4.3.11 + GIT_SHALLOW TRUE +) + +if(NOT nanobench_POPULATED) + fetchcontent_populate(nanobench) +endif() +set(Nanobench_ROOT ${nanobench_SOURCE_DIR}) + +add_library(nanobench INTERFACE) +target_include_directories( + nanobench SYSTEM INTERFACE $ + $ +) + +install( + TARGETS nanobench + EXPORT HPXNanobenchTarget + COMPONENT core +) + +install( + FILES ${NANOBENCH_ROOT}/include/nanobench.h + DESTINATION ${CMAKE_INSTALL_INCLUDEDIR} + COMPONENT core +) + +export( + TARGETS nanobench + NAMESPACE nanobench:: + FILE "${CMAKE_CURRENT_BINARY_DIR}/lib/cmake/${HPX_PACKAGE_NAME}/HPXNanobenchTarget.cmake" +) + +install( + EXPORT HPXNanobenchTarget + NAMESPACE nanobench:: + FILE HPXNanobenchTarget.cmake + DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/${HPX_PACKAGE_NAME} + COMPONENT cmake +) + +add_library(nanobench::nanobench ALIAS nanobench) diff --git a/libs/core/algorithms/tests/performance/foreach_report.cpp b/libs/core/algorithms/tests/performance/foreach_report.cpp index 9d91491271ec..0ee6030a1f70 100644 --- a/libs/core/algorithms/tests/performance/foreach_report.cpp +++ b/libs/core/algorithms/tests/performance/foreach_report.cpp @@ -41,6 +41,8 @@ int hpx_main(hpx::program_options::variables_map& vm) disable_stealing = vm.count("disable_stealing"); fast_idle_mode = vm.count("fast_idle_mode"); + hpx::util::perftests_init(vm); + // verify that input is within domain of program if (test_count == 0 || test_count < 0) { @@ -122,6 +124,7 @@ int main(int argc, char* argv[]) ; // clang-format on + hpx::util::perftests_cfg(cmdline); hpx::local::init_params init_args; init_args.desc_cmdline = cmdline; init_args.cfg = {"hpx.os_threads=all"}; diff --git a/libs/core/command_line_handling_local/src/parse_command_line_local.cpp b/libs/core/command_line_handling_local/src/parse_command_line_local.cpp index dceab26cb24e..f4788e8896fd 100644 --- a/libs/core/command_line_handling_local/src/parse_command_line_local.cpp +++ b/libs/core/command_line_handling_local/src/parse_command_line_local.cpp @@ -614,6 +614,7 @@ namespace hpx::local::detail { ("hpx:debug-app-log", value()->implicit_value("cout"), "enable all messages on the application log channel and send all " "application logs to the target destination") + // ("hpx:verbose_bench", "For logging benchmarks in detail") ; all_options[options_type::hidden_options].add_options() diff --git a/libs/core/datastructures/tests/performance/small_vector_benchmark.cpp b/libs/core/datastructures/tests/performance/small_vector_benchmark.cpp index 964a3aa75c0a..afee73c2878b 100644 --- a/libs/core/datastructures/tests/performance/small_vector_benchmark.cpp +++ b/libs/core/datastructures/tests/performance/small_vector_benchmark.cpp @@ -9,6 +9,7 @@ #include #include #include +#include #include #include @@ -19,29 +20,13 @@ /////////////////////////////////////////////////////////////////////////////// template -std::uint64_t measure(std::size_t repeat, std::size_t size) +void fill(std::size_t size) { - std::uint64_t start = hpx::chrono::high_resolution_clock::now(); - for (std::size_t i = 0; i != repeat; ++i) + Container cont; + for (std::size_t i = 0; i != size; ++i) { - Container cont; - for (std::size_t i = 0; i != size; ++i) - { - cont.push_back(typename Container::value_type{}); - } + cont.push_back(typename Container::value_type{}); } - return (hpx::chrono::high_resolution_clock::now() - start) / repeat; -} - -template -void compare(std::size_t repeat, std::size_t size) -{ - std::uint64_t time = measure>(repeat, size); - - std::cout << "-----Average-(hpx::small_vector<" << typeid(T).name() << ", " - << N << ">)------ \n" - << std::left << "Average execution time : " << std::right - << std::setw(8) << time / 1e9 << "\n"; } int hpx_main(hpx::program_options::variables_map& vm) @@ -50,30 +35,59 @@ int hpx_main(hpx::program_options::variables_map& vm) std::size_t repeat = vm["test_count"].as(); std::size_t size = vm["vector_size"].as(); - std::cout << std::left - << "----------------Parameters---------------------\n" - << std::left - << "Vector size : " << std::right - << std::setw(8) << size << "\n" - << std::left - << "Number of tests : " << std::right - << std::setw(8) << repeat << "\n" - << std::left - << "Display time in : " << std::right - << std::setw(8) << "Seconds\n" - << std::flush; - - compare(repeat, size); - compare(repeat, size); - compare(repeat, size); - compare(repeat, size); - compare(repeat, size); - - compare, 1>(repeat, size); - compare, 2>(repeat, size); - compare, 4>(repeat, size); - compare, 8>(repeat, size); - compare, 16>(repeat, size); + hpx::util::perftests_init(vm); + + // int + + hpx::util::perftests_report("hpx::small_vector", "", repeat, + [&] { fill>(size); }); + + hpx::util::perftests_report("hpx::small_vector", "", repeat, + [&] { fill>(size); }); + + hpx::util::perftests_report("hpx::small_vector", "", repeat, + [&] { fill>(size); }); + + hpx::util::perftests_report("hpx::small_vector", "", repeat, + [&] { fill>(size); }); + + hpx::util::perftests_report("hpx::small_vector", "", repeat, + [&] { fill>(size); }); + + // hpx::move_only_function + + hpx::util::perftests_report( + "hpx::small_vector", ", 1>", repeat, [&] { + fill, 1>>( + size); + }); + + hpx::util::perftests_report( + "hpx::small_vector", ", 2>", repeat, [&] { + fill, 2>>( + size); + }); + + hpx::util::perftests_report( + "hpx::small_vector", ", 4>", repeat, [&] { + fill, 4>>( + size); + }); + + hpx::util::perftests_report( + "hpx::small_vector", ", 8>", repeat, [&] { + fill, 8>>( + size); + }); + + hpx::util::perftests_report( + "hpx::small_vector", ", 16>", repeat, [&] { + fill< + hpx::detail::small_vector, 16>>( + size); + }); + + hpx::util::perftests_print_times(); return hpx::local::finalize(); } @@ -97,6 +111,8 @@ int main(int argc, char* argv[]) ; // clang-format on + hpx::util::perftests_cfg(cmdline); + hpx::local::init_params init_args; init_args.desc_cmdline = cmdline; init_args.cfg = cfg; diff --git a/libs/core/testing/CMakeLists.txt b/libs/core/testing/CMakeLists.txt index de9e4c969fe9..b7f8c2a0347e 100644 --- a/libs/core/testing/CMakeLists.txt +++ b/libs/core/testing/CMakeLists.txt @@ -20,6 +20,20 @@ set(testing_compat_headers # Default location is $HPX_ROOT/libs/testing/src set(testing_sources testing.cpp performance.cpp) +set(module_deps + hpx_assertion + hpx_config + hpx_format + hpx_functional + hpx_preprocessor + hpx_util + hpx_command_line_handling_local +) + +if(HPX_WITH_NANOBENCH) + set(module_deps ${module_deps} nanobench) +endif() + include(HPX_AddModule) add_hpx_module( core testing @@ -27,7 +41,6 @@ add_hpx_module( SOURCES ${testing_sources} HEADERS ${testing_headers} COMPAT_HEADERS ${testing_compat_headers} - MODULE_DEPENDENCIES hpx_assertion hpx_config hpx_format hpx_functional - hpx_preprocessor hpx_util + MODULE_DEPENDENCIES ${module_deps} CMAKE_SUBDIRS examples tests ) diff --git a/libs/core/testing/include/hpx/testing/performance.hpp b/libs/core/testing/include/hpx/testing/performance.hpp index d957ac6f2b14..1470a6b51aa8 100644 --- a/libs/core/testing/include/hpx/testing/performance.hpp +++ b/libs/core/testing/include/hpx/testing/performance.hpp @@ -8,15 +8,30 @@ #include #include +#include #include #include namespace hpx::util { - + HPX_CORE_EXPORT inline bool detailed_; + HPX_CORE_EXPORT void perftests_cfg( + hpx::program_options::options_description& cmdline); + HPX_CORE_EXPORT void perftests_init( + const hpx::program_options::variables_map& vm); +#if defined(HPX_HAVE_NANOBENCH) + HPX_CORE_EXPORT void perftests_report(std::string const& name, + std::string const& exec, std::size_t const steps, + hpx::function&& test); + HPX_CORE_EXPORT void perftests_print_times( + std::ostream& strm, char const* templ); + HPX_CORE_EXPORT void perftests_print_times(std::ostream& strm); + HPX_CORE_EXPORT void perftests_print_times(); +#else HPX_CORE_EXPORT void perftests_report(std::string const& name, std::string const& exec, std::size_t const steps, hpx::function&& test); HPX_CORE_EXPORT void perftests_print_times(); +#endif } // namespace hpx::util diff --git a/libs/core/testing/src/performance.cpp b/libs/core/testing/src/performance.cpp index 5cd224ff1497..0227a776785a 100644 --- a/libs/core/testing/src/performance.cpp +++ b/libs/core/testing/src/performance.cpp @@ -15,15 +15,78 @@ #include #include +#if defined(HPX_HAVE_NANOBENCH) +#define ANKERL_NANOBENCH_IMPLEMENT +#include +#endif + namespace hpx::util { + void perftests_cfg(hpx::program_options::options_description& cmdline) + { + cmdline.add_options()("detailed_bench", + "Use if detailed benchmarks are required, showing the execution " + "time taken for each epoch"); + } + + void perftests_init(const hpx::program_options::variables_map& vm) + { + if (vm.count("detailed_bench")) + { + detailed_ = true; + } + } + namespace detail { +#if defined(HPX_HAVE_NANOBENCH) + constexpr int nanobench_epochs = 24; + constexpr int nanobench_warmup = 40; + + char const* nanobench_hpx_simple_template() noexcept + { + return R"DELIM(Results: +{{#result}} +name: {{name}}, +executor: {{context(executor)}}, +average: {{average(elapsed)}}{{^-last}} +{{/-last}} +{{/result}})DELIM"; + } + + char const* nanobench_hpx_template() noexcept + { + return R"DELIM({ + "outputs": [ +{{#result}} { + "name": "{{name}}", + "executor": "{{context(executor)}}", + "series": [ + {{#measurement}}{{elapsed}}{{^-last}}, + {{/-last}}{{/measurement}} + ] + }{{^-last}},{{/-last}} +{{/result}} ] +} +)DELIM"; + } + + ankerl::nanobench::Bench& bench() + { + static ankerl::nanobench::Bench b; + static ankerl::nanobench::Config cfg; + + cfg.mWarmup = nanobench_warmup; + cfg.mNumEpochs = nanobench_epochs; + + return b.config(cfg); + } +#else // Json output for performance reports class json_perf_times { using key_t = std::tuple; - using value_t = std::vector; + using value_t = std::vector; using map_t = std::map; map_t m_map; @@ -33,7 +96,7 @@ namespace hpx::util { public: HPX_CORE_EXPORT void add(std::string const& name, - std::string const& executor, double time); + std::string const& executor, long double time); }; json_perf_times& times() @@ -43,55 +106,127 @@ namespace hpx::util { } void add_time(std::string const& test_name, std::string const& executor, - double time) + long double time) { times().add(test_name, executor, time); } std::ostream& operator<<(std::ostream& strm, json_perf_times const& obj) { - strm << "{\n"; - strm << " \"outputs\" : ["; - int outputs = 0; - for (auto&& item : obj.m_map) + if (detailed_) { + strm << "{\n"; + strm << " \"outputs\" : ["; + int outputs = 0; + for (auto&& item : obj.m_map) + { + long double average = static_cast(0.0); + if (outputs) + strm << ","; + strm << "\n {\n"; + strm << R"( "name": ")" << std::get<0>(item.first) + << "\",\n"; + strm << R"( "executor": ")" << std::get<1>(item.first) + << "\",\n"; + strm << R"( "series": [)" + << "\n"; + int series = 0; + strm.precision( + std::numeric_limits::max_digits10 - 1); + for (long double const val : item.second) + { + if (series) + { + strm << ",\n"; + } + strm << R"( )" << std::scientific << val; + ++series; + average += val; + } + strm << "\n ],\n"; + strm << std::scientific << R"( "average": )" + << average / series << "\n"; + strm << " }"; + ++outputs; + } if (outputs) - strm << ","; - strm << "\n {\n"; - strm << R"( "name" : ")" << std::get<0>(item.first) - << "\",\n"; - strm << R"( "executor" : ")" << std::get<1>(item.first) - << "\",\n"; - strm << R"( "series" : [)"; - double average = 0.0; - int series = 0; - for (auto const val : item.second) + strm << "\n"; + strm << "]\n"; + strm << "}\n"; + } + else + { + strm << "Results:\n\n"; + for (auto&& item : obj.m_map) { - if (series) - strm << ", "; - strm << val; - ++series; - average += val; + long double average = static_cast(0.0); + int series = 0; + strm << "name: " << std::get<0>(item.first) << "\n"; + strm << "executor: " << std::get<1>(item.first) << "\n"; + for (long double const val : item.second) + { + ++series; + average += val; + } + strm.precision( + std::numeric_limits::max_digits10 - 1); + strm << std::scientific << "average: " << average / series + << "\n\n"; } - strm << "],\n"; - strm << " \"average\" : " << average / series << "\n"; - strm << " }"; - ++outputs; } - if (outputs) - strm << "\n "; - strm << "]\n"; - strm << "}\n"; return strm; } - void json_perf_times::add( - std::string const& name, std::string const& executor, double time) + void json_perf_times::add(std::string const& name, + std::string const& executor, long double time) { m_map[key_t(name, executor)].push_back(time); } +#endif + } // namespace detail +#if defined(HPX_HAVE_NANOBENCH) + void perftests_report(std::string const& name, std::string const& exec, + std::size_t const steps, hpx::function&& test) + { + if (steps == 0) + return; + + std::size_t const steps_per_epoch = + steps / detail::nanobench_epochs + 1; + + detail::bench() + .name(name) + .context("executor", exec) + .minEpochIterations(steps_per_epoch) + .run(test); + } + + // Print all collected results to the provided stream, + // formatted the json according to the provided + // "mustache-style" template + void perftests_print_times(char const* templ, std::ostream& strm) + { + detail::bench().render(templ, strm); + } + + // Overload that uses a default nanobench template + void perftests_print_times(std::ostream& strm) + { + perftests_print_times(detail::nanobench_hpx_template(), strm); + } + + // Overload that uses a default nanobench template and prints to std::cout + void perftests_print_times() + { + if (detailed_) + perftests_print_times(detail::nanobench_hpx_template(), std::cout); + else + perftests_print_times( + detail::nanobench_hpx_simple_template(), std::cout); + } +#else void perftests_report(std::string const& name, std::string const& exec, std::size_t const steps, hpx::function&& test) { @@ -101,7 +236,7 @@ namespace hpx::util { // First iteration to cache the data test(); using timer = std::chrono::high_resolution_clock; - for (size_t i = 0; i != steps; ++i) + for (std::size_t i = 0; i != steps; ++i) { // For now we don't flush the cache //flush_cache(); @@ -109,7 +244,7 @@ namespace hpx::util { test(); // default is in seconds auto time = - std::chrono::duration_cast>( + std::chrono::duration_cast>( timer::now() - start); detail::add_time(name, exec, time.count()); } @@ -119,4 +254,5 @@ namespace hpx::util { { std::cout << detail::times(); } +#endif } // namespace hpx::util diff --git a/libs/full/segmented_algorithms/tests/performance/minmax_element_performance.cpp b/libs/full/segmented_algorithms/tests/performance/minmax_element_performance.cpp index dfbc603a7e92..85e1293e0a71 100644 --- a/libs/full/segmented_algorithms/tests/performance/minmax_element_performance.cpp +++ b/libs/full/segmented_algorithms/tests/performance/minmax_element_performance.cpp @@ -13,9 +13,9 @@ #include #include #include -#include - #include +#include +#include #include #include @@ -52,60 +52,6 @@ struct random_fill } }; -/////////////////////////////////////////////////////////////////////////////// -double run_min_element_benchmark( - int test_count, hpx::partitioned_vector const& v) -{ - std::uint64_t time = hpx::chrono::high_resolution_clock::now(); - - for (int i = 0; i != test_count; ++i) - { - // invoke minmax - /*auto iters = */ hpx::min_element( - hpx::execution::par, v.begin(), v.end()); - } - - time = hpx::chrono::high_resolution_clock::now() - time; - - return (time * 1e-9) / test_count; -} - -/////////////////////////////////////////////////////////////////////////////// -double run_max_element_benchmark( - int test_count, hpx::partitioned_vector const& v) -{ - std::uint64_t time = hpx::chrono::high_resolution_clock::now(); - - for (int i = 0; i != test_count; ++i) - { - // invoke minmax - /*auto iters = */ hpx::max_element( - hpx::execution::par, v.begin(), v.end()); - } - - time = hpx::chrono::high_resolution_clock::now() - time; - - return (time * 1e-9) / test_count; -} - -/////////////////////////////////////////////////////////////////////////////// -double run_minmax_element_benchmark( - int test_count, hpx::partitioned_vector const& v) -{ - std::uint64_t time = hpx::chrono::high_resolution_clock::now(); - - for (int i = 0; i != test_count; ++i) - { - // invoke minmax - /*auto iters = */ hpx::minmax_element( - hpx::execution::par, v.begin(), v.end()); - } - - time = hpx::chrono::high_resolution_clock::now() - time; - - return (time * 1e-9) / test_count; -} - /////////////////////////////////////////////////////////////////////////////// int hpx_main(hpx::program_options::variables_map& vm) { @@ -123,18 +69,20 @@ int hpx_main(hpx::program_options::variables_map& vm) // initialize data hpx::generate(hpx::execution::par, v.begin(), v.end(), random_fill()); + hpx::util::perftests_init(vm); + // run benchmark - double time_minmax = run_minmax_element_benchmark(test_count, v); - double time_min = run_min_element_benchmark(test_count, v); - double time_max = run_max_element_benchmark(test_count, v); - - // if (csvoutput) - { - std::cout << "minmax" << test_count << "," << time_minmax - << std::endl; - std::cout << "min" << test_count << "," << time_min << std::endl; - std::cout << "max" << test_count << "," << time_max << std::endl; - } + hpx::util::perftests_report("hpx::minmax", "par", test_count, [&] { + hpx::minmax_element(hpx::execution::par, v.begin(), v.end()); + }); + + hpx::util::perftests_report("hpx::min", "par", test_count, + [&] { hpx::min_element(hpx::execution::par, v.begin(), v.end()); }); + + hpx::util::perftests_report("hpx::max", "par", test_count, + [&] { hpx::max_element(hpx::execution::par, v.begin(), v.end()); }); + + hpx::util::perftests_print_times(); return hpx::finalize(); } @@ -162,6 +110,8 @@ int main(int argc, char* argv[]) hpx::program_options::value(), "the random number generator seed to use for this run"); + hpx::util::perftests_cfg(cmdline); + hpx::init_params init_args; init_args.desc_cmdline = cmdline; init_args.cfg = cfg; diff --git a/tests/performance/local/future_overhead_report.cpp b/tests/performance/local/future_overhead_report.cpp index 05acfd7af2eb..0212360596b8 100644 --- a/tests/performance/local/future_overhead_report.cpp +++ b/tests/performance/local/future_overhead_report.cpp @@ -165,6 +165,9 @@ int hpx_main(variables_map& vm) num_iterations = vm["delay-iterations"].as(); const std::uint64_t count = vm["futures"].as(); + + hpx::util::perftests_init(vm); + if (HPX_UNLIKELY(0 == count)) throw std::logic_error("error: count of 0 futures specified\n"); @@ -201,6 +204,7 @@ int main(int argc, char* argv[]) // clang-format on // Initialize and run HPX. + hpx::util::perftests_cfg(cmdline); hpx::local::init_params init_args; init_args.desc_cmdline = cmdline; diff --git a/tests/performance/local/stream_report.cpp b/tests/performance/local/stream_report.cpp index c693daa89681..7cef564a6ab8 100644 --- a/tests/performance/local/stream_report.cpp +++ b/tests/performance/local/stream_report.cpp @@ -442,6 +442,7 @@ int hpx_main(hpx::program_options::variables_map& vm) std::size_t iterations = vm["iterations"].as(); std::size_t warmup_iterations = vm["warmup_iterations"].as(); std::size_t chunk_size = vm["chunk_size"].as(); + hpx::util::perftests_init(vm); std::size_t executor; header = vm.count("header") > 0; @@ -548,6 +549,7 @@ int main(int argc, char* argv[]) "hpx.numa_sensitive=2" // no-cross NUMA stealing }; + hpx::util::perftests_cfg(cmdline); hpx::init_params init_args; init_args.desc_cmdline = cmdline; init_args.cfg = cfg;