Debian Codegraph @

packages/kokkos-kernels/perf_test/batched/dense/do-not-use/KokkosBatched_Test_Trsm_Host_Real.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 /// \author Kyungjoo Kim ([email protected])
17
18 #define KokkosBatched_Test_Trsm_Host_Real 1
19 #include "KokkosBatched_Test_Trsm_Host.hpp"
20
21 using namespace KokkosBatched;
22
23 template <typename AlgoTagType>
24 void run(const int N) {
25 typedef Kokkos::DefaultHostExecutionSpace HostSpaceType;
26
27 Kokkos::print_configuration(std::cout, false);
28
29 std::cout << "\n\n Used for Factorization \n\n";
30
31 /// Left, Lower, NoTrans, UnitDiag (used in LU factorization and LU solve)
32
33 PerfTest::Trsm<0, 3, 3, HostSpaceType, AlgoTagType>(N);
34 PerfTest::Trsm<0, 5, 5, HostSpaceType, AlgoTagType>(N);
35 PerfTest::Trsm<0, 10, 10, HostSpaceType, AlgoTagType>(N);
36 PerfTest::Trsm<0, 15, 15, HostSpaceType, AlgoTagType>(N);
37
38 /// Left, Lower, NoTrans, NonUnitDiag
39
40 PerfTest::Trsm<1, 3, 3, HostSpaceType, AlgoTagType>(N);
41 PerfTest::Trsm<1, 5, 5, HostSpaceType, AlgoTagType>(N);
42 PerfTest::Trsm<1, 10, 10, HostSpaceType, AlgoTagType>(N);
43 PerfTest::Trsm<1, 15, 15, HostSpaceType, AlgoTagType>(N);
44
45 /// Right, Upper, NoTrans, UnitDiag
46
47 PerfTest::Trsm<2, 3, 3, HostSpaceType, AlgoTagType>(N);
48 PerfTest::Trsm<2, 5, 5, HostSpaceType, AlgoTagType>(N);
49 PerfTest::Trsm<2, 10, 10, HostSpaceType, AlgoTagType>(N);
50 PerfTest::Trsm<2, 15, 15, HostSpaceType, AlgoTagType>(N);
51
52 /// Right, Upper, NoTrans, NonUnitDiag (used in LU factorization)
53
54 PerfTest::Trsm<3, 3, 3, HostSpaceType, AlgoTagType>(N);
55 PerfTest::Trsm<3, 5, 5, HostSpaceType, AlgoTagType>(N);
56 PerfTest::Trsm<3, 10, 10, HostSpaceType, AlgoTagType>(N);
57 PerfTest::Trsm<3, 15, 15, HostSpaceType, AlgoTagType>(N);
58
59 std::cout << "\n\n Used for Solve \n\n";
60
61 /// Left, Lower, NoTrans, UnitDiag (used in LU solve)
62
63 PerfTest::Trsm<0, 3, 1, HostSpaceType, AlgoTagType>(N);
64 PerfTest::Trsm<0, 5, 1, HostSpaceType, AlgoTagType>(N);
65 PerfTest::Trsm<0, 10, 1, HostSpaceType, AlgoTagType>(N);
66 PerfTest::Trsm<0, 15, 1, HostSpaceType, AlgoTagType>(N);
67
68 /// Left, Upper, Notrans, NonUnitDiag (user in LU solve)
69
70 PerfTest::Trsm<4, 3, 1, HostSpaceType, AlgoTagType>(N);
71 PerfTest::Trsm<4, 5, 1, HostSpaceType, AlgoTagType>(N);
72 PerfTest::Trsm<4, 10, 1, HostSpaceType, AlgoTagType>(N);
73 PerfTest::Trsm<4, 15, 1, HostSpaceType, AlgoTagType>(N);
74 }
75
76 int main(int argc, char* argv[]) {
77 Kokkos::initialize(argc, argv);
78 #if !defined(__CUDA_ARCH__) && !defined(__HIP_DEVICE_COMPILE__)
79 int N = 128 * 128;
80
81 for (int i = 1; i < argc; ++i) {
82 const std::string& token = argv[i];
83 if (token == std::string("-N")) N = std::atoi(argv[++i]);
84 }
85
86 {
87 std::cout << " N = " << N << std::endl;
88
89 std::cout << "\n Testing Algo::Trsm::Unblocked\n";
90 run<Algo::Trsm::Unblocked>(N);
91
92 std::cout << "\n Testing Algo::Trsm::Blocked\n";
93 run<Algo::Trsm::Blocked>(N);
94
95 #if defined(__KOKKOSBATCHED_INTEL_MKL_COMPACT_BATCHED__)
96 std::cout << "\n Testing Algo::Trsm::CompactMKL\n";
97 run<Algo::Gemm::CompactMKL>(N);
98 #endif
99 }
100 #endif
101 Kokkos::finalize();
102
103 return 0;
104 }