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;
108 #ifdef HAVE_AMESOS2_SUPERLU5_API 109 typedef typename function_map::GlobalLU_type GlobalLU_t;
121 Superlu(Teuchos::RCP<const Matrix> A,
122 Teuchos::RCP<Vector> X,
123 Teuchos::RCP<const Vector> B);
173 int
solve_impl(const Teuchos::Ptr<MultiVecAdapter<Vector> > X,
174 const Teuchos::Ptr<const MultiVecAdapter<Vector> > B) const;
217 const Teuchos::RCP<Teuchos::ParameterList> & parameterList );
239 typedef Kokkos::DefaultHostExecutionSpace HostExecSpaceType;
242 mutable struct SLUData {
243 SLU::SuperMatrix A, B, X, L, U;
246 SLU::superlu_options_t options;
247 SLU::mem_usage_t mem_usage;
248 #ifdef HAVE_AMESOS2_SUPERLU5_API 251 SLU::SuperLUStat_t stat;
255 typedef Kokkos::View<magnitude_type*, HostExecSpaceType> host_mag_array;
256 typedef Kokkos::View<int*, HostExecSpaceType> host_int_array;
259 host_int_array perm_r;
260 host_int_array perm_c;
261 host_int_array etree;
265 #if defined(KOKKOSKERNELS_ENABLE_SUPERNODAL_SPTRSV) && defined(KOKKOSKERNELS_ENABLE_TPL_SUPERLU) 266 host_int_array parents;
277 typedef int size_type;
278 typedef int ordinal_type;
279 typedef Kokkos::View<size_type*, HostExecSpaceType> host_size_type_array;
280 typedef Kokkos::View<ordinal_type*, HostExecSpaceType> host_ordinal_type_array;
281 typedef Kokkos::View<slu_type*, HostExecSpaceType> host_value_type_array;
286 Teuchos::Array<slu_convert_type> convert_nzvals_;
293 typedef typename Kokkos::View<slu_type**, Kokkos::LayoutLeft, HostExecSpaceType>
298 mutable Teuchos::Array<slu_convert_type> convert_xValues_;
302 mutable Teuchos::Array<slu_convert_type> convert_bValues_;
304 #if defined(KOKKOSKERNELS_ENABLE_SUPERNODAL_SPTRSV) && defined(KOKKOSKERNELS_ENABLE_TPL_SUPERLU) 305 typedef Kokkos::DefaultExecutionSpace DeviceExecSpaceType;
307 #ifdef KOKKOS_ENABLE_CUDA 309 typedef typename Kokkos::CudaSpace DeviceMemSpaceType;
311 typedef typename DeviceExecSpaceType::memory_space DeviceMemSpaceType;
314 typedef Kokkos::View<slu_type**, Kokkos::LayoutLeft, DeviceMemSpaceType>
315 device_solve_array_t;
318 mutable device_solve_array_t device_xValues_;
319 mutable device_solve_array_t device_bValues_;
320 typedef Kokkos::View<int*, DeviceMemSpaceType> device_int_array;
321 typedef Kokkos::View<magnitude_type*, DeviceMemSpaceType> device_mag_array;
322 device_int_array device_trsv_perm_r_;
323 device_int_array device_trsv_perm_c_;
324 device_mag_array device_trsv_R_;
325 device_mag_array device_trsv_C_;
326 mutable device_solve_array_t device_trsv_rhs_;
327 mutable device_solve_array_t device_trsv_sol_;
328 typedef KokkosKernels::Experimental::KokkosKernelsHandle <size_type, ordinal_type, slu_type,
329 DeviceExecSpaceType, DeviceMemSpaceType, DeviceMemSpaceType> kernel_handle_type;
330 mutable kernel_handle_type device_khL_;
331 mutable kernel_handle_type device_khU_;
333 bool sptrsv_invert_diag_;
334 bool sptrsv_invert_offdiag_;
335 bool sptrsv_u_in_csr_;
336 bool sptrsv_merge_supernodes_;
337 bool sptrsv_use_spmv_;
371 bool use_triangular_solves_;
373 void triangular_solve_factor();
377 bool symmetrize_metis_;
380 void triangular_solve()
const;
387 #ifdef HAVE_TEUCHOS_COMPLEX 388 typedef Meta::make_list6<float, double,
389 std::complex<float>, std::complex<double>,
390 Kokkos::complex<float>, Kokkos::complex<double>>
393 typedef Meta::make_list2<float, double> supported_scalars;
397 template <
typename Scalar,
typename LocalOrdinal,
typename ExecutionSpace>
398 struct solver_supports_matrix<Superlu,
399 KokkosSparse::CrsMatrix<Scalar, LocalOrdinal, ExecutionSpace>> {
400 static const bool value =
true;
405 #endif // AMESOS2_SUPERLU_DECL_HPP Amesos2::SolverCore: A templated interface for interaction with third-party direct sparse solvers...
Definition: Amesos2_SolverCore_decl.hpp:105
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:462
bool loadA_impl(EPhase current_phase)
Reads matrix data into internal structures.
Definition: Amesos2_Superlu_def.hpp:924
int numericFactorization_impl()
Superlu specific numeric factorization.
Definition: Amesos2_Superlu_def.hpp:313
Map types to solver-specific data-types and enums.
Definition: Amesos2_TypeMap.hpp:82
Teuchos::RCP< const Teuchos::ParameterList > getValidParameters_impl() const
Definition: Amesos2_Superlu_def.hpp:780
host_value_type_array host_nzvals_view_
Stores the values of the nonzero entries for SuperLU.
Definition: Amesos2_Superlu_decl.hpp:285
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:289
Definition: Amesos2_AbstractConcreteMatrixAdapter.hpp:48
host_solve_array_t host_xValues_
Persisting 1D store for X.
Definition: Amesos2_Superlu_decl.hpp:297
host_ordinal_type_array host_col_ptr_view_
Stores the row indices of the nonzero entries.
Definition: Amesos2_Superlu_decl.hpp:291
host_solve_array_t host_bValues_
Persisting 1D store for B.
Definition: Amesos2_Superlu_decl.hpp:301
Interface to Amesos2 solver objects.
Definition: Amesos2_Solver_decl.hpp:78
std::string description() const
Returns a short description of this Solver.
Definition: Amesos2_Superlu_def.hpp:151
std::string name() const
Return the name of this solver.
Definition: Amesos2_SolverCore_def.hpp:509
Passes functions to TPL functions based on type.
Definition: Amesos2_FunctionMap.hpp:76
Provides access to interesting solver traits.
bool matrixShapeOK_impl() const
Determines whether the shape of the matrix is OK for this solver.
Definition: Amesos2_Superlu_def.hpp:664
void setParameters_impl(const Teuchos::RCP< Teuchos::ParameterList > ¶meterList)
Definition: Amesos2_Superlu_def.hpp:675
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