Amesos Package Browser (Single Doxygen Collection) Development
Loading...
Searching...
No Matches
Amesos_Pardiso.cpp
Go to the documentation of this file.
1// @HEADER
2// ***********************************************************************
3//
4// Amesos: Direct Sparse Solver Package
5// Copyright (2004) 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// This library is free software; you can redistribute it and/or modify
11// it under the terms of the GNU Lesser General Public License as
12// published by the Free Software Foundation; either version 2.1 of the
13// License, or (at your option) any later version.
14//
15// This library is distributed in the hope that it will be useful, but
16// WITHOUT ANY WARRANTY; without even the implied warranty of
17// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
18// Lesser General Public License for more details.
19//
20// You should have received a copy of the GNU Lesser General Public
21// License along with this library; if not, write to the Free Software
22// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301
23// USA
24// Questions? Contact Michael A. Heroux (maherou@sandia.gov)
25//
26// ***********************************************************************
27// @HEADER
28
29#include "Amesos_Pardiso.h"
30#include "Epetra_Map.h"
31#include "Epetra_Import.h"
32#include "Epetra_CrsMatrix.h"
33#include "Epetra_Vector.h"
34#include "Epetra_Util.h"
35
36#ifdef HAVE_AMESOS_PARDISO_MKL
37
38#include "mkl_pardiso.h"
39#define F77_PARDISO PARDISO
40
41#else
42
43#define F77_PARDISOINIT F77_FUNC(pardisoinit, PARDISOINIT)
44#define F77_PARDISO F77_FUNC(pardiso, PARDISO)
45
46/* PARDISO prototype. */
47extern "C" int F77_PARDISOINIT
48 (void *, int *, int *, int *, double *, int *);
49
50extern "C" int F77_PARDISO
51 (void *, int *, int *, int *, int *, int *,
52 double *, int *, int *, int *, int *, int *,
53 int *, double *, double *, int *, double *);
54#endif
55
56#define IPARM(i) iparm_[i-1]
57
58using namespace Teuchos;
59
60//=============================================================================
61Amesos_Pardiso::Amesos_Pardiso(const Epetra_LinearProblem &prob) :
62 UseTranspose_(false),
63 Problem_(&prob),
64 MtxConvTime_(-1),
65 MtxRedistTime_(-1),
66 VecRedistTime_(-1),
67 SymFactTime_(-1),
68 NumFactTime_(-1),
69 SolveTime_(-1),
70 maxfct_(1),
71 mnum_(1),
72 msglvl_(0),
73 nrhs_(1),
74 pardiso_initialized_(false)
75{
76 for (int i = 0; i < 64; i++) {
77 iparm_[i] = 0;
78 }
79 iparm_[0] = 1; /* No solver default */
80 iparm_[1] = 2; /* Fill-in reordering from METIS */
81 /* Numbers of processors, value of OMP_NUM_THREADS */
82 iparm_[2] = 1;
83 iparm_[3] = 0; /* No iterative-direct algorithm */
84 iparm_[4] = 0; /* No user fill-in reducing permutation */
85 iparm_[5] = 0; /* Write solution into x */
86 iparm_[6] = 0; /* Not in use */
87 iparm_[7] = 0; /* Max numbers of iterative refinement steps */
88 iparm_[8] = 0; /* Not in use */
89 iparm_[9] = 13; /* Perturb the pivot elements with 1E-13 */
90 iparm_[10] = 1; /* Use nonsymmetric permutation and scaling MPS */
91 iparm_[11] = 0; /* Normal solve (0), or a transpose solve (1) */
92 iparm_[12] = 0; /* Do not use (non-)symmetric matchings */
93 iparm_[13] = 0; /* Output: Number of perturbed pivots */
94 iparm_[14] = 0; /* Peak memory in KB during analysis */
95 iparm_[15] = 0; /* Permanent mem in KB from anal. that is used in ph 2&3 */
96 iparm_[16] = 0; /* Peak double prec mem in KB incl one LU factor */
97 iparm_[17] = -1; /* Output: Number of nonzeros in the factor LU */
98 iparm_[18] = -1; /* Output: Mflops for LU factorization */
99 iparm_[19] = 0; /* Output: Numbers of CG Iterations */
100
101 /* -------------------------------------------------------------------- */
102 /* .. Initialize the internal solver memory pointer. This is only */
103 /* necessary for the FIRST call of the PARDISO solver. */
104 /* -------------------------------------------------------------------- */
105 for (int i = 0; i < 64; i++) {
106 pt_[i] = 0;
107 }
108}
109
110//=============================================================================
112{
113 int phase = -1; /* Release internal memory. */
114 int error = 0;
115 int idum;
116 double ddum;
117
119 int n = SerialMatrix().NumMyRows();
120#ifdef HAVE_AMESOS_PARDISO_MKL
121 F77_PARDISO(pt_, &maxfct_, &mnum_, &mtype_, &phase,
122 &n, &ddum, &ia_[0], &ja_[0], &idum, &nrhs_,
123 iparm_, &msglvl_, &ddum, &ddum, &error);
124#else
125 F77_PARDISO(pt_, &maxfct_, &mnum_, &mtype_, &phase,
126 &n, &ddum, &ia_[0], &ja_[0], &idum, &nrhs_,
127 iparm_, &msglvl_, &ddum, &ddum, &error, dparm_);
128#endif
129 }
130
132 // print out some information if required by the user
133 if ((verbose_ && PrintTiming_) || verbose_ == 2) PrintTiming();
134 if ((verbose_ && PrintStatus_) || verbose_ == 2) PrintStatus();
135}
136
137//=============================================================================
139{
140 ResetTimer();
141
142 int NumGlobalRows = Matrix_->NumGlobalRows();
143
144 // create a serial map
145 int NumMyRows = 0;
146 if (Comm().MyPID() == 0)
147 NumMyRows = NumGlobalRows;
148
149 SerialMap_ = rcp(new Epetra_Map(-1, NumMyRows, 0, Comm()));
150 if (SerialMap_.get() == 0)
151 AMESOS_CHK_ERR(-1);
152
153 Importer_ = rcp(new Epetra_Import(SerialMap(),Map()));
154 if (Importer_.get() == 0)
155 AMESOS_CHK_ERR(-1);
156
157 SerialCrsMatrix_ = rcp(new Epetra_CrsMatrix(Copy, SerialMap(), 0));
158 if (SerialCrsMatrix_.get() == 0)
159 AMESOS_CHK_ERR(-1);
160
161 AMESOS_CHK_ERR(SerialCrsMatrix().Import(Matrix(), Importer(), Add));
162
163 AMESOS_CHK_ERR(SerialCrsMatrix().FillComplete());
164
165 SerialMatrix_ = rcp(SerialCrsMatrix_.get(), false);
166
167 MtxRedistTime_ = AddTime("Total matrix redistribution time", MtxRedistTime_);
168
169 return 0;
170}
171
172//=============================================================================
174{
175 ResetTimer();
176
177 if (Comm().MyPID() == 0)
178 {
179 ia_.resize(SerialMatrix().NumMyRows()+1);
180 ja_.resize(SerialMatrix().NumMyNonzeros());
181 aa_.resize(SerialMatrix().NumMyNonzeros());
182
183 int MaxNumEntries = SerialMatrix().MaxNumEntries();
184 std::vector<int> Indices(MaxNumEntries);
185 std::vector<double> Values(MaxNumEntries);
186
187 // Requires FORTRAN numbering (from 1)
188 ia_[0] = 1;
189 int count = 0;
190
191 for (int i = 0 ; i < SerialMatrix().NumMyRows() ; ++i)
192 {
193 int ierr, NumEntriesThisRow;
194 ierr = SerialMatrix().ExtractMyRowCopy(i, MaxNumEntries,
195 NumEntriesThisRow,
196 &Values[0], &Indices[0]);
197 if (ierr < 0)
198 AMESOS_CHK_ERR(ierr);
199
200 ia_[i + 1] = ia_[i] + NumEntriesThisRow;
201
202 for (int j = 0 ; j < NumEntriesThisRow ; ++j)
203 {
204 if (Indices[j] == i)
205 Values[j] += AddToDiag_;
206
207 ja_[count] = Indices[j] + 1;
208 aa_[count] = Values[j];
209 ++count;
210 }
211 }
212
213 if (count != SerialMatrix().NumMyNonzeros())
214 AMESOS_CHK_ERR(-1); // something wrong here
215 }
216
217 MtxConvTime_ = AddTime("Total matrix conversion time", MtxConvTime_);
218
219 return 0;
220}
221
222//=============================================================================
223int Amesos_Pardiso::SetParameters( Teuchos::ParameterList &ParameterList)
224{
225 // retrive general parameters
226
227 SetStatusParameters( ParameterList );
228
229 SetControlParameters( ParameterList );
230
231 // We fill iparm_ using named parameters
232 if (ParameterList.isSublist("Pardiso"))
233 {
234 param_ = ParameterList.sublist("Pardiso");
235 }
236
237 msglvl_ = param_.get<int>("Message level", static_cast<int>(debug_));
238 iparm_[0] = param_.get<int>("No default parameters", 1);
239 iparm_[1] = param_.get<int>("Use METIS reordering" , 2);
240 iparm_[2] = param_.get<int>("Number of processors", 1);
241 iparm_[3] = param_.get<int>("Do preconditioned CGS iterations", 0);
242 iparm_[4] = param_.get<int>("Use user permutation", 0);
243 iparm_[5] = param_.get<int>("Solution on X/B", 0);
244 iparm_[7] = param_.get<int>("Max num of iterative refinement steps", 0);
245 iparm_[9] = param_.get<int>("Perturbation for pivot elements 10^-k", 13);
246 iparm_[10] = param_.get<int>("Use (non-)symmetric scaling vectors", 1);
247 iparm_[11] = param_.get<int>("Solve transposed", 0);
248 iparm_[12] = param_.get<int>("Use (non-)symmetric matchings", 0);
249 iparm_[17] = param_.get<int>("Number of non-zeros in LU; -1 to compute", -1);
250 iparm_[18] = param_.get<int>("Mflops for LU fact; -1 to compute", -1);
251
252 return 0;
253}
254
255//=============================================================================
257{
258 ResetTimer();
259
260 int error = 0;
261
262 if (Comm().MyPID() == 0)
263 {
264 // at this point only read unsym matrix
265 mtype_ = 11;
266 int solver = 0;
267
268 // ============================================================== //
269 // Setup Pardiso control parameters und initialize the solvers //
270 // internal adress pointers. This is only necessary for the FIRST //
271 // call of the PARDISO solver. //
272 // The number of processors is specified by IPARM(2), in the //
273 // Pardiso sublist. //
274 // ============================================================== //
275#ifndef HAVE_AMESOS_PARDISO_MKL
276 F77_PARDISOINIT(pt_, &mtype_, &solver, iparm_, dparm_, &error);
277#endif
279
280 int num_procs = 1;
281 char* var = getenv("OMP_NUM_THREADS");
282 if(var != NULL)
283 sscanf( var, "%d", &num_procs );
284 IPARM(3) = num_procs;
285
286 maxfct_ = 1; /* Maximum number of numerical factorizations. */
287 mnum_ = 1; /* Which factorization to use. */
288
289 int phase = 11;
290 error = 0;
291 int n = SerialMatrix().NumMyRows();
292 int idum;
293 double ddum;
294
295#ifdef HAVE_AMESOS_PARDISO_MKL
296 F77_PARDISO(pt_, &maxfct_, &mnum_, &mtype_, &phase,
297 &n, &aa_[0], &ia_[0], &ja_[0], &idum, &nrhs_,
298 iparm_, &msglvl_, &ddum, &ddum, &error);
299#else
300 F77_PARDISO(pt_, &maxfct_, &mnum_, &mtype_, &phase,
301 &n, &aa_[0], &ia_[0], &ja_[0], &idum, &nrhs_,
302 iparm_, &msglvl_, &ddum, &ddum, &error, dparm_);
303#endif
304 }
305
306 SymFactTime_ = AddTime("Total symbolic factorization time", SymFactTime_);
307
308 // Any failure should be sent to all other processors.
309 Comm().Broadcast( &error, 1, 0 );
310 if ( error ) {
311 if (Comm().MyPID() == 0) {
313 } else
314 return error;
315 }
316
317 return 0;
318}
319
320//=============================================================================
322{
323 ResetTimer();
324
325 int error = 0;
326
327 if (Comm().MyPID() == 0)
328 {
329 int phase = 22;
330 int n = SerialMatrix().NumMyRows();
331 int idum;
332 double ddum;
333
334#ifdef HAVE_AMESOS_PARDISO_MKL
335 F77_PARDISO (pt_, &maxfct_, &mnum_, &mtype_, &phase,
336 &n, &aa_[0], &ia_[0], &ja_[0], &idum, &nrhs_,
337 iparm_, &msglvl_, &ddum, &ddum, &error);
338#else
339 F77_PARDISO (pt_, &maxfct_, &mnum_, &mtype_, &phase,
340 &n, &aa_[0], &ia_[0], &ja_[0], &idum, &nrhs_,
341 iparm_, &msglvl_, &ddum, &ddum, &error, dparm_);
342#endif
343 }
344
345 NumFactTime_ = AddTime("Total numeric factorization time", NumFactTime_);
346
347 // Any failure should be sent to all other processors.
348 Comm().Broadcast( &error, 1, 0 );
349 if ( error ) {
350 if (Comm().MyPID() == 0) {
352 } else
353 return error;
354 }
355
356 return 0;
357}
358
359//=============================================================================
361{
362 bool OK = true;
363
364 if (GetProblem()->GetOperator()->OperatorRangeMap().NumGlobalPoints() !=
365 GetProblem()->GetOperator()->OperatorDomainMap().NumGlobalPoints() )
366 {
367 OK = false;
368 }
369 return OK;
370}
371
372//=============================================================================
374{
377
378 CreateTimer(Comm());
379
381
382 Matrix_ = dynamic_cast<Epetra_RowMatrix*>(Problem_->GetOperator());
383 Map_ = &(Matrix_->RowMatrixRowMap());
384
385 // =========================================================== //
386 // redistribute and create all import/export objects only //
387 // if more than one processor is used. Otherwise simply set //
388 // dummy pointers to Matrix() and Map(), without giving the //
389 // ownership to the smart pointer. //
390 // =========================================================== //
391
392 if (Comm().NumProc() != 1)
394 else
395 {
396 SerialMap_ = rcp(const_cast<Epetra_Map*>(&Map()), false);
397 SerialMatrix_ = rcp(const_cast<Epetra_RowMatrix*>(&Matrix()), false);
398 }
399
400 // =========================================================== //
401 // Only on processor zero, convert the matrix into CSR format, //
402 // as required by PARDISO. //
403 // =========================================================== //
404
406
408
410
411 return(0);
412}
413
414//=============================================================================
416{
418
419 if (IsSymbolicFactorizationOK_ == false)
421
423
424 // FIXME: this must be checked, now all the matrix is shipped twice here
427
429
431
432 return(0);
433}
434
435//=============================================================================
437{
438 if (IsNumericFactorizationOK_ == false)
440
441 Epetra_MultiVector* X = Problem_->GetLHS();
442 Epetra_MultiVector* B = Problem_->GetRHS();
443
444 if ((X == 0) || (B == 0))
445 AMESOS_CHK_ERR(-1);
446
447 int NumVectors = X->NumVectors();
448 if (NumVectors != B->NumVectors())
449 AMESOS_CHK_ERR(-1);
450
451 // vectors with SerialMap_
452 Epetra_MultiVector* SerialB;
453 Epetra_MultiVector* SerialX;
454
455 ResetTimer();
456
457 if (Comm().NumProc() == 1)
458 {
459 SerialB = B;
460 SerialX = X;
461 }
462 else
463 {
464 SerialX = new Epetra_MultiVector(SerialMap(),NumVectors);
465 SerialB = new Epetra_MultiVector(SerialMap(),NumVectors);
466
467 SerialB->Import(*B,Importer(),Insert);
468 }
469
470 VecRedistTime_ = AddTime("Total vector redistribution time", VecRedistTime_);
471
472 ResetTimer();
473
474 int error = 0;
475
476 if (Comm().MyPID() == 0)
477 {
478 double* SerialXValues;
479 double* SerialBValues;
480 int LDA;
481
482 AMESOS_CHK_ERR(SerialX->ExtractView(&SerialXValues,&LDA));
483
484 // FIXME: check LDA
485 AMESOS_CHK_ERR(SerialB->ExtractView(&SerialBValues,&LDA));
486
487 int idum = 0;
488 int n = SerialMatrix().NumMyRows();
489 int phase = 33;
490
491 for (int i = 0 ; i < NumVectors ; ++i)
492#ifdef HAVE_AMESOS_PARDISO_MKL
493 F77_PARDISO (pt_, &maxfct_, &mnum_, &mtype_, &phase,
494 &n, &aa_[0], &ia_[0], &ja_[0], &idum, &nrhs_,
495 iparm_, &msglvl_,
496 SerialBValues + i * n,
497 SerialXValues + i * n,
498 &error);
499#else
500 F77_PARDISO (pt_, &maxfct_, &mnum_, &mtype_, &phase,
501 &n, &aa_[0], &ia_[0], &ja_[0], &idum, &nrhs_,
502 iparm_, &msglvl_,
503 SerialBValues + i * n,
504 SerialXValues + i * n,
505 &error, dparm_);
506#endif
507 }
508
509 SolveTime_ = AddTime("Total solve time", SolveTime_);
510
511 // Any failure should be sent to all other processors.
512 Comm().Broadcast( &error, 1, 0 );
513 if ( error ) {
514 if (Comm().MyPID() == 0) {
516 } else
517 return error;
518 }
519
520 // Copy X back to the original vector
521
522 ResetTimer();
523
524 if (Comm().NumProc() != 1)
525 {
526 X->Export(*SerialX, Importer(), Insert);
527 delete SerialB;
528 delete SerialX;
529 } // otherwise we are already in place.
530
531 VecRedistTime_ = AddTime("Total vector redistribution time", VecRedistTime_);
532
534 ComputeTrueResidual(Matrix(), *X, *B, UseTranspose(), "Amesos_Pardiso");
535
537 ComputeVectorNorms(*X, *B, "Amesos_Pardiso");
538
539 ++NumSolve_;
540
541 return(0) ;
542}
543
544// ======================================================================
546{
547 if (Problem_->GetOperator() == 0 || Comm().MyPID() != 0)
548 return;
549
550 std::string p = "Amesos_Pardiso : ";
551 PrintLine();
552
553 int n = Matrix().NumGlobalRows();
554 int nnz = Matrix().NumGlobalNonzeros();
555
556 std::cout << p << "Matrix has " << n << " rows"
557 << " and " << nnz << " nonzeros" << std::endl;
558 std::cout << p << "Nonzero elements per row = "
559 << 1.0 * nnz / n << std::endl;
560 std::cout << p << "Percentage of nonzero elements = "
561 << 100.0 * nnz /(pow(n,2.0)) << std::endl;
562 std::cout << p << "Use transpose = " << UseTranspose_ << std::endl;
563 std::cout << p << "Number of performed iterative ref. steps = " << IPARM(9) << std::endl;
564 std::cout << p << "Peak memory symbolic factorization = " << IPARM(15) << std::endl;
565 std::cout << p << "Permanent memory symbolic factorization = " << IPARM(16) << std::endl;
566 std::cout << p << "Memory numerical fact. and solution = " << IPARM(17) << std::endl;
567 std::cout << p << "Number of nonzeros in factors = " << IPARM(18) << std::endl;
568 std::cout << p << "MFlops of factorization = " << IPARM(19) << std::endl;
569 std::cout << p << "CG/CGS diagnostic = " << IPARM(20) << std::endl;
570 std::cout << p << "Inertia: Number of positive eigenvalues = " << IPARM(22) << std::endl;
571 std::cout << p << "Inertia: Number of negative eigenvalues = " << IPARM(23) << std::endl;
572
573 PrintLine();
574
575 return;
576}
577
578// ======================================================================
580{
581 if (Problem_->GetOperator() == 0 || Comm().MyPID() != 0)
582 return;
583
584 double ConTime = GetTime(MtxConvTime_);
585 double MatTime = GetTime(MtxRedistTime_);
586 double VecTime = GetTime(VecRedistTime_);
587 double SymTime = GetTime(SymFactTime_);
588 double NumTime = GetTime(NumFactTime_);
589 double SolTime = GetTime(SolveTime_);
590
592 SymTime /= NumSymbolicFact_;
593
594 if (NumNumericFact_)
595 NumTime /= NumNumericFact_;
596
597 if (NumSolve_)
598 SolTime /= NumSolve_;
599
600 std::string p = "Amesos_Pardiso : ";
601 PrintLine();
602
603 std::cout << p << "Time to convert matrix to Pardiso format = "
604 << ConTime << " (s)" << std::endl;
605 std::cout << p << "Time to redistribute matrix = "
606 << MatTime << " (s)" << std::endl;
607 std::cout << p << "Time to redistribute vectors = "
608 << VecTime << " (s)" << std::endl;
609 std::cout << p << "Number of symbolic factorizations = "
610 << NumSymbolicFact_ << std::endl;
611 std::cout << p << "Time for sym fact = "
612 << SymTime << " (s), avg = " << SymTime << " (s)" << std::endl;
613 std::cout << p << "Number of numeric factorizations = "
614 << NumNumericFact_ << std::endl;
615 std::cout << p << "Time for num fact = "
616 << NumTime << " (s), avg = " << NumTime << " (s)" << std::endl;
617 std::cout << p << "Number of solve phases = "
618 << NumSolve_ << std::endl;
619 std::cout << p << "Time for solve = "
620 << SolTime << " (s), avg = " << SolTime << " (s)" << std::endl;
621
622 PrintLine();
623
624 return;
625}
626
627// ======================================================================
628int Amesos_Pardiso::CheckError(const int error) const
629{
630 if (!error)
631 return 0;
632
633 std::cerr << "Amesos: PARDISO returned error code " << error << std::endl;
634 std::cerr << "Amesos: Related message from manual is:" << std::endl;
635
636 switch(error)
637 {
638 case -1:
639 std::cerr << "Input inconsistent" << std::endl;
640 break;
641 case -2:
642 std::cerr << "Not enough memory" << std::endl;
643 break;
644 case -3:
645 std::cerr << "Reordering problems" << std::endl;
646 break;
647 case -4:
648 std::cerr << "Zero pivot, numerical fact. or iterative refinement problem. " << std::endl;
649 break;
650 case -5:
651 std::cerr << "Unclassified (internal) error" << std::endl;
652 break;
653 case -6:
654 std::cerr << "Preordering failed (matrix types 11, 13 only)" << std::endl;
655 break;
656 case -7:
657 std::cerr << "Diagonal matrix problem." << std::endl;
658 break;
659 }
660
661 AMESOS_RETURN(error);
662}
#define AMESOS_CHK_ERRV(amesos_err)
#define AMESOS_CHK_ERR(a)
#define AMESOS_RETURN(amesos_err)
#define F77_PARDISO
#define F77_PARDISOINIT
#define IPARM(i)
void SetControlParameters(const Teuchos::ParameterList &ParameterList)
double AddToDiag_
Add this value to the diagonal.
Teuchos::RCP< Epetra_RowMatrix > SerialMatrix_
std::vector< int > ia_
~Amesos_Pardiso()
Destructor.
bool MatrixShapeOK() const
Returns true if PARDISO can handle this matrix shape.
Epetra_Import & Importer()
Amesos_Pardiso(const Epetra_LinearProblem &LinearProblem)
Constructor.
const Epetra_Comm & Comm() const
Returns a pointer to the Epetra_Comm communicator associated with this matrix.
const Epetra_LinearProblem * GetProblem() const
Get a pointer to the Problem.
int SetParameters(Teuchos::ParameterList &ParameterList)
Set parameters from the input parameters list, returns 0 if successful.
const Epetra_Map * Map_
Teuchos::RCP< Epetra_CrsMatrix > SerialCrsMatrix_
Teuchos::RCP< Epetra_Map > SerialMap_
const Epetra_RowMatrix * Matrix_
Epetra_RowMatrix & SerialMatrix()
int nrhs_
Output level.
const Epetra_Map & Map() const
int NumericFactorization()
Performs NumericFactorization on the matrix A.
int MtxConvTime_
Quick access pointers to the internal timing data.
std::vector< int > ja_
Epetra_Map & SerialMap()
bool UseTranspose_
If true, the transpose of A is used.
const Epetra_RowMatrix & Matrix() const
int msglvl_
Actual matrix for solution phase (always 1)
const Epetra_LinearProblem * Problem_
Pointer to the linear system problem.
bool UseTranspose() const
Returns the current UseTranspose setting.
int CheckError(const int error) const
double dparm_[64]
int Solve()
Solves A X = B (or AT X = B)
Teuchos::RCP< Epetra_Import > Importer_
int SymbolicFactorization()
Performs SymbolicFactorization on the matrix A.
std::vector< double > aa_
void PrintStatus() const
Prints information about the factorization and solution phases.
void PrintTiming() const
Prints timing information.
int PerformNumericFactorization()
Teuchos::ParameterList param_
Epetra_CrsMatrix & SerialCrsMatrix()
int PerformSymbolicFactorization()
int debug_
Sets the level of debug_ output.
bool PrintTiming_
If true, prints timing information in the destructor.
bool ComputeVectorNorms_
If true, prints the norms of X and B in Solve().
int verbose_
Toggles the output level.
int NumSymbolicFact_
Number of symbolic factorization phases.
bool IsNumericFactorizationOK_
If true, NumericFactorization() has been successfully called.
int NumSolve_
Number of solves.
bool ComputeTrueResidual_
If true, computes the true residual in Solve().
bool PrintStatus_
If true, print additional information in the destructor.
void SetStatusParameters(const Teuchos::ParameterList &ParameterList)
bool IsSymbolicFactorizationOK_
If true, SymbolicFactorization() has been successfully called.
int NumNumericFact_
Number of numeric factorization phases.
double GetTime(const std::string what) const
Gets the cumulative time using the string.
void ResetTimer(const int timerID=0)
Resets the internally stored time object.
Definition Amesos_Time.h:74
int AddTime(const std::string what, int dataID, const int timerID=0)
Adds to field what the time elapsed since last call to ResetTimer().
Definition Amesos_Time.h:80
void CreateTimer(const Epetra_Comm &Comm, int size=1)
Initializes the Time object.
Definition Amesos_Time.h:64
void ComputeTrueResidual(const Epetra_RowMatrix &Matrix, const Epetra_MultiVector &X, const Epetra_MultiVector &B, const bool UseTranspose, const std::string prefix) const
Computes the true residual, B - Matrix * X, and prints the results.
void ComputeVectorNorms(const Epetra_MultiVector &X, const Epetra_MultiVector &B, const std::string prefix) const
Computes the norms of X and B and print the results.
void PrintLine() const
Prints line on std::cout.