53 #ifndef AMESOS2_SUPERLU_DECL_HPP
54 #define AMESOS2_SUPERLU_DECL_HPP
57 #include "Amesos2_SolverCore.hpp"
60 #if defined(KOKKOSKERNELS_ENABLE_SUPERNODAL_SPTRSV) && defined(KOKKOSKERNELS_ENABLE_TPL_SUPERLU)
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;
102 typedef typename type_map::type slu_type;
103 typedef typename type_map::convert_type slu_convert_type;
104 typedef typename type_map::magnitude_type magnitude_type;
117 Superlu(Teuchos::RCP<const Matrix> A,
118 Teuchos::RCP<Vector> X,
119 Teuchos::RCP<const Vector> B);
169 int
solve_impl(const Teuchos::Ptr<MultiVecAdapter<Vector> > X,
170 const Teuchos::Ptr<const MultiVecAdapter<Vector> > B) const;
213 const Teuchos::RCP<Teuchos::ParameterList> & parameterList );
235 typedef Kokkos::DefaultHostExecutionSpace HostExecSpaceType;
238 mutable struct SLUData {
239 SLU::SuperMatrix A, B, X, L, U;
242 SLU::superlu_options_t options;
243 SLU::mem_usage_t mem_usage;
244 #ifdef HAVE_AMESOS2_SUPERLU5_API
247 SLU::SuperLUStat_t stat;
251 typedef Kokkos::View<magnitude_type*, HostExecSpaceType> host_mag_array;
252 typedef Kokkos::View<int*, HostExecSpaceType> host_int_array;
255 host_int_array perm_r;
256 host_int_array perm_c;
257 host_int_array etree;
261 #if defined(KOKKOSKERNELS_ENABLE_SUPERNODAL_SPTRSV) && defined(KOKKOSKERNELS_ENABLE_TPL_SUPERLU)
262 host_int_array parents;
268 magnitude_type anorm, rcond;
274 typedef int size_type;
275 typedef int ordinal_type;
276 typedef Kokkos::View<size_type*, HostExecSpaceType> host_size_type_array;
277 typedef Kokkos::View<ordinal_type*, HostExecSpaceType> host_ordinal_type_array;
278 typedef Kokkos::View<slu_type*, HostExecSpaceType> host_value_type_array;
283 Teuchos::Array<slu_convert_type> convert_nzvals_;
290 typedef typename Kokkos::View<slu_type**, Kokkos::LayoutLeft, HostExecSpaceType>
295 mutable Teuchos::Array<slu_convert_type> convert_xValues_;
299 mutable Teuchos::Array<slu_convert_type> convert_bValues_;
301 #if defined(KOKKOSKERNELS_ENABLE_SUPERNODAL_SPTRSV) && defined(KOKKOSKERNELS_ENABLE_TPL_SUPERLU)
302 typedef Kokkos::DefaultExecutionSpace DeviceExecSpaceType;
304 #ifdef KOKKOS_ENABLE_CUDA
306 typedef typename Kokkos::CudaSpace DeviceMemSpaceType;
308 typedef typename DeviceExecSpaceType::memory_space DeviceMemSpaceType;
311 typedef Kokkos::View<slu_type**, Kokkos::LayoutLeft, DeviceMemSpaceType>
312 device_solve_array_t;
315 mutable device_solve_array_t device_xValues_;
316 mutable device_solve_array_t device_bValues_;
317 typedef Kokkos::View<int*, DeviceMemSpaceType> device_int_array;
318 typedef Kokkos::View<magnitude_type*, DeviceMemSpaceType> device_mag_array;
319 device_int_array device_trsv_perm_r_;
320 device_int_array device_trsv_perm_c_;
321 device_mag_array device_trsv_R_;
322 device_mag_array device_trsv_C_;
323 mutable device_solve_array_t device_trsv_rhs_;
324 mutable device_solve_array_t device_trsv_sol_;
325 typedef KokkosKernels::Experimental::KokkosKernelsHandle <size_type, ordinal_type, slu_type,
326 DeviceExecSpaceType, DeviceMemSpaceType, DeviceMemSpaceType> kernel_handle_type;
327 mutable kernel_handle_type device_khL_;
328 mutable kernel_handle_type device_khU_;
330 bool sptrsv_invert_diag_;
331 bool sptrsv_invert_offdiag_;
332 bool sptrsv_u_in_csr_;
333 bool sptrsv_merge_supernodes_;
334 bool sptrsv_use_spmv_;
368 bool use_triangular_solves_;
370 void triangular_solve_factor();
374 bool symmetrize_metis_;
377 void triangular_solve()
const;
384 #ifdef HAVE_TEUCHOS_COMPLEX
385 typedef Meta::make_list6<float, double,
386 std::complex<float>, std::complex<double>,
387 Kokkos::complex<float>, Kokkos::complex<double>>
390 typedef Meta::make_list2<float, double> supported_scalars;
394 template <
typename Scalar,
typename LocalOrdinal,
typename ExecutionSpace>
395 struct solver_supports_matrix<Superlu,
396 KokkosSparse::CrsMatrix<Scalar, LocalOrdinal, ExecutionSpace>> {
397 static const bool value =
true;
402 #endif // AMESOS2_SUPERLU_DECL_HPP
Amesos2::SolverCore: A templated interface for interaction with third-party direct sparse solvers...
Definition: Amesos2_SolverCore_decl.hpp:105
bool loadA_impl(EPhase current_phase)
Reads matrix data into internal structures.
Definition: Amesos2_Superlu_def.hpp:962
int numericFactorization_impl()
Superlu specific numeric factorization.
Definition: Amesos2_Superlu_def.hpp:317
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_Superlu_def.hpp:699
host_value_type_array host_nzvals_view_
Stores the values of the nonzero entries for SuperLU.
Definition: Amesos2_Superlu_decl.hpp:282
Provides a mechanism to map function calls to the correct Solver function based on the scalar type of...
Provides traits about solvers.
Definition: Amesos2_SolverTraits.hpp:71
host_size_type_array host_rows_view_
Stores the location in Ai_ and Aval_ that starts row j.
Definition: Amesos2_Superlu_decl.hpp:286
Teuchos::RCP< const Teuchos::ParameterList > getValidParameters_impl() const
Definition: Amesos2_Superlu_def.hpp:818
std::string description() const override
Returns a short description of this Solver.
Definition: Amesos2_Superlu_def.hpp:151
int solve_impl(const Teuchos::Ptr< MultiVecAdapter< Vector > > X, const Teuchos::Ptr< const MultiVecAdapter< Vector > > B) const
Superlu specific solve.
Definition: Amesos2_Superlu_def.hpp:497
host_solve_array_t host_xValues_
Persisting 1D store for X.
Definition: Amesos2_Superlu_decl.hpp:294
host_ordinal_type_array host_col_ptr_view_
Stores the row indices of the nonzero entries.
Definition: Amesos2_Superlu_decl.hpp:288
std::string name() const override
Return the name of this solver.
Definition: Amesos2_SolverCore_def.hpp:759
host_solve_array_t host_bValues_
Persisting 1D store for B.
Definition: Amesos2_Superlu_decl.hpp:298
Interface to Amesos2 solver objects.
Definition: Amesos2_Solver_decl.hpp:78
Passes functions to TPL functions based on type.
Definition: Amesos2_FunctionMap.hpp:76
Provides access to interesting solver traits.
void setParameters_impl(const Teuchos::RCP< Teuchos::ParameterList > ¶meterList)
Definition: Amesos2_Superlu_def.hpp:710
int preOrdering_impl()
Performs pre-ordering on the matrix to increase efficiency.
Definition: Amesos2_Superlu_def.hpp:205
int symbolicFactorization_impl()
Perform symbolic factorization of the matrix using Superlu.
Definition: Amesos2_Superlu_def.hpp:230
Amesos2 interface to the SuperLU package.
Definition: Amesos2_Superlu_decl.hpp:76