44 #ifndef AMESOS2_CUSOLVER_DECL_HPP
45 #define AMESOS2_CUSOLVER_DECL_HPP
48 #include "Amesos2_SolverCore.hpp"
49 #include "Amesos2_cuSOLVER_FunctionMap.hpp"
57 template <
class Matrix,
71 typedef typename super_type::scalar_type scalar_type;
72 typedef typename super_type::local_ordinal_type local_ordinal_type;
73 typedef typename super_type::global_ordinal_type global_ordinal_type;
74 typedef typename super_type::global_size_type global_size_type;
75 typedef typename super_type::node_type node_type;
79 typedef typename type_map::type cusolver_type;
80 typedef typename type_map::magnitude_type magnitude_type;
84 #ifdef KOKKOS_ENABLE_CUDA
86 typedef Kokkos::Device<Kokkos::Cuda, Kokkos::CudaSpace> device_type;
88 typedef Kokkos::DefaultExecutionSpace::device_type device_type;
91 typedef int size_type;
92 typedef int ordinal_type;
93 typedef Kokkos::View<size_type*, device_type> device_size_type_array;
94 typedef Kokkos::View<ordinal_type*, device_type> device_ordinal_type_array;
95 typedef Kokkos::View<cusolver_type*, device_type> device_value_type_array;
106 cuSOLVER(Teuchos::RCP<const Matrix> A,
107 Teuchos::RCP<Vector> X,
108 Teuchos::RCP<const Vector> B);
150 int
solve_impl(const Teuchos::Ptr<MultiVecAdapter<Vector> > X,
151 const Teuchos::Ptr<const MultiVecAdapter<Vector> > B) const;
164 const Teuchos::RCP<Teuchos::ParameterList> & parameterList );
190 mutable struct cuSolverData {
191 cusolverSpHandle_t handle;
192 csrcholInfo_t chol_info;
193 cusparseMatDescr_t desc;
197 typedef Kokkos::View<cusolver_type**, Kokkos::LayoutLeft, device_type> device_solve_array_t;
199 mutable device_solve_array_t xValues_;
200 mutable device_solve_array_t bValues_;
201 mutable device_value_type_array buffer_;
203 device_value_type_array device_nzvals_view_;
204 device_size_type_array device_row_ptr_view_;
205 device_ordinal_type_array device_cols_view_;
209 typedef Kokkos::View<ordinal_type*, device_type> permute_array_t;
210 permute_array_t device_perm_;
211 permute_array_t device_peri_;
212 mutable device_solve_array_t permute_result_;
216 struct solver_traits<cuSOLVER> {
217 #ifdef HAVE_TEUCHOS_COMPLEX
218 typedef Meta::make_list6<float, double,
219 std::complex<float>, std::complex<double>,
220 Kokkos::complex<float>, Kokkos::complex<double>>
223 typedef Meta::make_list2<float, double> supported_scalars;
227 template <
typename Scalar,
typename LocalOrdinal,
typename ExecutionSpace>
228 struct solver_supports_matrix<cuSOLVER,
229 KokkosSparse::CrsMatrix<Scalar, LocalOrdinal, ExecutionSpace>> {
230 static const bool value =
true;
235 #endif // AMESOS2_CUSOLVER_DECL_HPP
Amesos2::SolverCore: A templated interface for interaction with third-party direct sparse solvers...
Definition: Amesos2_SolverCore_decl.hpp:105
void setParameters_impl(const Teuchos::RCP< Teuchos::ParameterList > ¶meterList)
Definition: Amesos2_cuSOLVER_def.hpp:271
bool matrixShapeOK_impl() const
Determines whether the shape of the matrix is OK for this solver.
Definition: Amesos2_cuSOLVER_def.hpp:264
Map types to solver-specific data-types and enums.
Definition: Amesos2_TypeMap.hpp:82
Teuchos::RCP< const Teuchos::ParameterList > getValidParameters_impl() const
Definition: Amesos2_cuSOLVER_def.hpp:288
Amesos2 interface to cuSOLVER.
Definition: Amesos2_cuSOLVER_decl.hpp:59
std::string name() const
Return the name of this solver.
Definition: Amesos2_SolverCore_def.hpp:509
int symbolicFactorization_impl()
Perform symbolic factorization of the matrix using cuSOLVER.
Definition: Amesos2_cuSOLVER_def.hpp:108
bool loadA_impl(EPhase current_phase)
Reads matrix data into internal structures.
Definition: Amesos2_cuSOLVER_def.hpp:311
bool do_optimization() const
can we optimize size_type and ordinal_type for straight pass through
Definition: Amesos2_cuSOLVER_def.hpp:305
int numericFactorization_impl()
cuSOLVER specific numeric factorization
Definition: Amesos2_cuSOLVER_def.hpp:134
Passes functions to TPL functions based on type.
Definition: Amesos2_FunctionMap.hpp:76
Provides access to interesting solver traits.
int preOrdering_impl()
Performs pre-ordering on the matrix to increase efficiency.
Definition: Amesos2_cuSOLVER_def.hpp:86
int solve_impl(const Teuchos::Ptr< MultiVecAdapter< Vector > > X, const Teuchos::Ptr< const MultiVecAdapter< Vector > > B) const
cuSOLVER specific solve.
Definition: Amesos2_cuSOLVER_def.hpp:185