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  (new strumpack::StrumpackSparseSolverMPIDist<scalar_type,GO>(rawMpiComm, true));
98 #else
99  sp_ = Teuchos::RCP<strumpack::StrumpackSparseSolver<scalar_type,GO>>
100  (new strumpack::StrumpackSparseSolver<scalar_type,GO>(this->control_.verbose_, this->root_));
101 
102 #endif
103 
104 /*
105  Do we need this?
106  (What parameters do we set here that are not already provided?)
107 */
108  RCP<ParameterList> default_params =
109  parameterList (* (this->getValidParameters ()));
110  this->setParameters (default_params);
111 
112 #ifdef HAVE_MPI
113  const size_t myNumRows = this->matrixA_->getLocalNumRows();
114  const GO indexBase = this->matrixA_->getRowMap ()->getIndexBase ();
115  strumpack_rowmap_ =
116  rcp (new map_type (this->globalNumRows_, myNumRows, indexBase, comm));
117 #endif
118  }
119 
120 
122 // DELETE //
124 
125  template <class Matrix, class Vector>
127  {
128  }
129 
130 
132 // PRE-ORDERING //
134  template<class Matrix, class Vector>
135  int
137  {
138 #ifdef HAVE_AMESOS2_TIMERS
139  Teuchos::TimeMonitor preOrderTime( this->timers_.preOrderTime_ );
140 #endif
141 
142  // nothing to do: reordering and symbolic factorization are done
143  // together in call to ->reorder
144 
145  return EXIT_SUCCESS;
146  }
147 
148 
149 
151 // SYMBOLIC-FACTORIZATION //
153 
154  template <class Matrix, class Vector>
155  int
157  {
158 #ifdef HAVE_AMESOS2_TIMERS
159  Teuchos::TimeMonitor symFactTime( this->timers_.symFactTime_ );
160 #endif
161 
162  strumpack::ReturnCode ret = sp_->reorder();
163  TEUCHOS_TEST_FOR_EXCEPTION( ret == strumpack::ReturnCode::MATRIX_NOT_SET,
164  std::runtime_error,
165  "STRUMPACK matrix reordering failed: "
166  "matrix was not set." );
167  TEUCHOS_TEST_FOR_EXCEPTION( ret == strumpack::ReturnCode::REORDERING_ERROR,
168  std::runtime_error,
169  "STRUMPACK matrix reordering failed." );
170 
171  return EXIT_SUCCESS;
172  }
173 
174 
176 // NUMERIC-FACTORIZATION //
178 
179  template <class Matrix, class Vector>
180  int
182  {
183 #ifdef HAVE_AMESOS2_TIMERS
184  Teuchos::TimeMonitor numFactTimer(this->timers_.numFactTime_);
185 #endif
186 
187  strumpack::ReturnCode ret = sp_->factor();
188  // Check output
189  TEUCHOS_TEST_FOR_EXCEPTION( ret != strumpack::ReturnCode::SUCCESS,
190  std::runtime_error,
191  "Error in STRUMPACK factorization." );
192 
193  return EXIT_SUCCESS;
194  }
195 
196 
198 // SOLVE //
200 
201  template <class Matrix, class Vector>
202  int
204  const Teuchos::Ptr<const MultiVecAdapter<Vector> > B) const
205  {
206 
207 #ifdef HAVE_MPI
208  // local_len_rhs is how many of the multivector rows belong to
209  // this processor
210  const size_t local_len_rhs = strumpack_rowmap_->getLocalNumElements();
211  const global_size_type nrhs = X->getGlobalNumVectors();
212 
213  // make sure our multivector storage is sized appropriately
214  bvals_.resize(nrhs * local_len_rhs);
215  xvals_.resize(nrhs * local_len_rhs);
216 
217  {
218 
219 #ifdef HAVE_AMESOS2_TIMERS
220  Teuchos::TimeMonitor convTimer(this->timers_.vecConvTime_);
221 #endif
222 
223  {
224 #ifdef HAVE_AMESOS2_TIMERS
225  Teuchos::TimeMonitor redistTimer(this->timers_.vecRedistTime_);
226 #endif
227  //get dristributed data from Trilinos
228  typedef Util::get_1d_copy_helper<MultiVecAdapter<Vector>,scalar_type> copy_helper;
229  copy_helper::do_get(B,
230  bvals_(),
231  local_len_rhs,
232  Teuchos::ptrInArg(*strumpack_rowmap_));
233  }
234  } // end block for conversion time
235 
236  {
237 #ifdef HAVE_AMESOS2_TIMERS
238  Teuchos::TimeMonitor solveTimer(this->timers_.solveTime_);
239 #endif
240  strumpack::DenseMatrixWrapper<scalar_type>
241  Bsp(local_len_rhs, nrhs, bvals_().getRawPtr(), local_len_rhs),
242  Xsp(local_len_rhs, nrhs, xvals_().getRawPtr(), local_len_rhs);
243  strumpack::ReturnCode ret =sp_->solve(Bsp, Xsp);
244 
245  TEUCHOS_TEST_FOR_EXCEPTION( ret != strumpack::ReturnCode::SUCCESS,
246  std::runtime_error,
247  "Error in STRUMPACK solve" );
248  } // end block for solve time
249 
250 
251  {
252 #ifdef HAVE_AMESOS2_TIMERS
253  Teuchos::TimeMonitor redistTimer(this->timers_.vecRedistTime_);
254 #endif
255 
256  //get dristributed data from STRUMPACK after solving
257  typedef Util::put_1d_data_helper<MultiVecAdapter<Vector>,scalar_type> put_helper;
258  put_helper::do_put(X,
259  xvals_(),
260  local_len_rhs,
261  Teuchos::ptrInArg(*strumpack_rowmap_));
262  }
263 #else //NO MPI
264  using Teuchos::as;
265  const global_size_type ld_rhs = this->root_ ? X->getGlobalLength() : 0;
266  const size_t nrhs = X->getGlobalNumVectors();
267  bvals_.resize(nrhs * ld_rhs);
268  xvals_.resize(nrhs * ld_rhs);
269 
270  {
271 #ifdef HAVE_AMESOS2_TIMERS
272  Teuchos::TimeMonitor solveTimer(this->timers_.solveTime_);
273 #endif
274 
275  strumpack::DenseMatrixWrapper<scalar_type>
276  Bsp(ld_rhs, nrhs, bvals_().getRawPtr(), ld_rhs),
277  Xsp(ld_rhs, nrhs, xvals_().getRawPtr(), ld_rhs);
278  strumpack::ReturnCode ret =sp_->solve(Bsp, Xsp);
279 
280  TEUCHOS_TEST_FOR_EXCEPTION( ret != strumpack::ReturnCode::SUCCESS,
281  std::runtime_error,
282  "Error in STRUMPACK solve" );
283  } // end block for solve time
284 
285  {
286 #ifdef HAVE_AMESOS2_TIMERS
287  Teuchos::TimeMonitor redistTimer(this->timers_.vecRedistTime_);
288 #endif
289 
291  MultiVecAdapter<Vector>,scalar_type>::do_put(X, xvals_(),
292  as<size_t>(ld_rhs),
293  ROOTED, this->rowIndexBase_);
294  }
295 #endif
296  return EXIT_SUCCESS;
297  }
298 
299 
300  template <class Matrix, class Vector>
301  bool
303  {
304 #ifdef HAVE_MPI
305  // STRUMPACK requires square matrices
306  return( this->globalNumRows_ == this->globalNumCols_ );
307 #else
308  return( this->matrixA_->getGlobalNumRows() == this->matrixA_->getGlobalNumCols() );
309 #endif
310  }
311 
312 
313 
315 // SET_PARAMETERS //
317 
318  template <class Matrix, class Vector>
319  void
320  STRUMPACK<Matrix,Vector>::setParameters_impl(const Teuchos::RCP<Teuchos::ParameterList> & parameterList )
321  {
322  using Teuchos::as;
323  using Teuchos::RCP;
324  using Teuchos::getIntegralValue;
325  using Teuchos::ParameterEntryValidator;
326 
327  RCP<const Teuchos::ParameterList> valid_params = getValidParameters_impl();
328 
329  if( parameterList->isParameter("Matching") ){
330  RCP<const ParameterEntryValidator> matching_validator = valid_params->getEntry("Matching").validator();
331  parameterList->getEntry("Matching").setValidator(matching_validator);
332 
333  sp_->options().set_matching(getIntegralValue<strumpack::MatchingJob>(*parameterList, "Matching"));
334  }
335 
336  if( parameterList->isParameter("Ordering") ){
337  RCP<const ParameterEntryValidator> reordering_validator = valid_params->getEntry("Ordering").validator();
338  parameterList->getEntry("Ordering").setValidator(reordering_validator);
339 
340  sp_->options().set_reordering_method(getIntegralValue<strumpack::ReorderingStrategy>(*parameterList, "Ordering"));
341  }
342 
343  if( parameterList->isParameter("ReplaceTinyPivot") ){
344  RCP<const ParameterEntryValidator> replacepivot_validator = valid_params->getEntry("ReplaceTinyPivot").validator();
345  parameterList->getEntry("ReplaceTinyPivot").setValidator(replacepivot_validator);
346 
347  if( replacepivot_validator) {
348  sp_->options().enable_replace_tiny_pivots();
349  }
350  else{
351  sp_->options().disable_replace_tiny_pivots();
352  }
353  }
354 
355  if( parameterList->isParameter("IterRefine") ){
356  RCP<const ParameterEntryValidator> iter_refine_validator = valid_params->getEntry("IterRefine").validator();
357  parameterList->getEntry("IterRefine").setValidator(iter_refine_validator);
358 
359  sp_->options().set_Krylov_solver(getIntegralValue<strumpack::KrylovSolver>(*parameterList, "IterRefine"));
360  }
361 
362  if( parameterList->isParameter("Compression") ){
363  RCP<const ParameterEntryValidator> compression_validator = valid_params->getEntry("Compression").validator();
364  parameterList->getEntry("Compression").setValidator(compression_validator);
365 
366  sp_->options().set_compression(getIntegralValue<strumpack::CompressionType>(*parameterList, "Compression"));
367  }
368 
369  TEUCHOS_TEST_FOR_EXCEPTION( this->control_.useTranspose_,
370  std::invalid_argument,
371  "STRUMPACK does not support solving the tranpose system" );
372 
373  }
374 
375  template <class Matrix, class Vector>
376  Teuchos::RCP<const Teuchos::ParameterList>
378  {
379  using std::string;
380  using Teuchos::tuple;
381  using Teuchos::ParameterList;
382  using Teuchos::EnhancedNumberValidator;
383  using Teuchos::setStringToIntegralParameter;
384  using Teuchos::stringToIntegralParameterEntryValidator;
385 
386  static Teuchos::RCP<const Teuchos::ParameterList> valid_params;
387 
388  if( is_null(valid_params) ){
389  Teuchos::RCP<Teuchos::ParameterList> pl = Teuchos::parameterList();
390 
391  setStringToIntegralParameter<strumpack::MatchingJob>("Matching", "NONE",
392  "Specifies how to permute the "
393  "matrix for numerical stability",
394  tuple<string>("NONE", "MAX_CARDINALITY", "MAX_SMALLEST_DIAGONAL", "MAX_SMALLEST_DIAGONAL_2", "MAX_DIAGONAL_SUM", "MAX_DIAGONAL_PRODUCT_SCALING", "COMBBLAS"),
395  tuple<string>("NONE", "MAX_CARDINALITY", "MAX_SMALLEST_DIAGONAL", "MAX_SMALLEST_DIAGONAL_2", "MAX_DIAGONAL_SUM", "MAX_DIAGONAL_PRODUCT_SCALING", "COMBBLAS"),
396  tuple<strumpack::MatchingJob>(strumpack::MatchingJob::NONE,
397  strumpack::MatchingJob::MAX_CARDINALITY,
398  strumpack::MatchingJob::MAX_SMALLEST_DIAGONAL,
399  strumpack::MatchingJob::MAX_SMALLEST_DIAGONAL_2,
400  strumpack::MatchingJob::MAX_DIAGONAL_SUM,
401  strumpack::MatchingJob::MAX_DIAGONAL_PRODUCT_SCALING,
402  strumpack::MatchingJob::COMBBLAS),
403  pl.getRawPtr());
404 
405 #if defined(STRUMPACK_USE_PARMETIS)
406  std::string default_ordering("PARMETIS");
407 #else
408  std::string default_ordering("METIS");
409 #endif
410  setStringToIntegralParameter<strumpack::ReorderingStrategy>("Ordering", default_ordering,
411  "Specifies how to permute the "
412  "matrix for sparsity preservation",
413  tuple<string>("NATURAL", "PARMETIS", "METIS", "SCOTCH", "GEOMETRIC", "PTSCOTCH", "RCM"),
414  tuple<string>("Natural ordering",
415  "ParMETIS ordering",
416  "Metis ordering",
417  "Scotch ordering",
418  "Geometric ordering",
419  "PTScotch ordering",
420  "RCM"),
421  tuple<strumpack::ReorderingStrategy>(strumpack::ReorderingStrategy::NATURAL,
422  strumpack::ReorderingStrategy::PARMETIS,
423  strumpack::ReorderingStrategy::METIS,
424  strumpack::ReorderingStrategy::SCOTCH,
425  strumpack::ReorderingStrategy::GEOMETRIC,
426  strumpack::ReorderingStrategy::PTSCOTCH,
427  strumpack::ReorderingStrategy::RCM),
428  pl.getRawPtr());
429 
430  pl->set("ReplaceTinyPivot", true, "Specifies whether to replace tiny diagonals during LU factorization");
431 
432 
433 // There are multiple options available for an iterative refinement,
434 // however we recommend the use of "DIRECT" within the Amesos2 interface
435  setStringToIntegralParameter<strumpack::KrylovSolver>("IterRefine", "DIRECT",
436  "Type of iterative refinement to use",
437  tuple<string>("AUTO", "DIRECT", "REFINE", "PREC_GMRES", "GMRES", "PREC_BICGSTAB", "BICGSTAB"),
438  tuple<string>("Use iterative refinement if no compression is used, otherwise use GMRes.",
439  "Single application of the multifrontal solver.",
440  "Iterative refinement.",
441  "Preconditioned GMRes.",
442  "UN-preconditioned GMRes.",
443  "Preconditioned BiCGStab.",
444  "UN-preconditioned BiCGStab."),
445  tuple<strumpack::KrylovSolver>(strumpack::KrylovSolver::AUTO,
446  strumpack::KrylovSolver::DIRECT,
447  strumpack::KrylovSolver::REFINE,
448  strumpack::KrylovSolver::PREC_GMRES,
449  strumpack::KrylovSolver::GMRES,
450  strumpack::KrylovSolver::PREC_BICGSTAB,
451  strumpack::KrylovSolver::BICGSTAB),
452  pl.getRawPtr());
453 
454 // There are multiple options available for the compression of the matrix,
455 // we recommend the use of "NONE" within the Amesos2 interface
456  setStringToIntegralParameter<strumpack::CompressionType>("Compression", "NONE",
457  "Type of compression to use",
458  tuple<string>("NONE", "HSS", "BLR", "HODLR", "LOSSLESS", "LOSSY"),
459  tuple<string>("No compression, purely direct solver.",
460  "HSS compression of frontal matrices.",
461  "Block low-rank compression of fronts.",
462  "Hierarchically Off-diagonal Low-Rank compression of frontal matrices.",
463  "Lossless compresssion.",
464  "Lossy compresssion."),
465  tuple<strumpack::CompressionType>(strumpack::CompressionType::NONE,
466  strumpack::CompressionType::HSS,
467  strumpack::CompressionType::BLR,
468  strumpack::CompressionType::HODLR,
469  strumpack::CompressionType::LOSSLESS,
470  strumpack::CompressionType::LOSSY),
471  pl.getRawPtr());
472 
473 
474 
475 
476  valid_params = pl;
477  }
478 
479  return valid_params;
480  }
481 
482 
483 
485 // LOAD_DATA //
487 
488  template <class Matrix, class Vector>
489  bool
491  using Teuchos::Array;
492  using Teuchos::ArrayView;
493  using Teuchos::ptrInArg;
494  using Teuchos::as;
495  using Teuchos::rcp_dynamic_cast; // Do I need this?
496 
497  using Teuchos::Comm;
498 #ifdef HAVE_MPI
499  using Teuchos::MpiComm;
500 
501  #ifdef HAVE_AMESOS2_TIMERS
502  Teuchos::TimeMonitor convTimer(this->timers_.mtxConvTime_);
503  #endif
504 
505  Teuchos::RCP<const MatrixAdapter<Matrix> > redist_mat
506  = this->matrixA_->get(ptrInArg(*strumpack_rowmap_));
507 
508  typedef global_ordinal_type GO;
509  GO l_nnz, l_rows;
510  l_nnz = as<GO>(redist_mat->getLocalNNZ());
511  l_rows = as<GO>(redist_mat->getLocalNumRows());
512 
513  RCP<const Comm<int> > comm = this->getComm ();
514  RCP<const MpiComm<int> > mpiComm =
515  rcp_dynamic_cast<const MpiComm<int> > (comm);
516 
517  const int numProcs = comm->getSize ();
518  const int myRank = comm->getRank ();
519  Array<GO> dist(numProcs+1);
520  dist[0] = 0;
521  dist[myRank+1] = as<GO>(strumpack_rowmap_->getMaxGlobalIndex()) + 1;
522 
523  MPI_Allgather(MPI_IN_PLACE, 0, MPI_DATATYPE_NULL, dist.data()+1, sizeof(GO), MPI_BYTE,
524  mpiComm->getRawMpiComm()->operator()());
525  Kokkos::resize(nzvals_view_, l_nnz);
526  Kokkos::resize(colind_view_, l_nnz);
527  Kokkos::resize(rowptr_view_, l_rows + 1);
528 
529 
530  GO nnz_ret = 0;
531  {
532 #ifdef HAVE_AMESOS2_TIMERS
533  Teuchos::TimeMonitor mtxRedistTimer( this->timers_.mtxRedistTime_ );
534 #endif
535 
537  host_value_type_array, host_ordinal_type_array, host_ordinal_type_array >::do_get(
538  redist_mat.ptr(),
539  nzvals_view_, colind_view_, rowptr_view_,
540  nnz_ret,
541  ptrInArg(*strumpack_rowmap_),
542  ROOTED,
543  ARBITRARY);
544  }
545 
546 
547  TEUCHOS_TEST_FOR_EXCEPTION( nnz_ret != l_nnz,
548  std::runtime_error,
549  "Did not get the expected number of non-zero vals");
550 
551  // Get the csr data type for this type of matrix
552  sp_->set_distributed_csr_matrix
553  (l_rows, rowptr_view_.data(), colind_view_.data(),
554  nzvals_view_.data(), dist.getRawPtr(), false);
555 
556 #else
557 #ifdef HAVE_AMESOS2_TIMERS
558  Teuchos::TimeMonitor convTimer(this->timers_.mtxConvTime_);
559 #endif
560 
561  typedef global_ordinal_type GO;
562  GO nnz_ret = 0;
563 
564  if( this->root_ ){
565  Kokkos::resize(nzvals_view_, this->globalNumNonZeros_);
566  Kokkos::resize(colind_view_, this->globalNumNonZeros_);
567  Kokkos::resize(rowptr_view_, this->globalNumRows_ + 1);
568  }
569  {
570 #ifdef HAVE_AMESOS2_TIMERS
571  Teuchos::TimeMonitor mtxRedistTimer( this->timers_.mtxRedistTime_ );
572 #endif
573 
575  host_value_type_array, host_ordinal_type_array, host_ordinal_type_array >::do_get(
576  this->matrixA_.ptr(),
577  nzvals_view_, colind_view_, rowptr_view_,
578  nnz_ret,
579  ROOTED,
580  ARBITRARY, this->rowIndexBase_);
581  }
582 
583  TEUCHOS_TEST_FOR_EXCEPTION( nnz_ret != this->globalNumNonZeros_,
584  std::runtime_error,
585  "Did not get the expected number of non-zero vals");
586 
587  // Get the csr data type for this type of matrix
588  sp_->set_csr_matrix(this->globalNumRows_, rowptr_view_.data(), colind_view_.data(),
589  nzvals_view_.data(), false);
590 
591 #endif
592  return true;
593  }
594 
595 
596  template<class Matrix, class Vector>
597  const char* STRUMPACK<Matrix,Vector>::name = "STRUMPACK";
598 
599 
600 } // end namespace Amesos2
601 #endif // AMESOS2_STRUMPACK_DEF_HPP
Teuchos::RCP< const Teuchos::ParameterList > getValidParameters() const override
Return a const parameter list of all of the valid parameters that this-&gt;setParameterList(...) will accept.
Definition: Amesos2_SolverCore_def.hpp:558
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:136
EPhase
Used to indicate a phase in the direct solution.
Definition: Amesos2_TypeDecl.hpp:65
super_type & setParameters(const Teuchos::RCP< Teuchos::ParameterList > &parameterList) override
Set/update internal variables and solver options.
Definition: Amesos2_SolverCore_def.hpp:526
void setParameters_impl(const Teuchos::RCP< Teuchos::ParameterList > &parameterList)
Definition: Amesos2_STRUMPACK_def.hpp:320
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:476
Helper class for getting 1-D copies of multivectors.
Definition: Amesos2_MultiVecAdapter_decl.hpp:267
int symbolicFactorization_impl()
Perform symbolic factorization of the matrix using STRUMPACK.
Definition: Amesos2_STRUMPACK_def.hpp:156
Utility functions for Amesos2.
Control control_
Parameters for solving.
Definition: Amesos2_SolverCore_decl.hpp:494
Teuchos::RCP< const Teuchos::Comm< int > > getComm() const override
Returns a pointer to the Teuchos::Comm communicator with this operator.
Definition: Amesos2_SolverCore_decl.hpp:363
bool matrixShapeOK_impl() const
Determines whether the shape of the matrix is OK for this solver.
Definition: Amesos2_STRUMPACK_def.hpp:302
bool loadA_impl(EPhase current_phase)
Reads matrix data into internal solver structures.
Definition: Amesos2_STRUMPACK_def.hpp:490
Similar to get_ccs_helper , but used to get a CRS representation of the given matrix.
Definition: Amesos2_Util.hpp:659
Amesos2 interface to STRUMPACK direct solver and preconditioner.
Definition: Amesos2_STRUMPACK_decl.hpp:71
~STRUMPACK()
Destructor.
Definition: Amesos2_STRUMPACK_def.hpp:126
Helper class for putting 1-D data arrays into multivectors.
Definition: Amesos2_MultiVecAdapter_decl.hpp:373
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:455
Teuchos::RCP< const Teuchos::ParameterList > getValidParameters_impl() const
Definition: Amesos2_STRUMPACK_def.hpp:377
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:203
int numericFactorization_impl()
STRUMPACK specific numeric factorization.
Definition: Amesos2_STRUMPACK_def.hpp:181