Ifpack2 Templated Preconditioning Package  Version 1.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
Ifpack2_Details_FastILU_Base_def.hpp
Go to the documentation of this file.
1 /*@HEADER
2 // ***********************************************************************
3 //
4 // Ifpack2: Templated Object-Oriented Algebraic Preconditioner Package
5 // Copyright (2009) Sandia Corporation
6 //
7 // Under terms of Contract DE-AC04-94AL85000, there is a non-exclusive
8 // license for use of this work by or on behalf of the U.S. Government.
9 //
10 // Redistribution and use in source and binary forms, with or without
11 // modification, are permitted provided that the following conditions are
12 // met:
13 //
14 // 1. Redistributions of source code must retain the above copyright
15 // notice, this list of conditions and the following disclaimer.
16 //
17 // 2. Redistributions in binary form must reproduce the above copyright
18 // notice, this list of conditions and the following disclaimer in the
19 // documentation and/or other materials provided with the distribution.
20 //
21 // 3. Neither the name of the Corporation nor the names of the
22 // contributors may be used to endorse or promote products derived from
23 // this software without specific prior written permission.
24 //
25 // THIS SOFTWARE IS PROVIDED BY SANDIA CORPORATION "AS IS" AND ANY
26 // EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
27 // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
28 // PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL SANDIA CORPORATION OR THE
29 // CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
30 // EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
31 // PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
32 // PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
33 // LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
34 // NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
35 // SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
36 //
37 // Questions? Contact Michael A. Heroux (maherou@sandia.gov)
38 //
39 // ***********************************************************************
40 //@HEADER
41 */
42 
44 
45 #ifndef __IFPACK2_FASTILU_BASE_DEF_HPP__
46 #define __IFPACK2_FASTILU_BASE_DEF_HPP__
47 
49 #include "Tpetra_BlockCrsMatrix.hpp"
50 #include "Tpetra_BlockCrsMatrix_Helpers.hpp"
51 #include "Ifpack2_Details_getCrsMatrix.hpp"
52 #include <KokkosKernels_Utils.hpp>
53 #include <Kokkos_Timer.hpp>
54 #include <Teuchos_TimeMonitor.hpp>
55 #include <stdexcept>
56 
57 namespace Ifpack2
58 {
59 namespace Details
60 {
61 
62 template<class Scalar, class LocalOrdinal, class GlobalOrdinal, class Node>
65  mat_(A),
66  initFlag_(false),
67  computedFlag_(false),
68  nInit_(0),
69  nComputed_(0),
70  nApply_(0),
71  initTime_(0.0),
72  computeTime_(0.0),
73  applyTime_(0.0),
74  crsCopyTime_(0.0),
75  params_(Params::getDefaults()) {}
76 
77 template<class Scalar, class LocalOrdinal, class GlobalOrdinal, class Node>
80 getDomainMap () const
81 {
82  return mat_->getDomainMap();
83 }
84 
85 template<class Scalar, class LocalOrdinal, class GlobalOrdinal, class Node>
88 getRangeMap () const
89 {
90  return mat_->getRangeMap();
91 }
92 
93 template<class Scalar, class LocalOrdinal, class GlobalOrdinal, class Node>
95 apply (const Tpetra::MultiVector<Scalar,LocalOrdinal,GlobalOrdinal,Node> &X,
96  Tpetra::MultiVector<Scalar,LocalOrdinal,GlobalOrdinal,Node> &Y,
97  Teuchos::ETransp mode,
98  Scalar alpha,
99  Scalar beta) const
100 {
101  const std::string timerName ("Ifpack2::FastILU::apply");
103  if (timer.is_null ()) {
104  timer = Teuchos::TimeMonitor::getNewCounter (timerName);
105  }
106  Teuchos::TimeMonitor timeMon (*timer);
107 
108  if(!isInitialized() || !isComputed())
109  {
110  throw std::runtime_error(std::string("Called ") + getName() + "::apply() without first calling initialize() and/or compute().");
111  }
112  if(X.getNumVectors() != Y.getNumVectors())
113  {
114  throw std::invalid_argument(getName() + "::apply: X and Y have different numbers of vectors (pass X and Y with exactly matching dimensions)");
115  }
116  if(X.getLocalLength() != Y.getLocalLength())
117  {
118  throw std::invalid_argument(getName() + "::apply: X and Y have different lengths (pass X and Y with exactly matching dimensions)");
119  }
120  //zero out applyTime_ now, because the calls to applyLocalPrec() will add to it
121  applyTime_ = 0;
122  int nvecs = X.getNumVectors();
123  auto nrowsX = X.getLocalLength();
124  auto nrowsY = Y.getLocalLength();
125  if(nvecs == 1)
126  {
127  auto x2d = X.getLocalViewDevice(Tpetra::Access::ReadOnly);
128  auto y2d = Y.getLocalViewDevice(Tpetra::Access::ReadWrite);
129  ImplScalarArray x1d (const_cast<ImplScalar*>(x2d.data()), nrowsX);
130  ImplScalarArray y1d (const_cast<ImplScalar*>(y2d.data()), nrowsY);
131 
132  applyLocalPrec(x1d, y1d);
133  }
134  else
135  {
136  //Solve each vector one at a time (until FastILU supports multiple RHS)
137  auto x2d = X.getLocalViewDevice(Tpetra::Access::ReadOnly);
138  auto y2d = Y.getLocalViewDevice(Tpetra::Access::ReadWrite);
139  for(int i = 0; i < nvecs; i++)
140  {
141  auto xColView1d = Kokkos::subview(x2d, Kokkos::ALL(), i);
142  auto yColView1d = Kokkos::subview(y2d, Kokkos::ALL(), i);
143  ImplScalarArray x1d (const_cast<ImplScalar*>(xColView1d.data()), nrowsX);
144  ImplScalarArray y1d (const_cast<ImplScalar*>(yColView1d.data()), nrowsY);
145 
146  applyLocalPrec(x1d, y1d);
147  }
148  }
149 }
150 
151 template<class Scalar, class LocalOrdinal, class GlobalOrdinal, class Node>
154 {
155  //Params constructor does all parameter validation, and sets default values
156  params_ = Params(List, getName());
157 }
158 
159 template<class Scalar, class LocalOrdinal, class GlobalOrdinal, class Node>
161 isBlockCrs() const
162 {
163  return params_.blockCrs && params_.blockCrsSize > 1;
164 }
165 
166 template<class Scalar, class LocalOrdinal, class GlobalOrdinal, class Node>
169 {
170  const std::string timerName ("Ifpack2::FastILU::initialize");
172  if (timer.is_null ()) {
173  timer = Teuchos::TimeMonitor::getNewCounter (timerName);
174  }
175  Teuchos::TimeMonitor timeMon (*timer);
176 
177  if(mat_.is_null())
178  {
179  throw std::runtime_error(std::string("Called ") + getName() + "::initialize() but matrix was null (call setMatrix() with a non-null matrix first)");
180  }
181 
182  if (isBlockCrs()) {
183  auto crs_matrix = Ifpack2::Details::getCrsMatrix(this->mat_);
184 
185  if (params_.fillBlocks) {
186  // Create new TCrsMatrix with the new filled data and conver to Bcrs
187  auto crs_matrix_block_filled = Tpetra::fillLogicalBlocks(*crs_matrix, params_.blockCrsSize);
188  auto bcrs_matrix = Tpetra::convertToBlockCrsMatrix(*crs_matrix_block_filled, params_.blockCrsSize);
189  mat_ = bcrs_matrix;
190  }
191  else {
192  // Assume input is already filled, just convert to Bcrs
193  auto bcrs_matrix = Tpetra::convertToBlockCrsMatrix(*crs_matrix, params_.blockCrsSize);
194  mat_ = bcrs_matrix;
195  }
196  }
197 
198  Kokkos::Timer copyTimer;
199  CrsArrayReader<Scalar, ImplScalar, LocalOrdinal, GlobalOrdinal, Node>::getStructure(mat_.get(), localRowPtrsHost_, localRowPtrs_, localColInds_);
200  CrsArrayReader<Scalar, ImplScalar, LocalOrdinal, GlobalOrdinal, Node>::getValues(mat_.get(), localValues_, localRowPtrsHost_);
201  crsCopyTime_ = copyTimer.seconds();
202 
203  if (params_.use_metis)
204  {
205  assert(!params_.blockCrs);
206  const std::string timerNameMetis ("Ifpack2::FastILU::Metis");
208  if (timerMetis.is_null ()) {
209  timerMetis = Teuchos::TimeMonitor::getNewCounter (timerNameMetis);
210  }
211  Teuchos::TimeMonitor timeMonMetis (*timerMetis);
212  #ifdef HAVE_IFPACK2_METIS
213  idx_t nrows = localRowPtrsHost_.size() - 1;
214  if (nrows > 0) {
215  // reorder will convert both graph and perm/iperm to the internal METIS integer type
216  metis_perm_ = MetisArrayHost(Kokkos::ViewAllocateWithoutInitializing("metis_perm"), nrows);
217  metis_iperm_ = MetisArrayHost(Kokkos::ViewAllocateWithoutInitializing("metis_iperm"), nrows);
218 
219  // copy ColInds to host
220  auto localColIndsHost_ = Kokkos::create_mirror_view(localColInds_);
221  Kokkos::deep_copy(localColIndsHost_, localColInds_);
222 
223  // prepare for calling metis
224  idx_t nnz = localColIndsHost_.size();
225  MetisArrayHost metis_rowptr;
226  MetisArrayHost metis_colidx;
227 
228  bool metis_symmetrize = true;
229  if (metis_symmetrize) {
230  // symmetrize
231  using OrdinalArrayMirror = typename OrdinalArray::host_mirror_type;
232  KokkosKernels::Impl::symmetrize_graph_symbolic_hashmap<
233  OrdinalArrayHost, OrdinalArrayMirror, MetisArrayHost, MetisArrayHost, Kokkos::HostSpace::execution_space>
234  (nrows, localRowPtrsHost_, localColIndsHost_, metis_rowptr, metis_colidx);
235 
236  // remove diagonals
237  idx_t old_nnz = nnz = 0;
238  for (idx_t i = 0; i < nrows; i++) {
239  for (LocalOrdinal k = old_nnz; k < metis_rowptr(i+1); k++) {
240  if (metis_colidx(k) != i) {
241  metis_colidx(nnz) = metis_colidx(k);
242  nnz++;
243  }
244  }
245  old_nnz = metis_rowptr(i+1);
246  metis_rowptr(i+1) = nnz;
247  }
248  } else {
249  // copy and remove diagonals
250  metis_rowptr = MetisArrayHost(Kokkos::ViewAllocateWithoutInitializing("metis_rowptr"), nrows+1);
251  metis_colidx = MetisArrayHost(Kokkos::ViewAllocateWithoutInitializing("metis_colidx"), nnz);
252  nnz = 0;
253  metis_rowptr(0) = 0;
254  for (idx_t i = 0; i < nrows; i++) {
255  for (LocalOrdinal k = localRowPtrsHost_(i); k < localRowPtrsHost_(i+1); k++) {
256  if (localColIndsHost_(k) != i) {
257  metis_colidx(nnz) = localColIndsHost_(k);
258  nnz++;
259  }
260  }
261  metis_rowptr(i+1) = nnz;
262  }
263  }
264 
265  // call metis
266  int info = METIS_NodeND(&nrows, metis_rowptr.data(), metis_colidx.data(),
267  NULL, NULL, metis_perm_.data(), metis_iperm_.data());
268  if (METIS_OK != info) {
269  throw std::runtime_error(std::string("METIS_NodeND returned info = " + info));
270  }
271  }
272  #else
273  throw std::runtime_error(std::string("TPL METIS is not enabled"));
274  #endif
275  }
276 
277  initLocalPrec(); //note: initLocalPrec updates initTime
278  initFlag_ = true;
279  nInit_++;
280 }
281 
282 template<class Scalar, class LocalOrdinal, class GlobalOrdinal, class Node>
285 {
286  return initFlag_;
287 }
288 
289 template<class Scalar, class LocalOrdinal, class GlobalOrdinal, class Node>
292 {
293  if(!initFlag_)
294  {
295  throw std::runtime_error(getName() + ": initialize() must be called before compute()");
296  }
297 
298  const std::string timerName ("Ifpack2::FastILU::compute");
300  if (timer.is_null ()) {
301  timer = Teuchos::TimeMonitor::getNewCounter (timerName);
302  }
303  Teuchos::TimeMonitor timeMon (*timer);
304 
305  //get copy of values array from matrix
306  Kokkos::Timer copyTimer;
307  CrsArrayReader<Scalar, ImplScalar, LocalOrdinal, GlobalOrdinal, Node>::getValues(mat_.get(), localValues_, localRowPtrsHost_);
308  crsCopyTime_ += copyTimer.seconds(); //add to the time spent getting rowptrs/colinds
309  computeLocalPrec(); //this updates computeTime_
310  computedFlag_ = true;
311  nComputed_++;
312 }
313 
314 template<class Scalar, class LocalOrdinal, class GlobalOrdinal, class Node>
316 isComputed() const
317 {
318  return computedFlag_;
319 }
320 
321 template<class Scalar, class LocalOrdinal, class GlobalOrdinal, class Node>
324 getMatrix() const
325 {
326  return mat_;
327 }
328 
329 template<class Scalar, class LocalOrdinal, class GlobalOrdinal, class Node>
332 {
333  return nInit_;
334 }
335 
336 template<class Scalar, class LocalOrdinal, class GlobalOrdinal, class Node>
339 {
340  return nComputed_;
341 }
342 
343 template<class Scalar, class LocalOrdinal, class GlobalOrdinal, class Node>
345 getNumApply() const
346 {
347  return nApply_;
348 }
349 
350 template<class Scalar, class LocalOrdinal, class GlobalOrdinal, class Node>
353 {
354  return initTime_;
355 }
356 
357 template<class Scalar, class LocalOrdinal, class GlobalOrdinal, class Node>
360 {
361  return computeTime_;
362 }
363 
364 template<class Scalar, class LocalOrdinal, class GlobalOrdinal, class Node>
367 {
368  return applyTime_;
369 }
370 
371 template<class Scalar, class LocalOrdinal, class GlobalOrdinal, class Node>
373 getCopyTime() const
374 {
375  return crsCopyTime_;
376 }
377 
378 template<class Scalar, class LocalOrdinal, class GlobalOrdinal, class Node>
381 {
382  //if the underlying type of this doesn't implement checkLocalILU, it's an illegal operation
383  throw std::runtime_error(std::string("Preconditioner type Ifpack2::Details::") + getName() + " doesn't support checkLocalILU().");
384 }
385 
386 template<class Scalar, class LocalOrdinal, class GlobalOrdinal, class Node>
389 {
390  //if the underlying type of this doesn't implement checkLocalIC, it's an illegal operation
391  throw std::runtime_error(std::string("Preconditioner type Ifpack2::Details::") + getName() + " doesn't support checkLocalIC().");
392 }
393 
394 template<typename Scalar, typename LocalOrdinal, typename GlobalOrdinal, typename Node>
396 {
397  std::ostringstream os;
398  //Output is a YAML dictionary
399  os << "\"Ifpack2::Details::" << getName() << "\": {";
400  os << "Initialized: " << (isInitialized() ? "true" : "false") << ", ";
401  os << "Computed: " << (isComputed() ? "true" : "false") << ", ";
402  os << "Sweeps: " << getSweeps() << ", ";
403  os << "Triangular solve type: " << getSpTrsvType() << ", ";
404  if (getSpTrsvType() == "Fast") {
405  os << "# of triangular solve iterations: " << getNTrisol() << ", ";
406  }
407  if(mat_.is_null())
408  {
409  os << "Matrix: null";
410  }
411  else
412  {
413  os << "Global matrix dimensions: [" << mat_->getGlobalNumRows() << ", " << mat_->getGlobalNumCols() << "]";
414  os << ", Global nnz: " << mat_->getGlobalNumEntries();
415  }
416  return os.str();
417 }
418 
419 template<typename Scalar, typename LocalOrdinal, typename GlobalOrdinal, typename Node>
422 {
423  if(A.is_null())
424  {
425  throw std::invalid_argument(std::string("Ifpack2::Details::") + getName() + "::setMatrix() called with a null matrix. Pass a non-null matrix.");
426  }
427  //bmk note: this modeled after RILUK::setMatrix
428  if(mat_.get() != A.get())
429  {
430  mat_ = A;
431  initFlag_ = false;
432  computedFlag_ = false;
433  }
434 }
435 
436 template<typename Scalar, typename LocalOrdinal, typename GlobalOrdinal, typename Node>
440 {
441  Params p;
442  p.use_metis = false;
443  p.sptrsv_algo = FastILU::SpTRSV::Fast;
444  p.nFact = 5; // # of sweeps for computing fastILU
445  p.nTrisol = 5; // # of sweeps for applying fastSpTRSV
446  p.level = 0; // level of ILU
447  p.omega = 1.0; // damping factor for fastILU
448  p.shift = 0;
449  p.guessFlag = true;
450  p.blockSizeILU = 1; // # of nonzeros / thread, for fastILU
451  p.blockSize = 1; // # of rows / thread, for SpTRSV
452  p.blockCrs = false; // whether to use block CRS for fastILU
453  p.blockCrsSize = 1; // block size for block CRS
454  p.fillBlocks = false; // whether input matrix needs to be filled
455  return p;
456 }
457 
458 template<typename Scalar, typename LocalOrdinal, typename GlobalOrdinal, typename Node>
459 FastILU_Base<Scalar, LocalOrdinal, GlobalOrdinal, Node>::
460 Params::Params(const Teuchos::ParameterList& pL, std::string precType)
461 {
462  *this = getDefaults();
463  //For each parameter, check that if the parameter exists, it has the right type
464  //Then get the value and sanity check it
465  //If the parameter doesn't exist, leave it as default (from Params::getDefaults())
466  //"sweeps" aka nFact
467  #define TYPE_ERROR(name, correctTypeName) {throw std::invalid_argument(precType + "::setParameters(): parameter \"" + name + "\" has the wrong type (must be " + correctTypeName + ")");}
468  #define CHECK_VALUE(param, member, cond, msg) {if(cond) {throw std::invalid_argument(precType + "::setParameters(): parameter \"" + param + "\" has value " + std::to_string(member) + " but " + msg);}}
469 
470  //metis
471  if(pL.isParameter("metis"))
472  {
473  if(pL.isType<bool>("metis"))
474  use_metis = pL.get<bool>("metis");
475  else
476  TYPE_ERROR("metis", "bool");
477  }
478 
479  if(pL.isParameter("sweeps"))
480  {
481  if(pL.isType<int>("sweeps"))
482  {
483  nFact = pL.get<int>("sweeps");
484  CHECK_VALUE("sweeps", nFact, nFact < 1, "must have a value of at least 1");
485  }
486  else
487  TYPE_ERROR("sweeps", "int");
488  }
489  std::string sptrsv_type = "Fast";
490  if(pL.isParameter("triangular solve type")) {
491  sptrsv_type = pL.get<std::string> ("triangular solve type");
492  }
493  if (sptrsv_type == "Standard Host") {
494  sptrsv_algo = FastILU::SpTRSV::StandardHost;
495  } else if (sptrsv_type == "Standard") {
496  sptrsv_algo = FastILU::SpTRSV::Standard;
497  }
498 
499  //"triangular solve iterations" aka nTrisol
500  if(pL.isParameter("triangular solve iterations"))
501  {
502  if(pL.isType<int>("triangular solve iterations"))
503  {
504  nTrisol = pL.get<int>("triangular solve iterations");
505  CHECK_VALUE("triangular solve iterations", nTrisol, nTrisol < 1, "must have a value of at least 1");
506  }
507  else
508  TYPE_ERROR("triangular solve iterations", "int");
509  }
510  //"level"
511  if(pL.isParameter("level"))
512  {
513  if(pL.isType<int>("level"))
514  {
515  level = pL.get<int>("level");
516  }
517  else if(pL.isType<double>("level"))
518  {
519  //Level can be read as double (like in ILUT), but must be an exact integer
520  //Any integer used for level-of-fill can be represented exactly in double (so use exact compare)
521  double dval = pL.get<double>("level");
522  double ipart;
523  double fpart = modf(dval, &ipart);
524  level = ipart;
525  CHECK_VALUE("level", level, fpart != 0, "must be an integral value");
526  }
527  else
528  {
529  TYPE_ERROR("level", "int");
530  }
531  CHECK_VALUE("level", level, level < 0, "must be nonnegative");
532  }
533  if(pL.isParameter("damping factor"))
534  {
535  if(pL.isType<double>("damping factor"))
536  omega = pL.get<double>("damping factor");
537  else
538  TYPE_ERROR("damping factor", "double");
539  }
540  if(pL.isParameter("shift"))
541  {
542  if(pL.isType<double>("shift"))
543  shift = pL.get<double>("shift");
544  else
545  TYPE_ERROR("shift", "double");
546  }
547  //"guess" aka guessFlag
548  if(pL.isParameter("guess"))
549  {
550  if(pL.isType<bool>("guess"))
551  guessFlag = pL.get<bool>("guess");
552  else
553  TYPE_ERROR("guess", "bool");
554  }
555  //"block size" aka blkSz
556  if(pL.isParameter("block size for ILU"))
557  {
558  if(pL.isType<int>("block size for ILU"))
559  {
560  blockSizeILU = pL.get<int>("block size for ILU");
561  CHECK_VALUE("block size for ILU", blockSizeILU, blockSizeILU < 1, "must have a value of at least 1");
562  }
563  else
564  TYPE_ERROR("block size for ILU", "int");
565  }
566  //"block size" aka blkSz
567  if(pL.isParameter("block size for SpTRSV"))
568  {
569  if(pL.isType<int>("block size for SpTRSV"))
570  blockSize = pL.get<int>("block size for SpTRSV");
571  else
572  TYPE_ERROR("block size for SpTRSV", "int");
573  }
574  //"block crs" aka blockCrs
575  if(pL.isParameter("block crs"))
576  {
577  if(pL.isType<bool>("block crs"))
578  blockCrs = pL.get<bool>("block crs");
579  else
580  TYPE_ERROR("block crs", "bool");
581  }
582  //"block crs block size" aka blockCrsSize
583  if(pL.isParameter("block crs block size"))
584  {
585  if(pL.isType<int>("block crs block size"))
586  blockCrsSize = pL.get<int>("block crs block size");
587  else
588  TYPE_ERROR("block crs block size", "int");
589  }
590  //"fill blocks for input" aka fillBlocks
591  if(pL.isParameter("fill blocks for input"))
592  {
593  if(pL.isType<bool>("fill blocks for input"))
594  blockCrsSize = pL.get<bool>("fill blocks for input");
595  else
596  TYPE_ERROR("fill blocks for input", "bool");
597  }
598 
599  #undef CHECK_VALUE
600  #undef TYPE_ERROR
601 }
602 
603 #define IFPACK2_DETAILS_FASTILU_BASE_INSTANT(S, L, G, N) \
604 template class Ifpack2::Details::FastILU_Base<S, L, G, N>;
605 
606 } //namespace Details
607 } //namespace Ifpack2
608 
609 #endif
int getNumCompute() const
Get the number of times compute() was called.
Definition: Ifpack2_Details_FastILU_Base_def.hpp:338
virtual void checkLocalIC() const
Verify and print debug information about the underlying IC preconditioner.
Definition: Ifpack2_Details_FastILU_Base_def.hpp:388
double getComputeTime() const
Get the time spent in the last compute() call.
Definition: Ifpack2_Details_FastILU_Base_def.hpp:359
Kokkos::View< LocalOrdinal *, execution_space >::HostMirror OrdinalArrayHost
Array of LocalOrdinal on host.
Definition: Ifpack2_Details_FastILU_Base_decl.hpp:93
T & get(const std::string &name, T def_value)
static RCP< Time > getNewCounter(const std::string &name)
static RCP< Time > lookupCounter(const std::string &name)
double getCopyTime() const
Get the time spent deep copying local 3-array CRS out of the matrix.
Definition: Ifpack2_Details_FastILU_Base_def.hpp:373
T * get() const
double getInitializeTime() const
Get the time spent in the last initialize() call.
Definition: Ifpack2_Details_FastILU_Base_def.hpp:352
Teuchos::RCP< const Tpetra::Map< LocalOrdinal, GlobalOrdinal, Node > > getRangeMap() const
Get the range map of the matrix.
Definition: Ifpack2_Details_FastILU_Base_def.hpp:88
double getApplyTime() const
Get the time spent in the last apply() call.
Definition: Ifpack2_Details_FastILU_Base_def.hpp:366
Teuchos::RCP< const Tpetra::Map< LocalOrdinal, GlobalOrdinal, Node > > getDomainMap() const
Get the domain map of the matrix.
Definition: Ifpack2_Details_FastILU_Base_def.hpp:80
bool isParameter(const std::string &name) const
Teuchos::RCP< const TRowMatrix > getMatrix() const
Get the current matrix.
Definition: Ifpack2_Details_FastILU_Base_def.hpp:324
virtual void checkLocalILU() const
Verify and print debug information about the underlying ILU preconditioner (only supported if this is...
Definition: Ifpack2_Details_FastILU_Base_def.hpp:380
int getNumApply() const
Get the number of times apply() was called.
Definition: Ifpack2_Details_FastILU_Base_def.hpp:345
The base class of the Ifpack2 FastILU wrappers (Filu, Fildl and Fic)
Definition: Ifpack2_Details_FastILU_Base_decl.hpp:71
void setParameters(const Teuchos::ParameterList &List)
Validate parameters, and set defaults when parameters are not provided.
Definition: Ifpack2_Details_FastILU_Base_def.hpp:153
std::string description() const
Return a brief description of the preconditioner, in YAML format.
Definition: Ifpack2_Details_FastILU_Base_def.hpp:395
void compute()
Compute the preconditioner.
Definition: Ifpack2_Details_FastILU_Base_def.hpp:291
Kokkos::View< ImplScalar *, execution_space > ImplScalarArray
Array of Scalar on device.
Definition: Ifpack2_Details_FastILU_Base_decl.hpp:95
FastILU_Base(Teuchos::RCP< const TRowMatrix > mat_)
Constructor.
Definition: Ifpack2_Details_FastILU_Base_def.hpp:64
bool isComputed() const
Whether compute() has been called since the last time the matrix&#39;s values or structure were changed...
Definition: Ifpack2_Details_FastILU_Base_def.hpp:316
bool isInitialized() const
Whether initialize() has been called since the last time the matrix&#39;s structure was changed...
Definition: Ifpack2_Details_FastILU_Base_def.hpp:284
void initialize()
Initialize the preconditioner.
Definition: Ifpack2_Details_FastILU_Base_def.hpp:168
bool isType(const std::string &name) const
void setMatrix(const Teuchos::RCP< const TRowMatrix > &A)
Definition: Ifpack2_Details_FastILU_Base_def.hpp:421
void apply(const TMultiVec &X, TMultiVec &Y, Teuchos::ETransp mode=Teuchos::NO_TRANS, Scalar alpha=Teuchos::ScalarTraits< Scalar >::one(), Scalar beta=Teuchos::ScalarTraits< Scalar >::zero()) const
Apply the preconditioner.
Definition: Ifpack2_Details_FastILU_Base_def.hpp:95
int getNumInitialize() const
Get the number of times initialize() was called.
Definition: Ifpack2_Details_FastILU_Base_def.hpp:331
Provides functions for retrieving local CRS arrays (row pointers, column indices, and values) from Tp...
bool is_null() const