Debian Codegraph @

packages/kokkos-kernels/perf_test/blas/blas2/KokkosBlas2_gemv_tracked_perf_test.cpp

raw
1 //@HEADER
2 // ************************************************************************
3 //
4 // Kokkos v. 4.0
5 // Copyright (2022) National Technology & Engineering
6 // Solutions of Sandia, LLC (NTESS).
7 //
8 // Under the terms of Contract DE-NA0003525 with NTESS,
9 // the U.S. Government retains certain rights in this software.
10 //
11 // Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
12 // See https://kokkos.org/LICENSE for license information.
13 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
14 //
15 //@HEADER
16
17 #include <Kokkos_Core.hpp>
18 #include <KokkosBlas2_gemv.hpp>
19 #include <Kokkos_Random.hpp>
20
21 // Required for tracked_testing version
22 #include "KokkosBlas2_gemv_perf_test.hpp"
23 #ifdef KOKKOSKERNELS_ENABLE_TESTS_AND_PERFSUITE
24 #include <PerfTestUtilities.hpp>
25 #endif
26
27 template <class ExecSpace, class Layout>
28 testData_gemv<ExecSpace, Layout> setup_test(int m, int n, int repeat) {
29 testData_gemv<ExecSpace, Layout> testData_gemv_obj(m, n, repeat);
30
31 return testData_gemv_obj;
32 }
33
34 test_list construct_gemv_kernel_base(const rajaperf::RunParams& run_params)
35
36 {
37 // instantiate test_list as kernel_base_vector
38 test_list kernel_base_vector;
39
40 kernel_base_vector.push_back(rajaperf::make_kernel_base(
41 "BLAS2_GEMV", run_params,
42 // setup lambda by value
43 [=](const int repeat, const int m) {
44 // returns a tuple of testData_obj
45 return std::make_tuple(
46 setup_test<Kokkos::DefaultExecutionSpace, Kokkos::DefaultExecutionSpace::array_layout>(m, m / 10, repeat));
47 },
48 // run lambda will take the returned setup tuple
49 [&](const int iteration, const int runsize, auto& data) {
50 KokkosBlas::gemv("N", 1.0, data.A, data.x, 0.0, data.y);
51 }));
52
53 // return a vector of kernel base objects of type test_list
54 return kernel_base_vector;
55 }