53 #ifndef AMESOS2_CHOLMOD_DECL_HPP
54 #define AMESOS2_CHOLMOD_DECL_HPP
57 #include "Amesos2_SolverCore.hpp"
60 #if defined(KOKKOSKERNELS_ENABLE_SUPERNODAL_SPTRSV) && defined(KOKKOSKERNELS_ENABLE_TPL_CHOLMOD)
61 #include "KokkosKernels_Handle.hpp"
74 template <
class Matrix,
90 typedef typename super_type::scalar_type scalar_type;
91 typedef typename super_type::local_ordinal_type local_ordinal_type;
92 typedef typename super_type::global_ordinal_type global_ordinal_type;
93 typedef typename super_type::global_size_type global_size_type;
94 typedef typename super_type::node_type node_type;
103 typedef typename type_map::type chol_type;
104 typedef typename type_map::magnitude_type magnitude_type;
117 Cholmod(Teuchos::RCP<const Matrix> A,
118 Teuchos::RCP<Vector> X,
119 Teuchos::RCP<const Vector> B);
164 int
solve_impl(const Teuchos::Ptr<MultiVecAdapter<Vector> > X,
165 const Teuchos::Ptr<const MultiVecAdapter<Vector> > B) const;
202 const Teuchos::RCP<Teuchos::ParameterList> & parameterList );
226 mutable struct CholData {
229 cholmod_dense *Y, *E;
234 typedef Kokkos::DefaultHostExecutionSpace HostExecSpaceType;
235 typedef typename HostExecSpaceType::memory_space HostMemSpaceType;
237 typedef long size_type;
238 typedef long ordinal_type;
239 typedef Kokkos::View<size_type*, HostExecSpaceType> host_size_type_array;
240 typedef Kokkos::View<ordinal_type*, HostExecSpaceType> host_ordinal_type_array;
242 typedef Kokkos::View<chol_type*, HostExecSpaceType> host_value_type_array;
252 typedef typename Kokkos::View<chol_type**, Kokkos::LayoutLeft, HostExecSpaceType>
263 #if defined(KOKKOSKERNELS_ENABLE_SUPERNODAL_SPTRSV) && defined(KOKKOSKERNELS_ENABLE_TPL_CHOLMOD)
265 typedef Kokkos::DefaultExecutionSpace DeviceExecSpaceType;
267 #ifdef KOKKOS_ENABLE_CUDA
269 typedef typename Kokkos::CudaSpace DeviceMemSpaceType;
271 typedef typename DeviceExecSpaceType::memory_space DeviceMemSpaceType;
274 typedef Kokkos::View<chol_type**, Kokkos::LayoutLeft, DeviceMemSpaceType>
275 device_solve_array_t;
278 mutable device_solve_array_t device_xValues_;
279 mutable device_solve_array_t device_bValues_;
280 typedef Kokkos::View<int*, HostMemSpaceType> host_int_array;
281 typedef Kokkos::View<int*, DeviceMemSpaceType> device_int_array;
282 host_int_array host_trsv_etree_;
283 host_int_array host_trsv_perm_;
284 device_int_array device_trsv_perm_;
285 mutable device_solve_array_t device_trsv_rhs_;
286 mutable device_solve_array_t device_trsv_sol_;
287 typedef KokkosKernels::Experimental::KokkosKernelsHandle <size_type, ordinal_type, chol_type,
288 DeviceExecSpaceType, DeviceMemSpaceType, DeviceMemSpaceType> kernel_handle_type;
289 mutable kernel_handle_type device_khL_;
290 mutable kernel_handle_type device_khU_;
298 Teuchos::RCP<const Tpetra::Map<local_ordinal_type,global_ordinal_type,node_type> > map;
301 bool use_triangular_solves_;
303 void triangular_solve_symbolic();
304 void triangular_solve_numeric();
307 void triangular_solve()
const;
323 #ifdef HAVE_TEUCHOS_COMPLEX
324 typedef Meta::make_list3<double, std::complex<double>,
325 Kokkos::complex<double>> supported_scalars;
327 typedef Meta::make_list1<double> supported_scalars;
331 template <
typename Scalar,
typename LocalOrdinal,
typename ExecutionSpace>
332 struct solver_supports_matrix<Cholmod,
333 KokkosSparse::CrsMatrix<Scalar, LocalOrdinal, ExecutionSpace>> {
334 static const bool value =
true;
339 #endif // AMESOS2_CHOLMOD_DECL_HPP
int preOrdering_impl()
Performs pre-ordering on the matrix to increase efficiency.
Definition: Amesos2_Cholmod_def.hpp:112
Amesos2::SolverCore: A templated interface for interaction with third-party direct sparse solvers...
Definition: Amesos2_SolverCore_decl.hpp:105
host_solve_array_t host_xValues_
Persisting 1D store for X.
Definition: Amesos2_Cholmod_decl.hpp:256
Teuchos::RCP< const Teuchos::ParameterList > getValidParameters_impl() const
Definition: Amesos2_Cholmod_def.hpp:375
Template for providing a mechanism to map function calls to the correct Solver function based on the ...
Map types to solver-specific data-types and enums.
Definition: Amesos2_TypeMap.hpp:82
bool matrixShapeOK_impl() const
Determines whether the shape of the matrix is OK for this solver.
Definition: Amesos2_Cholmod_def.hpp:324
std::string name() const
Return the name of this solver.
Definition: Amesos2_SolverCore_def.hpp:509
host_value_type_array host_nzvals_view_
Stores the values of the nonzero entries for CHOLMOD.
Definition: Amesos2_Cholmod_decl.hpp:246
Provides traits about solvers.
Definition: Amesos2_SolverTraits.hpp:71
host_ordinal_type_array host_col_ptr_view_
Stores the row indices of the nonzero entries.
Definition: Amesos2_Cholmod_decl.hpp:250
int solve_impl(const Teuchos::Ptr< MultiVecAdapter< Vector > > X, const Teuchos::Ptr< const MultiVecAdapter< Vector > > B) const
CHOLMOD specific solve.
Definition: Amesos2_Cholmod_def.hpp:224
void setParameters_impl(const Teuchos::RCP< Teuchos::ParameterList > ¶meterList)
Definition: Amesos2_Cholmod_def.hpp:332
host_size_type_array host_rows_view_
Stores the location in Ai_ and Aval_ that starts row j.
Definition: Amesos2_Cholmod_decl.hpp:248
Passes functions to TPL functions based on type.
Definition: Amesos2_FunctionMap.hpp:76
Provides access to interesting solver traits.
bool loadA_impl(EPhase current_phase)
Reads matrix data into internal structures.
Definition: Amesos2_Cholmod_def.hpp:427
int symbolicFactorization_impl()
Perform symbolic factorization of the matrix using CHOLMOD.
Definition: Amesos2_Cholmod_def.hpp:137
Amesos2 interface to the CHOLMOD package.
Definition: Amesos2_Cholmod_decl.hpp:76
int numericFactorization_impl()
CHOLMOD specific numeric factorization.
Definition: Amesos2_Cholmod_def.hpp:175
host_solve_array_t host_bValues_
Persisting 1D store for B.
Definition: Amesos2_Cholmod_decl.hpp:260