Amesos2 - Direct Sparse Solver Interfaces  Version of the Day
Amesos2_STRUMPACK_def.hpp
1 // @HEADER
2 //
3 // ***********************************************************************
4 //
5 // Amesos2: Templated Direct Sparse Solver Package
6 // Copyright 2011 Sandia Corporation
7 //
8 // Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation,
9 // the U.S. Government retains certain rights in this software.
10 //
11 // Redistribution and use in source and binary forms, with or without
12 // modification, are permitted provided that the following conditions are
13 // met:
14 //
15 // 1. Redistributions of source code must retain the above copyright
16 // notice, this list of conditions and the following disclaimer.
17 //
18 // 2. Redistributions in binary form must reproduce the above copyright
19 // notice, this list of conditions and the following disclaimer in the
20 // documentation and/or other materials provided with the distribution.
21 //
22 // 3. Neither the name of the Corporation nor the names of the
23 // contributors may be used to endorse or promote products derived from
24 // this software without specific prior written permission.
25 //
26 // THIS SOFTWARE IS PROVIDED BY SANDIA CORPORATION "AS IS" AND ANY
27 // EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
28 // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
29 // PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL SANDIA CORPORATION OR THE
30 // CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
31 // EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
32 // PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
33 // PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
34 // LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
35 // NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
36 // SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
37 //
38 // Questions? Contact Lisa Claus (lclaus@lbl.gov)
39 //
40 // ***********************************************************************
41 //
42 // @HEADER
43 
44 
45 #ifndef AMESOS2_STRUMPACK_DEF_HPP
46 #define AMESOS2_STRUMPACK_DEF_HPP
47 
48 #include <Teuchos_Tuple.hpp>
49 #include <Teuchos_StandardParameterEntryValidators.hpp>
50 
52 #include "Amesos2_Util.hpp"
53 
54 #include <memory>
55 #ifdef HAVE_MPI
56 #include <Teuchos_DefaultMpiComm.hpp>
57 #include "StrumpackSparseSolverMPIDist.hpp"
58 #else
59 #include "StrumpackSparseSolver.hpp"
60 #endif
61 
62 namespace Amesos2 {
63 
64 
65  template <class Matrix, class Vector>
66  STRUMPACK<Matrix,Vector>::STRUMPACK(Teuchos::RCP<const Matrix> A,
67  Teuchos::RCP<Vector> X,
68  Teuchos::RCP<const Vector> B)
69  : SolverCore<Amesos2::STRUMPACK,Matrix,Vector>(A, X, B)
70 
71  {
72  using Teuchos::Comm;
73 #ifdef HAVE_MPI
74  using Teuchos::MpiComm;
75 #endif
76  using Teuchos::ParameterList;
77  using Teuchos::parameterList;
78  using Teuchos::RCP;
79  using Teuchos::rcp;
80  using Teuchos::rcp_dynamic_cast;
81  typedef global_ordinal_type GO;
82 #ifdef HAVE_MPI
83  typedef Tpetra::Map<local_ordinal_type, GO, node_type> map_type;
84 #endif
85  RCP<const Comm<int> > comm = this->getComm ();
86 
87 #ifdef HAVE_MPI
88  RCP<const MpiComm<int> > mpiComm =
89  rcp_dynamic_cast<const MpiComm<int> > (comm);
90  TEUCHOS_TEST_FOR_EXCEPTION
91  (mpiComm.is_null (), std::logic_error, "Amesos2::STRUMPACK "
92  "constructor: The matrix's communicator is not an MpiComm!");
93  MPI_Comm rawMpiComm = (* (mpiComm->getRawMpiComm ())) ();
94 
95  sp_ = Teuchos::RCP<strumpack::StrumpackSparseSolverMPIDist<scalar_type,GO>>
96  (new strumpack::StrumpackSparseSolverMPIDist<scalar_type,GO>(rawMpiComm, this->control_.verbose_));
97 #else
98  sp_ = Teuchos::RCP<strumpack::StrumpackSparseSolver<scalar_type,GO>>
99  (new strumpack::StrumpackSparseSolver<scalar_type,GO>(this->control_.verbose_, this->root_));
100 
101 #endif
102 
103 /*
104  Do we need this?
105  (What parameters do we set here that are not already provided?)
106 */
107  RCP<ParameterList> default_params =
108  parameterList (* (this->getValidParameters ()));
109  this->setParameters (default_params);
110 
111 #ifdef HAVE_MPI
112  const size_t myNumRows = this->matrixA_->getLocalNumRows();
113  const GO indexBase = this->matrixA_->getRowMap ()->getIndexBase ();
114  strumpack_rowmap_ =
115  rcp (new map_type (this->globalNumRows_, myNumRows, indexBase, comm));
116 #endif
117  }
118 
119 
121 // DELETE //
123 
124  template <class Matrix, class Vector>
126  {
127  }
128 
129 
131 // PRE-ORDERING //
133  template<class Matrix, class Vector>
134  int
136  {
137 #ifdef HAVE_AMESOS2_TIMERS
138  Teuchos::TimeMonitor preOrderTime( this->timers_.preOrderTime_ );
139 #endif
140 
141  // nothing to do: reordering and symbolic factorization are done
142  // together in call to ->reorder
143 
144  return EXIT_SUCCESS;
145  }
146 
147 
148 
150 // SYMBOLIC-FACTORIZATION //
152 
153  template <class Matrix, class Vector>
154  int
156  {
157 #ifdef HAVE_AMESOS2_TIMERS
158  Teuchos::TimeMonitor symFactTime( this->timers_.symFactTime_ );
159 #endif
160 
161  strumpack::ReturnCode ret = sp_->reorder();
162  TEUCHOS_TEST_FOR_EXCEPTION( ret == strumpack::ReturnCode::MATRIX_NOT_SET,
163  std::runtime_error,
164  "STRUMPACK matrix reordering failed: "
165  "matrix was not set." );
166  TEUCHOS_TEST_FOR_EXCEPTION( ret == strumpack::ReturnCode::REORDERING_ERROR,
167  std::runtime_error,
168  "STRUMPACK matrix reordering failed." );
169 
170  return EXIT_SUCCESS;
171  }
172 
173 
175 // NUMERIC-FACTORIZATION //
177 
178  template <class Matrix, class Vector>
179  int
181  {
182 #ifdef HAVE_AMESOS2_TIMERS
183  Teuchos::TimeMonitor numFactTimer(this->timers_.numFactTime_);
184 #endif
185 
186  strumpack::ReturnCode ret = sp_->factor();
187  // Check output
188  TEUCHOS_TEST_FOR_EXCEPTION( ret != strumpack::ReturnCode::SUCCESS,
189  std::runtime_error,
190  "Error in STRUMPACK factorization." );
191 
192  return EXIT_SUCCESS;
193  }
194 
195 
197 // SOLVE //
199 
200  template <class Matrix, class Vector>
201  int
203  const Teuchos::Ptr<const MultiVecAdapter<Vector> > B) const
204  {
205 
206 #ifdef HAVE_MPI
207  // local_len_rhs is how many of the multivector rows belong to
208  // this processor
209  const size_t local_len_rhs = strumpack_rowmap_->getNodeNumElements();
210  const global_size_type nrhs = X->getGlobalNumVectors();
211 
212  // make sure our multivector storage is sized appropriately
213  bvals_.resize(nrhs * local_len_rhs);
214  xvals_.resize(nrhs * local_len_rhs);
215 
216  {
217 
218 #ifdef HAVE_AMESOS2_TIMERS
219  Teuchos::TimeMonitor convTimer(this->timers_.vecConvTime_);
220 #endif
221 
222  {
223 #ifdef HAVE_AMESOS2_TIMERS
224  Teuchos::TimeMonitor redistTimer(this->timers_.vecRedistTime_);
225 #endif
226  //get dristributed data from Trilinos
227  typedef Util::get_1d_copy_helper<MultiVecAdapter<Vector>,scalar_type> copy_helper;
228  copy_helper::do_get(B,
229  bvals_(),
230  local_len_rhs,
231  Teuchos::ptrInArg(*strumpack_rowmap_));
232  }
233  } // end block for conversion time
234 
235  {
236 #ifdef HAVE_AMESOS2_TIMERS
237  Teuchos::TimeMonitor solveTimer(this->timers_.solveTime_);
238 #endif
239  strumpack::DenseMatrixWrapper<scalar_type>
240  Bsp(local_len_rhs, nrhs, bvals_().getRawPtr(), local_len_rhs),
241  Xsp(local_len_rhs, nrhs, xvals_().getRawPtr(), local_len_rhs);
242  strumpack::ReturnCode ret =sp_->solve(Bsp, Xsp);
243 
244  TEUCHOS_TEST_FOR_EXCEPTION( ret != strumpack::ReturnCode::SUCCESS,
245  std::runtime_error,
246  "Error in STRUMPACK solve" );
247  } // end block for solve time
248 
249 
250  {
251 #ifdef HAVE_AMESOS2_TIMERS
252  Teuchos::TimeMonitor redistTimer(this->timers_.vecRedistTime_);
253 #endif
254 
255  //get dristributed data from STRUMPACK after solving
256  typedef Util::put_1d_data_helper<MultiVecAdapter<Vector>,scalar_type> put_helper;
257  put_helper::do_put(X,
258  xvals_(),
259  local_len_rhs,
260  Teuchos::ptrInArg(*strumpack_rowmap_));
261  }
262 #else //NO MPI
263  using Teuchos::as;
264  const global_size_type ld_rhs = this->root_ ? X->getGlobalLength() : 0;
265  const size_t nrhs = X->getGlobalNumVectors();
266  bvals_.resize(nrhs * ld_rhs);
267  xvals_.resize(nrhs * ld_rhs);
268 
269  {
270 #ifdef HAVE_AMESOS2_TIMERS
271  Teuchos::TimeMonitor solveTimer(this->timers_.solveTime_);
272 #endif
273 
274  strumpack::DenseMatrixWrapper<scalar_type>
275  Bsp(ld_rhs, nrhs, bvals_().getRawPtr(), ld_rhs),
276  Xsp(ld_rhs, nrhs, xvals_().getRawPtr(), ld_rhs);
277  strumpack::ReturnCode ret =sp_->solve(Bsp, Xsp);
278 
279  TEUCHOS_TEST_FOR_EXCEPTION( ret != strumpack::ReturnCode::SUCCESS,
280  std::runtime_error,
281  "Error in STRUMPACK solve" );
282  } // end block for solve time
283 
284  {
285 #ifdef HAVE_AMESOS2_TIMERS
286  Teuchos::TimeMonitor redistTimer(this->timers_.vecRedistTime_);
287 #endif
288 
290  MultiVecAdapter<Vector>,scalar_type>::do_put(X, xvals_(),
291  as<size_t>(ld_rhs),
292  ROOTED, this->rowIndexBase_);
293  }
294 #endif
295  return EXIT_SUCCESS;
296  }
297 
298 
299  template <class Matrix, class Vector>
300  bool
302  {
303 #ifdef HAVE_MPI
304  // STRUMPACK requires square matrices
305  return( this->globalNumRows_ == this->globalNumCols_ );
306 #else
307  return( this->matrixA_->getGlobalNumRows() == this->matrixA_->getGlobalNumCols() );
308 #endif
309  }
310 
311 
312 
314 // SET_PARAMETERS //
316 
317  template <class Matrix, class Vector>
318  void
319  STRUMPACK<Matrix,Vector>::setParameters_impl(const Teuchos::RCP<Teuchos::ParameterList> & parameterList )
320  {
321  using Teuchos::as;
322  using Teuchos::RCP;
323  using Teuchos::getIntegralValue;
324  using Teuchos::ParameterEntryValidator;
325 
326  RCP<const Teuchos::ParameterList> valid_params = getValidParameters_impl();
327 
328  if( parameterList->isParameter("Matching") ){
329  RCP<const ParameterEntryValidator> matching_validator = valid_params->getEntry("Matching").validator();
330  parameterList->getEntry("Matching").setValidator(matching_validator);
331 
332  sp_->options().set_matching(getIntegralValue<strumpack::MatchingJob>(*parameterList, "Matching"));
333  }
334 
335  if( parameterList->isParameter("Ordering") ){
336  RCP<const ParameterEntryValidator> reordering_validator = valid_params->getEntry("Ordering").validator();
337  parameterList->getEntry("Ordering").setValidator(reordering_validator);
338 
339  sp_->options().set_reordering_method(getIntegralValue<strumpack::ReorderingStrategy>(*parameterList, "Ordering"));
340  }
341 
342  if( parameterList->isParameter("ReplaceTinyPivot") ){
343  RCP<const ParameterEntryValidator> replacepivot_validator = valid_params->getEntry("ReplaceTinyPivot").validator();
344  parameterList->getEntry("ReplaceTinyPivot").setValidator(replacepivot_validator);
345 
346  if( replacepivot_validator) {
347  sp_->options().enable_replace_tiny_pivots();
348  }
349  else{
350  sp_->options().disable_replace_tiny_pivots();
351  }
352  }
353 
354  if( parameterList->isParameter("IterRefine") ){
355  RCP<const ParameterEntryValidator> iter_refine_validator = valid_params->getEntry("IterRefine").validator();
356  parameterList->getEntry("IterRefine").setValidator(iter_refine_validator);
357 
358  sp_->options().set_Krylov_solver(getIntegralValue<strumpack::KrylovSolver>(*parameterList, "IterRefine"));
359  }
360 
361  if( parameterList->isParameter("Compression") ){
362  RCP<const ParameterEntryValidator> compression_validator = valid_params->getEntry("Compression").validator();
363  parameterList->getEntry("Compression").setValidator(compression_validator);
364 
365  sp_->options().set_compression(getIntegralValue<strumpack::CompressionType>(*parameterList, "Compression"));
366  }
367 
368  TEUCHOS_TEST_FOR_EXCEPTION( this->control_.useTranspose_,
369  std::invalid_argument,
370  "STRUMPACK does not support solving the tranpose system" );
371 
372  }
373 
374  template <class Matrix, class Vector>
375  Teuchos::RCP<const Teuchos::ParameterList>
377  {
378  using std::string;
379  using Teuchos::tuple;
380  using Teuchos::ParameterList;
381  using Teuchos::EnhancedNumberValidator;
382  using Teuchos::setStringToIntegralParameter;
383  using Teuchos::stringToIntegralParameterEntryValidator;
384 
385  static Teuchos::RCP<const Teuchos::ParameterList> valid_params;
386 
387  if( is_null(valid_params) ){
388  Teuchos::RCP<Teuchos::ParameterList> pl = Teuchos::parameterList();
389 
390  setStringToIntegralParameter<strumpack::MatchingJob>("Matching", "NONE",
391  "Specifies how to permute the "
392  "matrix for numerical stability",
393  tuple<string>("NONE", "MAX_CARDINALITY", "MAX_SMALLEST_DIAGONAL", "MAX_SMALLEST_DIAGONAL_2", "MAX_DIAGONAL_SUM", "MAX_DIAGONAL_PRODUCT_SCALING", "COMBBLAS"),
394  tuple<string>("NONE", "MAX_CARDINALITY", "MAX_SMALLEST_DIAGONAL", "MAX_SMALLEST_DIAGONAL_2", "MAX_DIAGONAL_SUM", "MAX_DIAGONAL_PRODUCT_SCALING", "COMBBLAS"),
395  tuple<strumpack::MatchingJob>(strumpack::MatchingJob::NONE,
396  strumpack::MatchingJob::MAX_CARDINALITY,
397  strumpack::MatchingJob::MAX_SMALLEST_DIAGONAL,
398  strumpack::MatchingJob::MAX_SMALLEST_DIAGONAL_2,
399  strumpack::MatchingJob::MAX_DIAGONAL_SUM,
400  strumpack::MatchingJob::MAX_DIAGONAL_PRODUCT_SCALING,
401  strumpack::MatchingJob::COMBBLAS),
402  pl.getRawPtr());
403 
404 #if defined(STRUMPACK_USE_PARMETIS)
405  std::string default_ordering("PARMETIS");
406 #else
407  std::string default_ordering("METIS");
408 #endif
409  setStringToIntegralParameter<strumpack::ReorderingStrategy>("Ordering", default_ordering,
410  "Specifies how to permute the "
411  "matrix for sparsity preservation",
412  tuple<string>("NATURAL", "PARMETIS", "METIS", "SCOTCH", "GEOMETRIC", "PTSCOTCH", "RCM"),
413  tuple<string>("Natural ordering",
414  "ParMETIS ordering",
415  "Metis ordering",
416  "Scotch ordering",
417  "Geometric ordering",
418  "PTScotch ordering",
419  "RCM"),
420  tuple<strumpack::ReorderingStrategy>(strumpack::ReorderingStrategy::NATURAL,
421  strumpack::ReorderingStrategy::PARMETIS,
422  strumpack::ReorderingStrategy::METIS,
423  strumpack::ReorderingStrategy::SCOTCH,
424  strumpack::ReorderingStrategy::GEOMETRIC,
425  strumpack::ReorderingStrategy::PTSCOTCH,
426  strumpack::ReorderingStrategy::RCM),
427  pl.getRawPtr());
428 
429  pl->set("ReplaceTinyPivot", true, "Specifies whether to replace tiny diagonals during LU factorization");
430 
431 
432 // There are multiple options available for an iterative refinement,
433 // however we recommend the use of "DIRECT" within the Amesos2 interface
434  setStringToIntegralParameter<strumpack::KrylovSolver>("IterRefine", "DIRECT",
435  "Type of iterative refinement to use",
436  tuple<string>("AUTO", "DIRECT", "REFINE", "PREC_GMRES", "GMRES", "PREC_BICGSTAB", "BICGSTAB"),
437  tuple<string>("Use iterative refinement if no compression is used, otherwise use GMRes.",
438  "Single application of the multifrontal solver.",
439  "Iterative refinement.",
440  "Preconditioned GMRes.",
441  "UN-preconditioned GMRes.",
442  "Preconditioned BiCGStab.",
443  "UN-preconditioned BiCGStab."),
444  tuple<strumpack::KrylovSolver>(strumpack::KrylovSolver::AUTO,
445  strumpack::KrylovSolver::DIRECT,
446  strumpack::KrylovSolver::REFINE,
447  strumpack::KrylovSolver::PREC_GMRES,
448  strumpack::KrylovSolver::GMRES,
449  strumpack::KrylovSolver::PREC_BICGSTAB,
450  strumpack::KrylovSolver::BICGSTAB),
451  pl.getRawPtr());
452 
453 // There are multiple options available for the compression of the matrix,
454 // we recommend the use of "NONE" within the Amesos2 interface
455  setStringToIntegralParameter<strumpack::CompressionType>("Compression", "NONE",
456  "Type of compression to use",
457  tuple<string>("NONE", "HSS", "BLR", "HODLR", "LOSSLESS", "LOSSY"),
458  tuple<string>("No compression, purely direct solver.",
459  "HSS compression of frontal matrices.",
460  "Block low-rank compression of fronts.",
461  "Hierarchically Off-diagonal Low-Rank compression of frontal matrices.",
462  "Lossless compresssion.",
463  "Lossy compresssion."),
464  tuple<strumpack::CompressionType>(strumpack::CompressionType::NONE,
465  strumpack::CompressionType::HSS,
466  strumpack::CompressionType::BLR,
467  strumpack::CompressionType::HODLR,
468  strumpack::CompressionType::LOSSLESS,
469  strumpack::CompressionType::LOSSY),
470  pl.getRawPtr());
471 
472 
473 
474 
475  valid_params = pl;
476  }
477 
478  return valid_params;
479  }
480 
481 
482 
484 // LOAD_DATA //
486 
487  template <class Matrix, class Vector>
488  bool
490  using Teuchos::Array;
491  using Teuchos::ArrayView;
492  using Teuchos::ptrInArg;
493  using Teuchos::as;
494  using Teuchos::rcp_dynamic_cast; // Do I need this?
495 
496  using Teuchos::Comm;
497 #ifdef HAVE_MPI
498  using Teuchos::MpiComm;
499 
500  #ifdef HAVE_AMESOS2_TIMERS
501  Teuchos::TimeMonitor convTimer(this->timers_.mtxConvTime_);
502  #endif
503 
504  Teuchos::RCP<const MatrixAdapter<Matrix> > redist_mat
505  = this->matrixA_->get(ptrInArg(*strumpack_rowmap_));
506 
507  typedef global_ordinal_type GO;
508  GO l_nnz, l_rows;
509  l_nnz = as<GO>(redist_mat->getLocalNNZ());
510  l_rows = as<GO>(redist_mat->getLocalNumRows());
511 
512  RCP<const Comm<int> > comm = this->getComm ();
513  RCP<const MpiComm<int> > mpiComm =
514  rcp_dynamic_cast<const MpiComm<int> > (comm);
515 
516  const int numProcs = comm->getSize ();
517  const int myRank = comm->getRank ();
518  Array<GO> dist(numProcs+1);
519  dist[0] = 0;
520  dist[myRank+1] = as<GO>(strumpack_rowmap_->getMaxGlobalIndex()) + 1;
521 
522  MPI_Allgather(MPI_IN_PLACE, 0, MPI_DATATYPE_NULL, dist.data()+1, sizeof(GO), MPI_BYTE,
523  mpiComm->getRawMpiComm()->operator()());
524  nzvals_.resize(l_nnz);
525  colind_.resize(l_nnz);
526  rowptr_.resize(l_rows + 1);
527 
528 
529  GO nnz_ret = 0;
530  {
531 #ifdef HAVE_AMESOS2_TIMERS
532  Teuchos::TimeMonitor mtxRedistTimer( this->timers_.mtxRedistTime_ );
533 #endif
534 
535  Util::get_crs_helper<
537  scalar_type, GO, GO >::do_get(redist_mat.ptr(),
538  nzvals_(), colind_(), rowptr_(),
539  nnz_ret,
540  ptrInArg(*strumpack_rowmap_),
541  ROOTED,
542  ARBITRARY);
543  }
544 
545 
546  TEUCHOS_TEST_FOR_EXCEPTION( nnz_ret != l_nnz,
547  std::runtime_error,
548  "Did not get the expected number of non-zero vals");
549 
550  // Get the csr data type for this type of matrix
551  sp_->set_distributed_csr_matrix
552  (l_rows, rowptr_.getRawPtr(), colind_.getRawPtr(),
553  nzvals_.getRawPtr(), dist.getRawPtr(), false);
554 #else
555 #ifdef HAVE_AMESOS2_TIMERS
556  Teuchos::TimeMonitor convTimer(this->timers_.mtxConvTime_);
557 #endif
558 
559  typedef global_ordinal_type GO;
560  GO nnz_ret = 0;
561 
562  if( this->root_ ){
563  nzvals_.resize(this->globalNumNonZeros_);
564  colind_.resize(this->globalNumNonZeros_);
565  rowptr_.resize(this->globalNumRows_ + 1);
566  }
567  {
568 #ifdef HAVE_AMESOS2_TIMERS
569  Teuchos::TimeMonitor mtxRedistTimer( this->timers_.mtxRedistTime_ );
570 #endif
571 
572  Util::get_crs_helper<
574  scalar_type, GO, GO >::do_get(this->matrixA_.ptr(),
575  nzvals_(), colind_(), rowptr_(),
576  nnz_ret,
577  ROOTED,
578  ARBITRARY, this->rowIndexBase_);
579  }
580 
581  TEUCHOS_TEST_FOR_EXCEPTION( nnz_ret != this->globalNumNonZeros_,
582  std::runtime_error,
583  "Did not get the expected number of non-zero vals");
584 
585  // Get the csr data type for this type of matrix
586  sp_->set_csr_matrix(this->globalNumRows_, rowptr_.getRawPtr(), colind_.getRawPtr(),
587  nzvals_.getRawPtr(), false);
588 
589 #endif
590  return true;
591  }
592 
593 
594  template<class Matrix, class Vector>
595  const char* STRUMPACK<Matrix,Vector>::name = "STRUMPACK";
596 
597 
598 } // end namespace Amesos2
599 #endif // AMESOS2_STRUMPACK_DEF_HPP
Amesos2::SolverCore: A templated interface for interaction with third-party direct sparse solvers...
Definition: Amesos2_SolverCore_decl.hpp:105
STRUMPACK(Teuchos::RCP< const Matrix > A, Teuchos::RCP< Vector > X, Teuchos::RCP< const Vector > B)
Initialize from Teuchos::RCP.
Definition: Amesos2_STRUMPACK_def.hpp:66
int preOrdering_impl()
Performs pre-ordering on the matrix to increase efficiency.
Definition: Amesos2_STRUMPACK_def.hpp:135
EPhase
Used to indicate a phase in the direct solution.
Definition: Amesos2_TypeDecl.hpp:65
int solve_impl(const Teuchos::Ptr< MultiVecAdapter< Vector > > X, const Teuchos::Ptr< const MultiVecAdapter< Vector > > B) const
STRUMPACK specific solve.
Definition: Amesos2_STRUMPACK_def.hpp:202
void setParameters_impl(const Teuchos::RCP< Teuchos::ParameterList > &parameterList)
Definition: Amesos2_STRUMPACK_def.hpp:319
bool root_
If true, then this is the root processor.
Definition: Amesos2_SolverCore_decl.hpp:506
global_size_type globalNumRows_
Number of global rows in matrixA_.
Definition: Amesos2_SolverCore_decl.hpp:475
Helper class for getting 1-D copies of multivectors.
Definition: Amesos2_MultiVecAdapter_decl.hpp:266
int symbolicFactorization_impl()
Perform symbolic factorization of the matrix using STRUMPACK.
Definition: Amesos2_STRUMPACK_def.hpp:155
Definition: Amesos2_TypeDecl.hpp:143
Utility functions for Amesos2.
Control control_
Parameters for solving.
Definition: Amesos2_SolverCore_decl.hpp:494
Teuchos::RCP< const Teuchos::ParameterList > getValidParameters() const
Return a const parameter list of all of the valid parameters that this->setParameterList(...) will accept.
Definition: Amesos2_SolverCore_def.hpp:314
Teuchos::RCP< const Teuchos::Comm< int > > getComm() const
Returns a pointer to the Teuchos::Comm communicator with this operator.
Definition: Amesos2_SolverCore_decl.hpp:362
Teuchos::RCP< const Teuchos::ParameterList > getValidParameters_impl() const
Definition: Amesos2_STRUMPACK_def.hpp:376
Definition: Amesos2_AbstractConcreteMatrixAdapter.hpp:48
A Matrix adapter interface for Amesos2.
Definition: Amesos2_MatrixAdapter_decl.hpp:76
bool loadA_impl(EPhase current_phase)
Reads matrix data into internal solver structures.
Definition: Amesos2_STRUMPACK_def.hpp:489
Amesos2 interface to STRUMPACK direct solver and preconditioner.
Definition: Amesos2_STRUMPACK_decl.hpp:71
~STRUMPACK()
Destructor.
Definition: Amesos2_STRUMPACK_def.hpp:125
super_type & setParameters(const Teuchos::RCP< Teuchos::ParameterList > &parameterList)
Set/update internal variables and solver options.
Definition: Amesos2_SolverCore_def.hpp:282
Definition: Amesos2_TypeDecl.hpp:127
bool matrixShapeOK_impl() const
Determines whether the shape of the matrix is OK for this solver.
Definition: Amesos2_STRUMPACK_def.hpp:301
Helper class for putting 1-D data arrays into multivectors.
Definition: Amesos2_MultiVecAdapter_decl.hpp:372
A templated MultiVector class adapter for Amesos2.
Definition: Amesos2_MultiVecAdapter_decl.hpp:176
Teuchos::RCP< const MatrixAdapter< Matrix > > matrixA_
The LHS operator.
Definition: Amesos2_SolverCore_decl.hpp:454
int numericFactorization_impl()
STRUMPACK specific numeric factorization.
Definition: Amesos2_STRUMPACK_def.hpp:180