From 3ddf1dea066da98e6a84ac83a84fe372d547874c Mon Sep 17 00:00:00 2001 From: meriadeg perrinel Date: Tue, 7 Feb 2023 10:40:42 +0100 Subject: [PATCH] #5: Fixed clang format and removed form this PR benchmark modification benchmark modification will come through another PR --- .../src/KokkosKernels_PrintConfguration.hpp | 97 ++++++++++++------- .../Test_Common_PrintConfiguration.hpp | 17 ++-- perf_test/Benchmark_Context.hpp | 10 +- 3 files changed, 75 insertions(+), 49 deletions(-) diff --git a/common/src/KokkosKernels_PrintConfguration.hpp b/common/src/KokkosKernels_PrintConfguration.hpp index ee428dd658..c28a109225 100644 --- a/common/src/KokkosKernels_PrintConfguration.hpp +++ b/common/src/KokkosKernels_PrintConfguration.hpp @@ -25,92 +25,119 @@ namespace KokkosKernels { namespace Impl { inline void print_enabled_tpls(std::ostream& os) { #ifdef KOKKOSKERNELS_ENABLE_TPL_LAPACK - os << " " << "KOKKOSKERNELS_ENABLE_TPL_LAPACK: yes\n"; + os << " " + << "KOKKOSKERNELS_ENABLE_TPL_LAPACK: yes\n"; #else - os << " " << "KOKKOSKERNELS_ENABLE_TPL_LAPACK: no\n"; + os << " " + << "KOKKOSKERNELS_ENABLE_TPL_LAPACK: no\n"; #endif #ifdef KOKKOSKERNELS_ENABLE_TPL_BLAS - os << " " << "KOKKOSKERNELS_ENABLE_TPL_BLAS: yes\n"; + os << " " + << "KOKKOSKERNELS_ENABLE_TPL_BLAS: yes\n"; #else - os << " " << "KOKKOSKERNELS_ENABLE_TPL_BLAS: no\n"; + os << " " + << "KOKKOSKERNELS_ENABLE_TPL_BLAS: no\n"; #endif #ifdef KOKKOSKERNELS_ENABLE_TPL_CBLAS - os << " " << "KOKKOSKERNELS_ENABLE_TPL_CBLAS: yes\n"; + os << " " + << "KOKKOSKERNELS_ENABLE_TPL_CBLAS: yes\n"; #else - os << " " << "KOKKOSKERNELS_ENABLE_TPL_CBLAS: no\n"; + os << " " + << "KOKKOSKERNELS_ENABLE_TPL_CBLAS: no\n"; #endif #ifdef KOKKOSKERNELS_ENABLE_TPL_LAPACKE - os << " " << "KOKKOSKERNELS_ENABLE_TPL_LAPACKE: yes\n"; + os << " " + << "KOKKOSKERNELS_ENABLE_TPL_LAPACKE: yes\n"; #else - os << " " << "KOKKOSKERNELS_ENABLE_TPL_LAPACKE: no\n"; + os << " " + << "KOKKOSKERNELS_ENABLE_TPL_LAPACKE: no\n"; #endif #ifdef KOKKOSKERNELS_ENABLE_TPL_SUPERLU - os << " " << "KOKKOSKERNELS_ENABLE_TPL_SUPERLU: yes\n"; + os << " " + << "KOKKOSKERNELS_ENABLE_TPL_SUPERLU: yes\n"; #else - os << " " << "KOKKOSKERNELS_ENABLE_TPL_SUPERLU: no\n"; + os << " " + << "KOKKOSKERNELS_ENABLE_TPL_SUPERLU: no\n"; #endif #ifdef KOKKOSKERNELS_ENABLE_TPL_CHOLMOD - os << " " << "KOKKOSKERNELS_ENABLE_TPL_CHOLMOD: yes\n"; + os << " " + << "KOKKOSKERNELS_ENABLE_TPL_CHOLMOD: yes\n"; #else - os << " " << "KOKKOSKERNELS_ENABLE_TPL_CHOLMOD: no\n"; + os << " " + << "KOKKOSKERNELS_ENABLE_TPL_CHOLMOD: no\n"; #endif #ifdef KOKKOSKERNELS_ENABLE_TPL_MKL - os << " " << "KOKKOSKERNELS_ENABLE_TPL_MKL: yes\n"; + os << " " + << "KOKKOSKERNELS_ENABLE_TPL_MKL: yes\n"; #else - os << " " << "KOKKOSKERNELS_ENABLE_TPL_MKL: no\n"; + os << " " + << "KOKKOSKERNELS_ENABLE_TPL_MKL: no\n"; #endif #ifdef KOKKOSKERNELS_ENABLE_TPL_CUBLAS - os << " " << "KOKKOSKERNELS_ENABLE_TPL_CUBLAS: yes\n"; + os << " " + << "KOKKOSKERNELS_ENABLE_TPL_CUBLAS: yes\n"; #else - os << " " << "KOKKOSKERNELS_ENABLE_TPL_CUBLAS: no\n"; + os << " " + << "KOKKOSKERNELS_ENABLE_TPL_CUBLAS: no\n"; #endif #ifdef KOKKOSKERNELS_ENABLE_TPL_CUSPARSE - os << " " << "KOKKOSKERNELS_ENABLE_TPL_CUSPARSE: yes\n"; + os << " " + << "KOKKOSKERNELS_ENABLE_TPL_CUSPARSE: yes\n"; #else - os << " " << "KOKKOSKERNELS_ENABLE_TPL_CUSPARSE: no\n"; + os << " " + << "KOKKOSKERNELS_ENABLE_TPL_CUSPARSE: no\n"; #endif #ifdef KOKKOSKERNELS_ENABLE_TPL_ROCBLAS - os << " " << "KOKKOSKERNELS_ENABLE_TPL_ROCBLAS: yes\n"; + os << " " + << "KOKKOSKERNELS_ENABLE_TPL_ROCBLAS: yes\n"; #else - os << " " << "KOKKOSKERNELS_ENABLE_TPL_ROCBLAS: no\n"; + os << " " + << "KOKKOSKERNELS_ENABLE_TPL_ROCBLAS: no\n"; #endif #ifdef KOKKOSKERNELS_ENABLE_TPL_ROCPARSE - os << " " << "KOKKOSKERNELS_ENABLE_TPL_ROCPARSE: yes\n"; + os << " " + << "KOKKOSKERNELS_ENABLE_TPL_ROCPARSE: yes\n"; #else - os << " " << "KOKKOSKERNELS_ENABLE_TPL_ROCPARSE: no\n"; + os << " " + << "KOKKOSKERNELS_ENABLE_TPL_ROCPARSE: no\n"; #endif #ifdef KOKKOSKERNELS_ENABLE_TPL_METIS os << "KOKKOSKERNELS_ENABLE_TPL_METIS: yes\n"; #else - os << " " << "KOKKOSKERNELS_ENABLE_TPL_METIS: no\n"; + os << " " + << "KOKKOSKERNELS_ENABLE_TPL_METIS: no\n"; #endif #ifdef KOKKOSKERNELS_ENABLE_TPL_ARMPL - os << " " << "KOKKOSKERNELS_ENABLE_TPL_ARMPL: yes\n"; + os << " " + << "KOKKOSKERNELS_ENABLE_TPL_ARMPL: yes\n"; #else - os << " " << "KOKKOSKERNELS_ENABLE_TPL_ARMPL: no\n"; + os << " " + << "KOKKOSKERNELS_ENABLE_TPL_ARMPL: no\n"; #endif #ifdef KOKKOSKERNELS_ENABLE_TPL_MAGMA - os << " " << "KOKKOSKERNELS_ENABLE_TPL_MAGMA: yes\n"; + os << " " + << "KOKKOSKERNELS_ENABLE_TPL_MAGMA: yes\n"; #else - os << " " << "KOKKOSKERNELS_ENABLE_TPL_MAGMA: no\n"; + os << " " + << "KOKKOSKERNELS_ENABLE_TPL_MAGMA: no\n"; #endif - } inline void print_version(std::ostream& os) { - // KOKKOSKERNELS_VERSION is used because MAJOR, MINOR and PATCH macros - // are not available in Kernels - os << " "<<"Kernels Version: "<< KOKKOSKERNELS_VERSION <<'\n'; + // KOKKOSKERNELS_VERSION is used because MAJOR, MINOR and PATCH macros + // are not available in Kernels + os << " " + << "Kernels Version: " << KOKKOSKERNELS_VERSION << '\n'; } } // namespace Impl inline void print_configuration(std::ostream& os) { - Impl::print_version(os); + Impl::print_version(os); - os << "TPLs: \n"; - Impl::print_enabled_tpls(os); + os << "TPLs: \n"; + Impl::print_enabled_tpls(os); } } // namespace KokkosKernels -#endif // _KOKKOSKERNELS_PRINT_CONFIGURATION_HPP +#endif // _KOKKOSKERNELS_PRINT_CONFIGURATION_HPP diff --git a/common/unit_test/Test_Common_PrintConfiguration.hpp b/common/unit_test/Test_Common_PrintConfiguration.hpp index 8cec466217..ac85734145 100644 --- a/common/unit_test/Test_Common_PrintConfiguration.hpp +++ b/common/unit_test/Test_Common_PrintConfiguration.hpp @@ -27,7 +27,7 @@ void check_print_configuration(std::ostream& os) { std::ostringstream msg; KokkosKernels::print_configuration(msg); - bool kernelsVersionKeyFound = false; + bool kernelsVersionKeyFound = false; bool enabledTPLsNamesKeyFound = false; // Iterate over lines returned from kokkos and extract key:value pairs std::stringstream ss{msg.str()}; @@ -36,18 +36,17 @@ void check_print_configuration(std::ostream& os) { if (found != std::string::npos) { auto currentKey = line.substr(0, found); if (currentKey == " Kernels Version") { - kernelsVersionKeyFound = true; - } - else if (currentKey == "TPLs") { - enabledTPLsNamesKeyFound = true; + kernelsVersionKeyFound = true; + } else if (currentKey == "TPLs") { + enabledTPLsNamesKeyFound = true; } } } EXPECT_TRUE(kernelsVersionKeyFound && enabledTPLsNamesKeyFound); - } -/// \brief Verify that print_configuration print the expected keys from kernels configuration +/// \brief Verify that print_configuration print the expected keys from kernels +/// configuration template void testPrintConfiguration() { std::ostringstream out; @@ -55,6 +54,8 @@ void testPrintConfiguration() { check_print_configuration(out); } -TEST_F(TestCategory, common_print_configuration) { testPrintConfiguration(); } +TEST_F(TestCategory, common_print_configuration) { + testPrintConfiguration(); +} #endif // KOKKOSKERNELS_PRINTCONFIGURATION_HPP diff --git a/perf_test/Benchmark_Context.hpp b/perf_test/Benchmark_Context.hpp index f9ce7bb744..0ef4910cc5 100644 --- a/perf_test/Benchmark_Context.hpp +++ b/perf_test/Benchmark_Context.hpp @@ -24,7 +24,6 @@ #include #include -#include namespace KokkosKernelsBenchmark { @@ -42,12 +41,11 @@ std::string remove_unwanted_characters(std::string str) { return str.substr(from, to + 1); } -/// \brief Extract all key:value pairs from kernels configuration and add it to +/// \brief Extract all key:value pairs from kokkos configuration and add it to /// the benchmark context -void add_kernels_configuration(bool verbose) { +void add_kokkos_configuration(bool verbose) { std::ostringstream msg; Kokkos::print_configuration(msg, verbose); - KokkosKernels::print_configuration(msg); // Iterate over lines returned from kokkos and extract key:value pairs std::stringstream ss{msg.str()}; @@ -66,8 +64,8 @@ void add_kernels_configuration(bool verbose) { /// \brief Gather all context information and add it to benchmark context data void add_benchmark_context(bool verbose = false) { - // Add Kokkos and kernerls configuration to benchmark context data - add_kernels_configuration(verbose); + // Add Kokkos configuration to benchmark context data + add_kokkos_configuration(verbose); } } // namespace KokkosKernelsBenchmark