19 #ifndef AMESOS2_SUPERLU_DECL_HPP
20 #define AMESOS2_SUPERLU_DECL_HPP
23 #include "Amesos2_SolverCore.hpp"
26 #if defined(KOKKOSKERNELS_ENABLE_SUPERNODAL_SPTRSV) && defined(KOKKOSKERNELS_ENABLE_TPL_SUPERLU)
27 #include "KokkosKernels_Handle.hpp"
40 template <
class Matrix,
56 typedef typename super_type::scalar_type scalar_type;
57 typedef typename super_type::local_ordinal_type local_ordinal_type;
58 typedef typename super_type::global_ordinal_type global_ordinal_type;
59 typedef typename super_type::global_size_type global_size_type;
68 typedef typename type_map::type slu_type;
69 typedef typename type_map::convert_type slu_convert_type;
70 typedef typename type_map::magnitude_type magnitude_type;
83 Superlu(Teuchos::RCP<const Matrix> A,
84 Teuchos::RCP<Vector> X,
85 Teuchos::RCP<const Vector> B);
135 int
solve_impl(const Teuchos::Ptr<MultiVecAdapter<Vector> > X,
136 const Teuchos::Ptr<const MultiVecAdapter<Vector> > B) const;
179 const Teuchos::RCP<Teuchos::ParameterList> & parameterList );
201 typedef Kokkos::DefaultHostExecutionSpace HostExecSpaceType;
204 mutable struct SLUData {
205 SLU::SuperMatrix A, B, X, L, U;
208 SLU::superlu_options_t options;
209 SLU::mem_usage_t mem_usage;
210 #ifdef HAVE_AMESOS2_SUPERLU5_API
213 SLU::SuperLUStat_t stat;
217 typedef Kokkos::View<magnitude_type*, HostExecSpaceType> host_mag_array;
218 typedef Kokkos::View<int*, HostExecSpaceType> host_int_array;
221 host_int_array perm_r;
222 host_int_array perm_c;
223 host_int_array etree;
227 #if defined(KOKKOSKERNELS_ENABLE_SUPERNODAL_SPTRSV) && defined(KOKKOSKERNELS_ENABLE_TPL_SUPERLU)
228 host_int_array parents;
234 magnitude_type anorm, rcond;
240 typedef int size_type;
241 typedef int ordinal_type;
242 typedef Kokkos::View<size_type*, HostExecSpaceType> host_size_type_array;
243 typedef Kokkos::View<ordinal_type*, HostExecSpaceType> host_ordinal_type_array;
244 typedef Kokkos::View<slu_type*, HostExecSpaceType> host_value_type_array;
249 Teuchos::Array<slu_convert_type> convert_nzvals_;
256 typedef typename Kokkos::View<slu_type**, Kokkos::LayoutLeft, HostExecSpaceType>
261 mutable Teuchos::Array<slu_convert_type> convert_xValues_;
265 mutable Teuchos::Array<slu_convert_type> convert_bValues_;
267 #if defined(KOKKOSKERNELS_ENABLE_SUPERNODAL_SPTRSV) && defined(KOKKOSKERNELS_ENABLE_TPL_SUPERLU)
268 typedef Kokkos::DefaultExecutionSpace DeviceExecSpaceType;
270 #ifdef KOKKOS_ENABLE_CUDA
272 typedef typename Kokkos::CudaSpace DeviceMemSpaceType;
274 typedef typename DeviceExecSpaceType::memory_space DeviceMemSpaceType;
277 typedef Kokkos::View<slu_type**, Kokkos::LayoutLeft, DeviceMemSpaceType>
278 device_solve_array_t;
281 mutable device_solve_array_t device_xValues_;
282 mutable device_solve_array_t device_bValues_;
283 typedef Kokkos::View<int*, DeviceMemSpaceType> device_int_array;
284 typedef Kokkos::View<magnitude_type*, DeviceMemSpaceType> device_mag_array;
285 device_int_array device_trsv_perm_r_;
286 device_int_array device_trsv_perm_c_;
287 device_mag_array device_trsv_R_;
288 device_mag_array device_trsv_C_;
289 mutable device_solve_array_t device_trsv_rhs_;
290 mutable device_solve_array_t device_trsv_sol_;
291 typedef KokkosKernels::Experimental::KokkosKernelsHandle <size_type, ordinal_type, slu_type,
292 DeviceExecSpaceType, DeviceMemSpaceType, DeviceMemSpaceType> kernel_handle_type;
293 mutable kernel_handle_type device_khL_;
294 mutable kernel_handle_type device_khU_;
296 bool sptrsv_invert_diag_;
297 bool sptrsv_invert_offdiag_;
298 bool sptrsv_u_in_csr_;
299 bool sptrsv_merge_supernodes_;
300 bool sptrsv_use_spmv_;
334 bool use_triangular_solves_;
336 void triangular_solve_factor();
340 bool symmetrize_metis_;
343 void triangular_solve()
const;
350 #ifdef HAVE_TEUCHOS_COMPLEX
351 typedef Meta::make_list6<float, double,
352 std::complex<float>, std::complex<double>,
353 Kokkos::complex<float>, Kokkos::complex<double>>
356 typedef Meta::make_list2<float, double> supported_scalars;
360 template <
typename Scalar,
typename LocalOrdinal,
typename ExecutionSpace>
361 struct solver_supports_matrix<Superlu,
362 KokkosSparse::CrsMatrix<Scalar, LocalOrdinal, ExecutionSpace>> {
363 static const bool value =
true;
368 #endif // AMESOS2_SUPERLU_DECL_HPP
Amesos2::SolverCore: A templated interface for interaction with third-party direct sparse solvers...
Definition: Amesos2_SolverCore_decl.hpp:71
bool loadA_impl(EPhase current_phase)
Reads matrix data into internal structures.
Definition: Amesos2_Superlu_def.hpp:928
int numericFactorization_impl()
Superlu specific numeric factorization.
Definition: Amesos2_Superlu_def.hpp:283
Map types to solver-specific data-types and enums.
Definition: Amesos2_TypeMap.hpp:48
bool matrixShapeOK_impl() const
Determines whether the shape of the matrix is OK for this solver.
Definition: Amesos2_Superlu_def.hpp:665
host_value_type_array host_nzvals_view_
Stores the values of the nonzero entries for SuperLU.
Definition: Amesos2_Superlu_decl.hpp:248
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:37
host_size_type_array host_rows_view_
Stores the location in Ai_ and Aval_ that starts row j.
Definition: Amesos2_Superlu_decl.hpp:252
Teuchos::RCP< const Teuchos::ParameterList > getValidParameters_impl() const
Definition: Amesos2_Superlu_def.hpp:784
std::string description() const override
Returns a short description of this Solver.
Definition: Amesos2_Superlu_def.hpp:117
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:463
host_solve_array_t host_xValues_
Persisting 1D store for X.
Definition: Amesos2_Superlu_decl.hpp:260
host_ordinal_type_array host_col_ptr_view_
Stores the row indices of the nonzero entries.
Definition: Amesos2_Superlu_decl.hpp:254
std::string name() const override
Return the name of this solver.
Definition: Amesos2_SolverCore_def.hpp:725
host_solve_array_t host_bValues_
Persisting 1D store for B.
Definition: Amesos2_Superlu_decl.hpp:264
Interface to Amesos2 solver objects.
Definition: Amesos2_Solver_decl.hpp:44
Passes functions to TPL functions based on type.
Definition: Amesos2_FunctionMap.hpp:42
Provides access to interesting solver traits.
void setParameters_impl(const Teuchos::RCP< Teuchos::ParameterList > ¶meterList)
Definition: Amesos2_Superlu_def.hpp:676
int preOrdering_impl()
Performs pre-ordering on the matrix to increase efficiency.
Definition: Amesos2_Superlu_def.hpp:171
int symbolicFactorization_impl()
Perform symbolic factorization of the matrix using Superlu.
Definition: Amesos2_Superlu_def.hpp:196
Amesos2 interface to the SuperLU package.
Definition: Amesos2_Superlu_decl.hpp:42