10 #ifndef AMESOS2_CUSOLVER_DECL_HPP
11 #define AMESOS2_CUSOLVER_DECL_HPP
14 #include "Amesos2_SolverCore.hpp"
15 #include "Amesos2_cuSOLVER_FunctionMap.hpp"
23 template <
class Matrix,
37 typedef typename super_type::scalar_type scalar_type;
38 typedef typename super_type::local_ordinal_type local_ordinal_type;
39 typedef typename super_type::global_ordinal_type global_ordinal_type;
40 typedef typename super_type::global_size_type global_size_type;
41 typedef typename super_type::node_type node_type;
45 typedef typename type_map::type cusolver_type;
46 typedef typename type_map::magnitude_type magnitude_type;
50 #ifdef KOKKOS_ENABLE_CUDA
52 typedef Kokkos::Device<Kokkos::Cuda, Kokkos::CudaSpace> device_type;
54 typedef Kokkos::DefaultExecutionSpace::device_type device_type;
57 typedef int size_type;
58 typedef int ordinal_type;
59 typedef Kokkos::View<size_type*, device_type> device_size_type_array;
60 typedef Kokkos::View<ordinal_type*, device_type> device_ordinal_type_array;
61 typedef Kokkos::View<cusolver_type*, device_type> device_value_type_array;
72 cuSOLVER(Teuchos::RCP<const Matrix> A,
73 Teuchos::RCP<Vector> X,
74 Teuchos::RCP<const Vector> B);
116 int
solve_impl(const Teuchos::Ptr<MultiVecAdapter<Vector> > X,
117 const Teuchos::Ptr<const MultiVecAdapter<Vector> > B) const;
130 const Teuchos::RCP<Teuchos::ParameterList> & parameterList );
156 mutable struct cuSolverData {
157 cusolverSpHandle_t handle;
158 csrcholInfo_t chol_info;
159 cusparseMatDescr_t desc;
163 typedef Kokkos::View<cusolver_type**, Kokkos::LayoutLeft, device_type> device_solve_array_t;
165 mutable device_solve_array_t xValues_;
166 mutable device_solve_array_t bValues_;
167 mutable device_value_type_array buffer_;
169 device_value_type_array device_nzvals_view_;
170 device_size_type_array device_row_ptr_view_;
171 device_ordinal_type_array device_cols_view_;
175 typedef Kokkos::View<ordinal_type*, device_type> permute_array_t;
176 permute_array_t device_perm_;
177 permute_array_t device_peri_;
178 mutable device_solve_array_t permute_result_;
182 struct solver_traits<cuSOLVER> {
183 #ifdef HAVE_TEUCHOS_COMPLEX
184 typedef Meta::make_list6<float, double,
185 std::complex<float>, std::complex<double>,
186 Kokkos::complex<float>, Kokkos::complex<double>>
189 typedef Meta::make_list2<float, double> supported_scalars;
193 template <
typename Scalar,
typename LocalOrdinal,
typename ExecutionSpace>
194 struct solver_supports_matrix<cuSOLVER,
195 KokkosSparse::CrsMatrix<Scalar, LocalOrdinal, ExecutionSpace>> {
196 static const bool value =
true;
201 #endif // AMESOS2_CUSOLVER_DECL_HPP
Amesos2::SolverCore: A templated interface for interaction with third-party direct sparse solvers...
Definition: Amesos2_SolverCore_decl.hpp:71
void setParameters_impl(const Teuchos::RCP< Teuchos::ParameterList > ¶meterList)
Definition: Amesos2_cuSOLVER_def.hpp:244
bool matrixShapeOK_impl() const
Determines whether the shape of the matrix is OK for this solver.
Definition: Amesos2_cuSOLVER_def.hpp:237
Map types to solver-specific data-types and enums.
Definition: Amesos2_TypeMap.hpp:48
Teuchos::RCP< const Teuchos::ParameterList > getValidParameters_impl() const
Definition: Amesos2_cuSOLVER_def.hpp:261
Amesos2 interface to cuSOLVER.
Definition: Amesos2_cuSOLVER_decl.hpp:25
int symbolicFactorization_impl()
Perform symbolic factorization of the matrix using cuSOLVER.
Definition: Amesos2_cuSOLVER_def.hpp:75
bool loadA_impl(EPhase current_phase)
Reads matrix data into internal structures.
Definition: Amesos2_cuSOLVER_def.hpp:284
bool do_optimization() const
can we optimize size_type and ordinal_type for straight pass through
Definition: Amesos2_cuSOLVER_def.hpp:278
int numericFactorization_impl()
cuSOLVER specific numeric factorization
Definition: Amesos2_cuSOLVER_def.hpp:101
std::string name() const override
Return the name of this solver.
Definition: Amesos2_SolverCore_def.hpp:725
Passes functions to TPL functions based on type.
Definition: Amesos2_FunctionMap.hpp:42
Provides access to interesting solver traits.
int preOrdering_impl()
Performs pre-ordering on the matrix to increase efficiency.
Definition: Amesos2_cuSOLVER_def.hpp:52
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:152