Skip to content

Commit

Permalink
perf_tests: remove false dependence on google test (#2385)
Browse files Browse the repository at this point in the history
* perf_tests: remove false dependence on google test

Signed-off-by: Carl Pearson <[email protected]>

* KokkosBlas3_gemm_perf_test.hpp: remove comment

Signed-off-by: Carl Pearson <[email protected]>

* Test::epsilon -> Kokkos::ArithTraits<>::eps

Signed-off-by: Carl Pearson <[email protected]>

---------

Signed-off-by: Carl Pearson <[email protected]>
  • Loading branch information
cwpearson authored Oct 18, 2024
1 parent 9f8122b commit ff46aee
Show file tree
Hide file tree
Showing 37 changed files with 367 additions and 274 deletions.
1 change: 1 addition & 0 deletions batched/dense/unit_test/Test_Batched_SerialGemm.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
#include "KokkosBatched_Gemm_Serial_Impl.hpp"

#include "KokkosKernels_TestUtils.hpp"
#include "KokkosKernels_TestVanilla.hpp"

using namespace KokkosBatched;

Expand Down
2 changes: 2 additions & 0 deletions batched/dense/unit_test/Test_Batched_SerialSVD.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@
#include "KokkosBatched_SVD_Decl.hpp" //For testing overall kernel
#include "KokkosBatched_SVD_Serial_Internal.hpp" //For unit testing individual components
#include "KokkosBatched_SetIdentity_Decl.hpp"
#include "KokkosKernels_TestMatrixUtils.hpp"
#include "KokkosKernels_TestVanilla.hpp"

namespace Test {
template <typename Scalar>
Expand Down
1 change: 1 addition & 0 deletions blas/unit_test/Test_Blas2_gemv.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
#include <KokkosBlas2_gemv.hpp>
#include <KokkosBlas1_dot.hpp>
#include <KokkosKernels_TestUtils.hpp>
#include "KokkosKernels_TestVanilla.hpp"

namespace Test {
template <class ExecutionSpace, class ViewTypeA, class ViewTypeX, class ViewTypeY, class Device>
Expand Down
15 changes: 0 additions & 15 deletions perf_test/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -11,21 +11,6 @@ if (KokkosKernels_ENABLE_PERFTESTS)
#build correctly with or without MPI, but only run them with a single
#MPI process.

SET(GTEST_SOURCE_DIR ${PACKAGE_SOURCE_DIR}/tpls/gtest)

KOKKOSKERNELS_ADD_TEST_LIBRARY(
kokkoskernelsperf_gtest
HEADERS ${GTEST_SOURCE_DIR}/gtest/gtest.h
SOURCES ${GTEST_SOURCE_DIR}/gtest/gtest-all.cc
)
#Disables pthreads, this is a problem for serial builds in Trilinos & Sierra if it's enabled.

TARGET_COMPILE_DEFINITIONS(kokkoskernelsperf_gtest PUBLIC "-DGTEST_HAS_PTHREAD=0")
TARGET_INCLUDE_DIRECTORIES(kokkoskernelsperf_gtest PUBLIC $<BUILD_INTERFACE:${GTEST_SOURCE_DIR}>)

#Gtest minimally requires C++ 11
TARGET_COMPILE_FEATURES(kokkoskernelsperf_gtest PUBLIC cxx_std_11)

KOKKOSKERNELS_INCLUDE_DIRECTORIES(sparse)

if(KokkosKernels_ENABLE_TESTS_AND_PERFSUITE)
Expand Down
2 changes: 1 addition & 1 deletion perf_test/KokkosKernels_perf_test_utilities.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
#ifndef KOKKOSKERNELS_PERF_TEST_UTILITIES_HPP
#define KOKKOSKERNELS_PERF_TEST_UTILITIES_HPP

#include "KokkosKernels_TestUtils.hpp" // for string_compare_no_case
#include "KokkosKernels_TestStringUtils.hpp" // for string_compare_no_case

// Namepsace that defines common utilities
// for performance tests
Expand Down
4 changes: 3 additions & 1 deletion perf_test/blas/blas1/KokkosBlas_dot_mv_perf_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,12 @@
//
//@HEADER

#include <iostream>

#include <Kokkos_Core.hpp>
#include <src/KokkosBlas1_dot.hpp>
#include <Kokkos_Random.hpp>
#include "KokkosKernels_TestUtils.hpp"
#include "KokkosKernels_TestStringUtils.hpp"

struct Params {
int use_cuda = 0;
Expand Down
4 changes: 3 additions & 1 deletion perf_test/blas/blas1/KokkosBlas_dot_perf_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,14 @@
//
//@HEADER

#include <iostream>

#include <Kokkos_Core.hpp>
#include <Kokkos_Random.hpp>

// For RPS implementation
#include "KokkosBlas_dot_perf_test.hpp"
#include "KokkosKernels_TestUtils.hpp"
#include "KokkosKernels_TestStringUtils.hpp"

struct Params {
int use_cuda = 0;
Expand Down
4 changes: 3 additions & 1 deletion perf_test/blas/blas1/KokkosBlas_team_dot_perf_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,12 @@
//
//@HEADER

#include <iostream>

#include <Kokkos_Core.hpp>
#include <KokkosBlas1_team_dot.hpp>
#include <Kokkos_Random.hpp>
#include "KokkosKernels_TestUtils.hpp"
#include "KokkosKernels_TestStringUtils.hpp"

struct Params {
int use_cuda = 0;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,10 +42,12 @@
//@HEADER
*/

#include <iostream>

#include <Kokkos_Core.hpp>
#include <KokkosBlas1_team_dot.hpp>
#include <Kokkos_Random.hpp>
#include "KokkosKernels_TestUtils.hpp"
#include "KokkosKernels_TestStringUtils.hpp"

#include <benchmark/benchmark.h>

Expand Down
2 changes: 1 addition & 1 deletion perf_test/blas/blas2/KokkosBlas2_gemv_perf_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@

#include "KokkosBlas2_gemv.hpp"
#include <Kokkos_Random.hpp>
#include "KokkosKernels_TestUtils.hpp"
#include "KokkosKernels_TestStringUtils.hpp"

struct Params {
int use_cuda = 0;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@

#include "KokkosBlas2_gemv.hpp"

#include "KokkosKernels_TestUtils.hpp"
#include "KokkosKernels_TestStringUtils.hpp"
#include "KokkosKernels_perf_test_utilities.hpp"

#include <Benchmark_Context.hpp>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
#include "KokkosBlas2_ger.hpp"
#include <typeinfo>

#include "KokkosKernels_TestUtils.hpp"
#include "KokkosKernels_TestStringUtils.hpp"
#include "KokkosKernels_perf_test_utilities.hpp"

#include <Benchmark_Context.hpp>
Expand Down
1 change: 0 additions & 1 deletion perf_test/blas/blas3/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ KOKKOSKERNELS_INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR})
KOKKOSKERNELS_ADD_EXECUTABLE(
KokkosBlas3_perf_test
SOURCES KokkosBlas3_perf_test.cpp
TESTONLYLIBS kokkoskernelsperf_gtest
)

KOKKOSKERNELS_ADD_EXECUTABLE(
Expand Down
8 changes: 5 additions & 3 deletions perf_test/blas/blas3/KokkosBlas3_gemm_perf_test.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,12 @@

#include <KokkosBlas3_gemm.hpp>

#include "Kokkos_ArithTraits.hpp"
#include "KokkosBatched_HostLevel_Gemm.hpp"
#include "KokkosBatched_Gemm_Decl.hpp"
#include "KokkosBatched_Util.hpp"
#include "gtest/gtest.h" // EXPECT_NEAR
#include "KokkosKernels_TestUtils.hpp"
#include "KokkosKernels_TestStringUtils.hpp"
#include "KokkosKernels_TestVanilla.hpp"

#include <chrono>

Expand Down Expand Up @@ -1368,7 +1369,8 @@ static inline bool __gemm_print_compare_failure(ViewType h_expected, ViewType h_
*/
template <class ScalarType, class LayoutType>
static inline bool __gemm_do_compare(view_type_3d expected, view_type_3d actual) {
double epsilon = Test::epsilon<ScalarType>::value * 1e3;
double epsilon = Kokkos::ArithTraits<ScalarType>::eps() * 1e3;

STATUS;

typename view_type_3d::HostMirror h_expected = Kokkos::create_mirror_view(expected);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@

#include "KokkosBlas3_gemm.hpp"
#include <Kokkos_Random.hpp>
#include "KokkosKernels_TestUtils.hpp"
#include "KokkosKernels_TestStringUtils.hpp"

struct Params {
int use_cuda = 0;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@

#include "KokkosBlas3_gemm.hpp"
#include <Kokkos_Random.hpp>
#include "KokkosKernels_TestUtils.hpp"
#include "KokkosKernels_TestStringUtils.hpp"
#include "KokkosKernels_perf_test_utilities.hpp"
#include "Benchmark_Context.hpp"
#include <benchmark/benchmark.h>
Expand Down
2 changes: 1 addition & 1 deletion perf_test/graph/KokkosGraph_color.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
#include "KokkosSparse_CrsMatrix.hpp"
#include "KokkosKernels_TestParameters.hpp"
#include "KokkosGraph_Distance1Color.hpp"
#include "KokkosKernels_TestUtils.hpp"
#include "KokkosKernels_TestStringUtils.hpp"
#include "KokkosSparse_IOUtils.hpp"

void print_options(std::ostream &os, const char *app_name, unsigned int indent = 0) {
Expand Down
2 changes: 1 addition & 1 deletion perf_test/graph/KokkosGraph_color_d2.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
#include <KokkosKernels_TestParameters.hpp>
#include <KokkosGraph_Distance2Color.hpp>
#include "KokkosKernels_default_types.hpp"
#include "KokkosKernels_TestUtils.hpp"
#include "KokkosKernels_TestStringUtils.hpp"
#include "KokkosSparse_IOUtils.hpp"

using namespace KokkosGraph;
Expand Down
2 changes: 1 addition & 1 deletion perf_test/graph/KokkosGraph_mis_d2.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
#include "KokkosSparse_spadd.hpp"
#include "KokkosGraph_MIS2.hpp"
#include "KokkosKernels_default_types.hpp"
#include "KokkosKernels_TestUtils.hpp"
#include "KokkosKernels_TestStringUtils.hpp"
#include "KokkosSparse_IOUtils.hpp"

using namespace KokkosGraph;
Expand Down
2 changes: 1 addition & 1 deletion perf_test/graph/KokkosGraph_triangle.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
#include "KokkosGraph_Triangle.hpp"
#include "KokkosSparse_CrsMatrix.hpp"
#include "KokkosSparse_IOUtils.hpp" //for read_kokkos_crst_graph
#include "KokkosKernels_TestUtils.hpp"
#include "KokkosKernels_TestStringUtils.hpp"
#include "KokkosKernels_TestParameters.hpp"
#include "KokkosKernels_perf_test_utilities.hpp"

Expand Down
8 changes: 5 additions & 3 deletions perf_test/lapack/KokkosLapack_SVD_benchmark.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,11 @@
//
//@HEADER

#include "KokkosLapack_svd.hpp"
#include <Kokkos_Random.hpp>

#include "KokkosKernels_TestUtils.hpp"
#include "KokkosKernels_IOUtils.hpp" // getRandomBounds
#include "KokkosLapack_svd.hpp"
#include "KokkosKernels_TestStringUtils.hpp"
#include "KokkosKernels_perf_test_utilities.hpp"

#include <benchmark/benchmark.h>
Expand Down Expand Up @@ -72,7 +74,7 @@ void run_svd_benchmark(benchmark::State& state, const svd_parameters& svd_params

// Initialize A with random numbers
double randStart = 0, randEnd = 0;
Test::getRandomBounds(10.0, randStart, randEnd);
KokkosKernels::Impl::getRandomBounds(10.0, randStart, randEnd);
Kokkos::fill_random(A, rand_pool, randStart, randEnd);

for (auto _ : state) {
Expand Down
2 changes: 1 addition & 1 deletion perf_test/ode/KokkosODE_BDF.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@

#include "KokkosODE_BDF.hpp"

#include "KokkosKernels_TestUtils.hpp"
#include "KokkosKernels_TestStringUtils.hpp"
#include "KokkosKernels_perf_test_utilities.hpp"

#include <benchmark/benchmark.h>
Expand Down
2 changes: 1 addition & 1 deletion perf_test/ode/KokkosODE_RK.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@

#include "KokkosODE_RungeKutta.hpp"

#include "KokkosKernels_TestUtils.hpp"
#include "KokkosKernels_TestStringUtils.hpp"
#include "KokkosKernels_perf_test_utilities.hpp"

#include <benchmark/benchmark.h>
Expand Down
1 change: 0 additions & 1 deletion perf_test/sparse/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,6 @@ KOKKOSKERNELS_ADD_EXECUTABLE(
KOKKOSKERNELS_ADD_EXECUTABLE(
sparse_gs
SOURCES KokkosSparse_gs.cpp
TESTONLYLIBS kokkoskernelsperf_gtest
)

KOKKOSKERNELS_ADD_EXECUTABLE(
Expand Down
2 changes: 1 addition & 1 deletion perf_test/sparse/KokkosSparse_block_pcg.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
#include "KokkosKernels_Utils.hpp"
#include "KokkosSparse_IOUtils.hpp"

#include "KokkosKernels_TestUtils.hpp"
#include "KokkosKernels_TestStringUtils.hpp"

#define MAXVAL 1

Expand Down
15 changes: 9 additions & 6 deletions perf_test/sparse/KokkosSparse_gs.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,22 +14,25 @@
//
//@HEADER

#include <iostream>
#include <random>
#include <vector>
#include <string>
#include <unordered_set>

#include <Kokkos_Core.hpp>
#include <Kokkos_Timer.hpp>

#include <KokkosKernels_Handle.hpp>
#include <KokkosKernels_TestUtils.hpp>
#include <KokkosKernels_TestStringUtils.hpp>
#include <KokkosSparse_gauss_seidel.hpp>
#include <KokkosSparse_spmv.hpp>
#include <KokkosKernels_IOUtils.hpp>
#include <KokkosBlas1_nrm2.hpp>
#include <KokkosKernels_config.h>
#include "KokkosKernels_default_types.hpp"
#include "KokkosSparse_IOUtils.hpp"
#include <iostream>
#include <random>
#include <vector>
#include <string>
#include <unordered_set>
#include "KokkosKernels_TestMatrixUtils.hpp"

using std::cout;
using std::string;
Expand Down
2 changes: 1 addition & 1 deletion perf_test/sparse/KokkosSparse_mdf.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
#include "KokkosKernels_Handle.hpp"
#include "KokkosSparse_IOUtils.hpp"
#include "KokkosSparse_Utils_cusparse.hpp"
#include "KokkosKernels_TestUtils.hpp"
#include "KokkosKernels_TestStringUtils.hpp"
#include "KokkosKernels_perf_test_utilities.hpp"

#include "KokkosSparse_mdf.hpp"
Expand Down
2 changes: 1 addition & 1 deletion perf_test/sparse/KokkosSparse_pcg.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
#include "KokkosKernels_Utils.hpp"
#include "KokkosKernels_IOUtils.hpp"
#include "KokkosKernels_default_types.hpp"
#include "KokkosKernels_TestUtils.hpp"
#include "KokkosKernels_TestStringUtils.hpp"
#include "KokkosSparse_IOUtils.hpp"
#include <iostream>

Expand Down
2 changes: 1 addition & 1 deletion perf_test/sparse/KokkosSparse_spadd.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
#include "KokkosSparse_IOUtils.hpp"
#include "KokkosSparse_Utils_cusparse.hpp"
#include "KokkosSparse_Utils_mkl.hpp"
#include "KokkosKernels_TestUtils.hpp"
#include "KokkosKernels_TestStringUtils.hpp"
#include "KokkosKernels_perf_test_utilities.hpp"

#include "KokkosSparse_spadd.hpp"
Expand Down
2 changes: 1 addition & 1 deletion perf_test/sparse/KokkosSparse_spgemm.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
#include "KokkosBlas1_nrminf.hpp"
#include "KokkosBlas1_axpby.hpp"
#include "KokkosKernels_TestParameters.hpp"
#include "KokkosKernels_TestUtils.hpp"
#include "KokkosKernels_TestStringUtils.hpp"
#include "KokkosKernels_perf_test_utilities.hpp"

#define TRANSPOSEFIRST false
Expand Down
2 changes: 1 addition & 1 deletion perf_test/sparse/KokkosSparse_spgemm_jacobi.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
#include "KokkosKernels_default_types.hpp"
#include "KokkosKernels_IOUtils.hpp"
#include "KokkosSparse_run_spgemm_jacobi.hpp"
#include "KokkosKernels_TestUtils.hpp"
#include "KokkosKernels_TestStringUtils.hpp"

void print_options() {
std::cerr << "Options\n" << std::endl;
Expand Down
2 changes: 1 addition & 1 deletion perf_test/sparse/KokkosSparse_spmv_benchmark.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
#include <KokkosKernels_IOUtils.hpp>
#include <KokkosSparse_IOUtils.hpp>
#include "KokkosKernels_default_types.hpp"
#include "KokkosKernels_TestUtils.hpp"
#include "KokkosKernels_TestStringUtils.hpp"
#include "KokkosKernels_perf_test_utilities.hpp"

// Headers for benchmark library
Expand Down
Loading

0 comments on commit ff46aee

Please sign in to comment.