Amesos2 - Direct Sparse Solver Interfaces  Version of the Day
Amesos2_Kokkos_Impl.hpp
Go to the documentation of this file.
1 // @HEADER
2 // *****************************************************************************
3 // Amesos2: Templated Direct Sparse Solver Package
4 //
5 // Copyright 2011 NTESS and the Amesos2 contributors.
6 // SPDX-License-Identifier: BSD-3-Clause
7 // *****************************************************************************
8 // @HEADER
9 
18 #ifndef AMESOS2_KOKKOS_IMPL_HPP
19 #define AMESOS2_KOKKOS_IMPL_HPP
20 
21 #include <type_traits>
23 #include <Kokkos_Core.hpp>
24 #include <KokkosSparse_CrsMatrix.hpp>
25 #include <Tpetra_KokkosCompat_ClassicNodeAPI_Wrapper.hpp>
26 
27 #define AMESOS2_KOKKOS_LOCAL_INSTANT_KOKKOS_ADAPTER(S,LO,NODE_TYPE) \
28  template class Amesos2::AMESOS2_KOKKOS_IMPL_SOLVER_NAME<KokkosSparse::CrsMatrix<S, LO, \
29  typename NODE_TYPE::device_type>, \
30  Kokkos::View<S**, Kokkos::LayoutLeft, typename NODE_TYPE::device_type> >;
31 
32 #ifdef KOKKOS_ENABLE_CUDA_UVM
33 #define AMESOS2_KOKKOS_LOCAL_INSTANT_KOKKOS_ADAPTER_UVM_OFF(S,LO) \
34  template class Amesos2::AMESOS2_KOKKOS_IMPL_SOLVER_NAME<KokkosSparse::CrsMatrix<S, LO, \
35  Kokkos::Device<Kokkos::Cuda,Kokkos::CudaSpace>>, \
36  Kokkos::View<S**, Kokkos::LayoutLeft, Kokkos::Device<Kokkos::Cuda,Kokkos::CudaSpace>> >;
37 #else
38 #define AMESOS2_KOKKOS_LOCAL_INSTANT_KOKKOS_ADAPTER_UVM_OFF(S,LO)
39 #endif
40 
41 #if defined(KOKKOS_ENABLE_SERIAL)
42 #ifdef HAVE_TPETRA_INST_FLOAT
43  AMESOS2_KOKKOS_LOCAL_INSTANT_KOKKOS_ADAPTER(float, int, Tpetra::KokkosCompat::KokkosSerialWrapperNode)
44 #endif
45 #ifdef HAVE_TPETRA_INST_DOUBLE
46  AMESOS2_KOKKOS_LOCAL_INSTANT_KOKKOS_ADAPTER(double, int, Tpetra::KokkosCompat::KokkosSerialWrapperNode)
47 #endif
48 #ifdef HAVE_TPETRA_INST_COMPLEX_FLOAT
49  AMESOS2_KOKKOS_LOCAL_INSTANT_KOKKOS_ADAPTER(Kokkos::complex<float>, int, Tpetra::KokkosCompat::KokkosSerialWrapperNode)
50 #endif
51 #ifdef HAVE_TPETRA_INST_COMPLEX_DOUBLE
52  AMESOS2_KOKKOS_LOCAL_INSTANT_KOKKOS_ADAPTER(Kokkos::complex<double>, int, Tpetra::KokkosCompat::KokkosSerialWrapperNode)
53 #endif
54 #endif
55 
56 #if defined(KOKKOS_ENABLE_THREADS)
57 #ifdef HAVE_TPETRA_INST_FLOAT
58  AMESOS2_KOKKOS_LOCAL_INSTANT_KOKKOS_ADAPTER(float, int, Tpetra::KokkosCompat::KokkosKokkosThreadsWrapperNode)
59 #endif
60 #ifdef HAVE_TPETRA_INST_DOUBLE
61  AMESOS2_KOKKOS_LOCAL_INSTANT_KOKKOS_ADAPTER(double, int, Tpetra::KokkosCompat::KokkosKokkosThreadsWrapperNode)
62 #endif
63 #ifdef HAVE_TPETRA_INST_COMPLEX_FLOAT
64  AMESOS2_KOKKOS_LOCAL_INSTANT_KOKKOS_ADAPTER(Kokkos::complex<float>, int, Tpetra::KokkosCompat::KokkosKokkosThreadsWrapperNode)
65 #endif
66 #ifdef HAVE_TPETRA_INST_COMPLEX_DOUBLE
67  AMESOS2_KOKKOS_LOCAL_INSTANT_KOKKOS_ADAPTER(Kokkos::complex<double>, int, Tpetra::KokkosCompat::KokkosKokkosThreadsWrapperNode)
68 #endif
69 #endif // KOKKOS_ENABLE_THREADS
70 
71 #if defined(KOKKOS_ENABLE_OPENMP)
72 #ifdef HAVE_TPETRA_INST_FLOAT
73  AMESOS2_KOKKOS_LOCAL_INSTANT_KOKKOS_ADAPTER(float, int, Tpetra::KokkosCompat::KokkosOpenMPWrapperNode)
74 #endif
75 #ifdef HAVE_TPETRA_INST_DOUBLE
76  AMESOS2_KOKKOS_LOCAL_INSTANT_KOKKOS_ADAPTER(double, int, Tpetra::KokkosCompat::KokkosOpenMPWrapperNode)
77 #endif
78 #ifdef HAVE_TPETRA_INST_COMPLEX_FLOAT
79  AMESOS2_KOKKOS_LOCAL_INSTANT_KOKKOS_ADAPTER(Kokkos::complex<float>, int, Tpetra::KokkosCompat::KokkosOpenMPWrapperNode)
80 #endif
81 #ifdef HAVE_TPETRA_INST_COMPLEX_DOUBLE
82  AMESOS2_KOKKOS_LOCAL_INSTANT_KOKKOS_ADAPTER(Kokkos::complex<double>, int, Tpetra::KokkosCompat::KokkosOpenMPWrapperNode)
83 #endif
84 #endif // KOKKOS_ENABLE_OPENMP
85 
86 #if defined(KOKKOS_ENABLE_CUDA)
87 #ifdef HAVE_TPETRA_INST_FLOAT
88  AMESOS2_KOKKOS_LOCAL_INSTANT_KOKKOS_ADAPTER(float, int, Tpetra::KokkosCompat::KokkosCudaWrapperNode)
89  AMESOS2_KOKKOS_LOCAL_INSTANT_KOKKOS_ADAPTER_UVM_OFF(float, int)
90 #endif
91 #ifdef HAVE_TPETRA_INST_DOUBLE
92  AMESOS2_KOKKOS_LOCAL_INSTANT_KOKKOS_ADAPTER(double, int, Tpetra::KokkosCompat::KokkosCudaWrapperNode)
93  AMESOS2_KOKKOS_LOCAL_INSTANT_KOKKOS_ADAPTER_UVM_OFF(double, int)
94 #endif
95 #ifdef HAVE_TPETRA_INST_COMPLEX_FLOAT
96  AMESOS2_KOKKOS_LOCAL_INSTANT_KOKKOS_ADAPTER(Kokkos::complex<float>, int, Tpetra::KokkosCompat::KokkosCudaWrapperNode)
97  AMESOS2_KOKKOS_LOCAL_INSTANT_KOKKOS_ADAPTER_UVM_OFF(Kokkos::complex<float>, int)
98 #endif
99 #ifdef HAVE_TPETRA_INST_COMPLEX_DOUBLE
100  AMESOS2_KOKKOS_LOCAL_INSTANT_KOKKOS_ADAPTER(Kokkos::complex<double>, int, Tpetra::KokkosCompat::KokkosCudaWrapperNode)
101  AMESOS2_KOKKOS_LOCAL_INSTANT_KOKKOS_ADAPTER_UVM_OFF(Kokkos::complex<double>, int)
102 #endif
103 #endif // KOKKOS_ENABLE_CUDA
104 
105 #if defined(KOKKOS_ENABLE_HIP)
106 #ifdef HAVE_TPETRA_INST_FLOAT
107  AMESOS2_KOKKOS_LOCAL_INSTANT_KOKKOS_ADAPTER(float, int, Tpetra::KokkosCompat::KokkosHIPWrapperNode)
108 #endif
109 #ifdef HAVE_TPETRA_INST_DOUBLE
110  AMESOS2_KOKKOS_LOCAL_INSTANT_KOKKOS_ADAPTER(double, int, Tpetra::KokkosCompat::KokkosHIPWrapperNode)
111 #endif
112 #ifdef HAVE_TPETRA_INST_COMPLEX_FLOAT
113  AMESOS2_KOKKOS_LOCAL_INSTANT_KOKKOS_ADAPTER(Kokkos::complex<float>, int, Tpetra::KokkosCompat::KokkosHIPWrapperNode)
114 #endif
115 #ifdef HAVE_TPETRA_INST_COMPLEX_DOUBLE
116  AMESOS2_KOKKOS_LOCAL_INSTANT_KOKKOS_ADAPTER(Kokkos::complex<double>, int, Tpetra::KokkosCompat::KokkosHIPWrapperNode)
117 #endif
118 #endif // KOKKOS_ENABLE_HIP
119 
120 #if defined(KOKKOS_ENABLE_SYCL)
121 #ifdef HAVE_TPETRA_INST_FLOAT
122  AMESOS2_KOKKOS_LOCAL_INSTANT_KOKKOS_ADAPTER(float, int, Tpetra::KokkosCompat::KokkosSYCLWrapperNode)
123 #endif
124 #ifdef HAVE_TPETRA_INST_DOUBLE
125  AMESOS2_KOKKOS_LOCAL_INSTANT_KOKKOS_ADAPTER(double, int, Tpetra::KokkosCompat::KokkosSYCLWrapperNode)
126 #endif
127 #ifdef HAVE_TPETRA_INST_COMPLEX_FLOAT
128  AMESOS2_KOKKOS_LOCAL_INSTANT_KOKKOS_ADAPTER(Kokkos::complex<float>, int, Tpetra::KokkosCompat::KokkosSYCLWrapperNode)
129 #endif
130 #ifdef HAVE_TPETRA_INST_COMPLEX_DOUBLE
131  AMESOS2_KOKKOS_LOCAL_INSTANT_KOKKOS_ADAPTER(Kokkos::complex<double>, int, Tpetra::KokkosCompat::KokkosSYCLWrapperNode)
132 #endif
133 #endif // KOKKOS_ENABLE_SYCL
134 
135 #endif // AMESOS2_KOKKOS_IMPL_HPP
Amesos2::MultiVecAdapter specialization for the Kokkos::View class.