Amesos2 - Direct Sparse Solver Interfaces Version of the Day
Amesos2_Superlumt_decl.hpp
Go to the documentation of this file.
1// @HEADER
2// *****************************************************************************
3// Amesos2: Templated Direct Sparse Solver Package
4//
5// Copyright 2011 NTESS and the Amesos2 contributors.
6// SPDX-License-Identifier: BSD-3-Clause
7// *****************************************************************************
8// @HEADER
9
19#ifndef AMESOS2_SUPERLUMT_DECL_HPP
20#define AMESOS2_SUPERLUMT_DECL_HPP
21
25
26
27namespace Amesos2 {
28
29
41template <class Matrix,
42 class Vector>
43class Superlumt : public SolverCore<Amesos2::Superlumt, Matrix, Vector>
44{
45 friend class SolverCore<Amesos2::Superlumt,Matrix,Vector>; // Give our base access
46 // to our private
47 // implementation funcs
48public:
49
51 static const char* name; // declaration. Initialization outside.
52
53 typedef Superlumt<Matrix,Vector> type;
54 typedef SolverCore<Amesos2::Superlumt,Matrix,Vector> super_type;
55
56 // Since typedef's are not inheritted, go grab them
57 typedef typename super_type::scalar_type scalar_type;
58 typedef typename super_type::local_ordinal_type local_ordinal_type;
59 typedef typename super_type::global_ordinal_type global_ordinal_type;
60 typedef typename super_type::global_size_type global_size_type;
61
62 typedef TypeMap<Amesos2::Superlumt,scalar_type> type_map;
63
64 typedef typename type_map::type slu_type;
65 typedef typename type_map::magnitude_type magnitude_type;
66
67 typedef FunctionMap<Amesos2::Superlumt,slu_type> function_map;
68
69
71
72
79 Superlumt(Teuchos::RCP<const Matrix> A,
80 Teuchos::RCP<Vector> X,
81 Teuchos::RCP<const Vector> B);
82
83
85 ~Superlumt( );
86
88
89private:
90
97 int preOrdering_impl();
98
99
108
109
120
121
133 int solve_impl(const Teuchos::Ptr<MultiVecAdapter<Vector> > X,
134 const Teuchos::Ptr<const MultiVecAdapter<Vector> > B) const;
135
136
142 bool matrixShapeOK_impl() const;
143
144
183 const Teuchos::RCP<Teuchos::ParameterList> & parameterList );
184 /* Parameters to support in the future:
185 *
186 * <li> \c "IterRefine" : { \c "NO" | \c "SINGLE" | \c "DOUBLE" | \c "EXTRA"
187 * }. Specifies whether to perform iterative refinement, and in
188 * what precision to compute the residual. (Not currently supported)</li>
189 */
190
191
196 void describe_impl(Teuchos::FancyOStream &out,
197 const Teuchos::EVerbosityLevel verbLevel) const;
198
199
206 Teuchos::RCP<const Teuchos::ParameterList> getValidParameters_impl() const;
207
208
217 bool loadA_impl(EPhase current_phase);
218
219
220 // struct holds all data necessary to make a superlu factorization or solve call
221 mutable struct SLUData {
222 SLUMT::SuperMatrix A, BX, L, U;
223 SLUMT::SuperMatrix AC;
224
225 SLUMT::superlumt_options_t options;
226 SLUMT::superlu_memusage_t mem_usage;
227 SLUMT::Gstat_t stat;
228
229 Teuchos::Array<magnitude_type> berr;
230 Teuchos::Array<magnitude_type> ferr;
231 Teuchos::Array<int> perm_r;
232 Teuchos::Array<int> perm_c;
233 Teuchos::Array<magnitude_type> R;
234 Teuchos::Array<magnitude_type> C;
235
236 // in contrast to SuperLU, memory for etree will be allocated by
237 // pxgssvx and the pointer will be stored in `options'
238
239 SLUMT::equed_t equed;
240 bool rowequ, colequ;
241 } data_;
242
243 // The following Arrays are persisting storage arrays for A, X, and B
245 Teuchos::Array<typename TypeMap<Amesos2::Superlumt,scalar_type>::type> nzvals_;
247 Teuchos::Array<int> rowind_;
249 Teuchos::Array<int> colptr_;
250
251 /* Note: In the above, must use "Amesos2::Superlumt" rather than
252 * "Superlumt" because otherwise the compiler references the
253 * specialized type of the class, and not the templated type that is
254 * required for Amesos2::TypeMap
255 */
256
257 /* SuperLU can accept input in either compressed-row or
258 * compressed-column storage. We will store and pass matrices in
259 * *compressed-row* format because that is the format Amesos used.
260 */
261
262 bool is_contiguous_;
263
264}; // End class Superlumt
265
266
267// Specialize the solver_traits struct for SuperLU_MT
268template <>
269struct solver_traits<Superlumt> {
270#ifdef HAVE_TEUCHOS_COMPLEX
271 typedef Meta::make_list6<float,
272 double,
273 std::complex<float>,
274 std::complex<double>,
275 SLUMT::C::complex,
276 SLUMT::Z::doublecomplex> supported_scalars;
277#else
278 typedef Meta::make_list2<float, double> supported_scalars;
279#endif
280};
281
282} // end namespace Amesos2
283
284#endif // AMESOS2_SUPERLUMT_DECL_HPP
Templated core-functionality class for Amesos2 solvers.
Provides access to interesting solver traits.
Provides a mechanism to map function calls to the correct Solver function based on the scalar type of...
Amesos2::SolverCore: A templated interface for interaction with third-party direct sparse solvers.
Definition Amesos2_SolverCore_decl.hpp:72
Amesos2 interface to the Multi-threaded version of SuperLU.
Definition Amesos2_Superlumt_decl.hpp:44
int solve_impl(const Teuchos::Ptr< MultiVecAdapter< Vector > > X, const Teuchos::Ptr< const MultiVecAdapter< Vector > > B) const
SuperLU_MT specific solve.
Definition Amesos2_Superlumt_def.hpp:297
bool matrixShapeOK_impl() const
Determines whether the shape of the matrix is OK for this solver.
Definition Amesos2_Superlumt_def.hpp:411
Teuchos::Array< typename TypeMap< Amesos2::Superlumt, scalar_type >::type > nzvals_
Stores the values of the nonzero entries for SuperLU.
Definition Amesos2_Superlumt_decl.hpp:245
int numericFactorization_impl()
SuperLU_MT specific numeric factorization.
Definition Amesos2_Superlumt_def.hpp:193
int symbolicFactorization_impl()
Perform symbolic factorization of the matrix using SuperLU_MT.
Definition Amesos2_Superlumt_def.hpp:168
int preOrdering_impl()
Performs pre-ordering on the matrix to increase efficiency.
Definition Amesos2_Superlumt_def.hpp:148
Teuchos::RCP< const Teuchos::ParameterList > getValidParameters_impl() const
Definition Amesos2_Superlumt_def.hpp:476
Teuchos::Array< int > rowind_
Stores the row indices of the nonzero entries.
Definition Amesos2_Superlumt_decl.hpp:247
Teuchos::Array< int > colptr_
Stores the location in Ai_ and Aval_ that starts row j.
Definition Amesos2_Superlumt_decl.hpp:249
static const char * name
Name of this solver interface.
Definition Amesos2_Superlumt_decl.hpp:51
bool loadA_impl(EPhase current_phase)
Reads matrix data into internal structures.
Definition Amesos2_Superlumt_def.hpp:565
void setParameters_impl(const Teuchos::RCP< Teuchos::ParameterList > &parameterList)
Definition Amesos2_Superlumt_def.hpp:422
void describe_impl(Teuchos::FancyOStream &out, const Teuchos::EVerbosityLevel verbLevel) const
Prints the status information about the current solver with some level of verbosity.
Definition Amesos2_Superlumt_def.hpp:633
Passes functions to TPL functions based on type.
Definition Amesos2_FunctionMap.hpp:43
Map types to solver-specific data-types and enums.
Definition Amesos2_TypeMap.hpp:48
Provides traits about solvers.
Definition Amesos2_SolverTraits.hpp:37