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_;
303 mutable Teuchos::Array<slu_convert_type> convert_bValues_;
306 #if defined(KOKKOSKERNELS_ENABLE_SUPERNODAL_SPTRSV) && defined(KOKKOSKERNELS_ENABLE_TPL_SUPERLU)
307 typedef Kokkos::DefaultExecutionSpace DeviceExecSpaceType;
309 #ifdef KOKKOS_ENABLE_CUDA
311 typedef typename Kokkos::CudaSpace DeviceMemSpaceType;
313 typedef typename DeviceExecSpaceType::memory_space DeviceMemSpaceType;
316 typedef Kokkos::View<slu_type**, Kokkos::LayoutLeft, DeviceMemSpaceType>
317 device_solve_array_t;
320 mutable device_solve_array_t device_xValues_;
321 mutable device_solve_array_t device_bValues_;
322 typedef Kokkos::View<int*, DeviceMemSpaceType> device_int_array;
323 device_int_array device_trsv_perm_r_;
324 device_int_array device_trsv_perm_c_;
325 mutable device_solve_array_t device_trsv_rhs_;
326 mutable device_solve_array_t device_trsv_sol_;
327 typedef KokkosKernels::Experimental::KokkosKernelsHandle <size_type, ordinal_type, slu_type,
328 DeviceExecSpaceType, DeviceMemSpaceType, DeviceMemSpaceType> kernel_handle_type;
329 mutable kernel_handle_type device_khL_;
330 mutable kernel_handle_type device_khU_;
364 bool use_triangular_solves_;
366 void triangular_solve_factor();
369 void triangular_solve()
const;
376 #ifdef HAVE_TEUCHOS_COMPLEX
377 typedef Meta::make_list6<float, double,
378 std::complex<float>, std::complex<double>,
379 Kokkos::complex<float>, Kokkos::complex<double>>
382 typedef Meta::make_list2<float, double> supported_scalars;
386 template <
typename Scalar,
typename LocalOrdinal,
typename ExecutionSpace>
387 struct solver_supports_matrix<Superlu,
388 KokkosSparse::CrsMatrix<Scalar, LocalOrdinal, ExecutionSpace>> {
389 static const bool value =
true;
394 #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:815
int numericFactorization_impl()
Superlu specific numeric factorization.
Definition: Amesos2_Superlu_def.hpp:241
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:581
host_value_type_array host_nzvals_view_
Stores the values of the nonzero entries for SuperLU.
Definition: Amesos2_Superlu_decl.hpp:285
std::string name() const
Return the name of this solver.
Definition: Amesos2_SolverCore_def.hpp:509
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
Teuchos::RCP< const Teuchos::ParameterList > getValidParameters_impl() const
Definition: Amesos2_Superlu_def.hpp:683
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:386
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:302
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:592
int preOrdering_impl()
Performs pre-ordering on the matrix to increase efficiency.
Definition: Amesos2_Superlu_def.hpp:194
std::string description() const
Returns a short description of this Solver.
Definition: Amesos2_Superlu_def.hpp:140
int symbolicFactorization_impl()
Perform symbolic factorization of the matrix using Superlu.
Definition: Amesos2_Superlu_def.hpp:219
Amesos2 interface to the SuperLU package.
Definition: Amesos2_Superlu_decl.hpp:76