Skip to content

Commit

Permalink
#5: Fixed clang format and removed form this PR benchmark modification
Browse files Browse the repository at this point in the history
benchmark modification will come through another PR
  • Loading branch information
mperrinel authored and meriadegp committed Feb 14, 2023
1 parent 8c1a89e commit 3ddf1de
Show file tree
Hide file tree
Showing 3 changed files with 75 additions and 49 deletions.
97 changes: 62 additions & 35 deletions common/src/KokkosKernels_PrintConfguration.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
17 changes: 9 additions & 8 deletions common/unit_test/Test_Common_PrintConfiguration.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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()};
Expand All @@ -36,25 +36,26 @@ 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 <typename exec_space>
void testPrintConfiguration() {
std::ostringstream out;
KokkosKernels::print_configuration(out);
check_print_configuration(out);
}

TEST_F(TestCategory, common_print_configuration) { testPrintConfiguration<TestExecSpace>(); }
TEST_F(TestCategory, common_print_configuration) {
testPrintConfiguration<TestExecSpace>();
}

#endif // KOKKOSKERNELS_PRINTCONFIGURATION_HPP
10 changes: 4 additions & 6 deletions perf_test/Benchmark_Context.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@
#include <benchmark/benchmark.h>

#include <Kokkos_Core.hpp>
#include <kokkoskernels_print_configuration.hpp>

namespace KokkosKernelsBenchmark {

Expand All @@ -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()};
Expand All @@ -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
Expand Down

0 comments on commit 3ddf1de

Please sign in to comment.