|
Amesos Package Browser (Single Doxygen Collection)
Development
|
Go to the documentation of this file.
33 #include "Trilinos_Util.h"
46 #ifdef HAVE_AMESOS_SUPERLU
49 #ifdef HAVE_AMESOS_SUPERLUDIST
52 #ifdef HAVE_AMESOS_SLUD
55 #ifdef HAVE_AMESOS_SLUS
58 #ifdef HAVE_AMESOS_SLUD2
64 #ifdef HAVE_AMESOS_DSCPACK
67 #ifdef HAVE_AMESOS_LAPACK
70 #ifdef HAVE_AMESOS_UMFPACK
73 #ifdef HAVE_AMESOS_KLU
76 #ifdef HAVE_AMESOS_SCALAPACK
79 #ifdef HAVE_AMESOS_TAUCS
82 #ifdef HAVE_AMESOS_PARDISO
85 #ifdef HAVE_AMESOS_PARAKLETE
88 #if defined(HAVE_AMESOS_MUMPS) && defined(HAVE_MPI)
131 std::string FileName = matrix_file ;
132 int FN_Size = FileName.size() ;
133 std::string LastFiveBytes = FileName.substr(
EPETRA_MAX(0,FN_Size-5), FN_Size );
134 std::string LastFourBytes = FileName.substr(
EPETRA_MAX(0,FN_Size-4), FN_Size );
135 bool NonContiguousMap =
false;
137 if ( LastFiveBytes ==
".triU" ) {
139 NonContiguousMap =
true;
140 EPETRA_CHK_ERR( Trilinos_Util_ReadTriples2Epetra( matrix_file,
false, Comm, readMap, readA, readx,
141 readb, readxexact, NonContiguousMap ) );
143 if ( LastFiveBytes ==
".triS" ) {
144 NonContiguousMap =
true;
146 EPETRA_CHK_ERR( Trilinos_Util_ReadTriples2Epetra( matrix_file,
true, Comm, readMap, readA, readx,
147 readb, readxexact, NonContiguousMap ) );
149 if ( LastFourBytes ==
".mtx" ) {
150 EPETRA_CHK_ERR( Trilinos_Util_ReadMatrixMarket2Epetra( matrix_file, Comm, readMap,
151 readA, readx, readb, readxexact) );
154 Trilinos_Util_ReadHb2Epetra( matrix_file, Comm, readMap, readA, readx,
165 serialA = &transposeA ;
181 if( NonContiguousMap ) {
186 int NumMyElements = map.NumMyElements();
187 int MyFirstElement = map.MinMyGID();
188 std::vector<int> MapMap_( NumGlobalElements );
190 Comm.
Broadcast( &MapMap_[0], NumGlobalElements, 0 ) ;
191 map_ =
new Epetra_Map( NumGlobalElements, NumMyElements, &MapMap_[MyFirstElement], 0, Comm);
201 assert( OriginalMap.
SameAs(*readMap) );
217 if ( distribute_matrix ) {
224 xexact.
Export(*readxexact, exporter,
Add);
227 A.Export(*serialA, exporter,
Add);
228 assert(
A.FillComplete()==0);
236 passxexact = &xexact;
245 passxexact = readxexact;
246 passresid = &readresid;
253 double Anorm = passA->
NormInf() ;
261 for (
int i = 0; i < 1+special ; i++ ) {
266 #ifdef HAVE_AMESOS_SUPERLUDIST
269 ParamList.
set(
"MaxProcs", -3 );
275 ParamList.
set(
"MaxProcs", -3 );
283 #ifdef HAVE_AMESOS_DSCPACK
284 }
else if ( SparseSolver ==
DSCPACK ) {
287 ParamList.
set(
"MaxProcs", -3 );
295 #ifdef HAVE_AMESOS_SCALAPACK
296 }
else if ( SparseSolver ==
SCALAPACK ) {
300 ParamList.
set(
"MaxProcs", -3 );
308 #ifdef HAVE_AMESOS_TAUCS
309 }
else if ( SparseSolver ==
TAUCS ) {
313 ParamList.
set(
"MaxProcs", -3 );
321 #ifdef HAVE_AMESOS_PARDISO
322 }
else if ( SparseSolver ==
PARDISO ) {
326 ParamList.
set(
"MaxProcs", -3 );
334 #ifdef HAVE_AMESOS_PARAKLETE
335 }
else if ( SparseSolver ==
PARAKLETE ) {
339 ParamList.
set(
"MaxProcs", -3 );
347 #if defined(HAVE_AMESOS_MUMPS) && defined(HAVE_MPI)
348 }
else if ( SparseSolver ==
MUMPS ) {
352 ParamList.
set(
"MaxProcs", -3 );
360 #ifdef HAVE_AMESOS_SUPERLU
361 }
else if ( SparseSolver ==
SUPERLU ) {
365 ParamList.
set(
"MaxProcs", -3 );
373 #ifdef HAVE_AMESOS_LAPACK
374 }
else if ( SparseSolver ==
LAPACK ) {
378 ParamList.
set(
"MaxProcs", -3 );
385 #ifdef HAVE_AMESOS_UMFPACK
386 }
else if ( SparseSolver ==
UMFPACK ) {
390 ParamList.
set(
"MaxProcs", -3 );
397 #ifdef HAVE_AMESOS_KLU
398 }
else if ( SparseSolver ==
KLU ) {
404 int setupTimePtr = -1, symTimePtr = -1, numTimePtr = -1, refacTimePtr = -1, solveTimePtr = -1;
411 ParamList.
set(
"MaxProcs", -3 );
412 ParamList.
set(
"TrustMe",
false );
416 setupTimePtr = AT.
AddTime(
"Setup", setupTimePtr, 0);
418 symTimePtr = AT.
AddTime(
"Symbolic", symTimePtr, 0);
420 numTimePtr = AT.
AddTime(
"Numeric", numTimePtr, 0);
422 refacTimePtr = AT.
AddTime(
"Refactor", refacTimePtr, 0);
425 solveTimePtr = AT.
AddTime(
"Solve", solveTimePtr, 0);
427 double SetupTime = AT.
GetTime(setupTimePtr);
428 double SymbolicTime = AT.
GetTime(symTimePtr);
429 double NumericTime = AT.
GetTime(numTimePtr);
430 double RefactorTime = AT.
GetTime(refacTimePtr);
431 double SolveTime = AT.
GetTime(solveTimePtr);
433 std::cout << __FILE__ <<
"::" << __LINE__ <<
" SetupTime = " << SetupTime << std::endl ;
434 std::cout << __FILE__ <<
"::" << __LINE__ <<
" SymbolicTime = " << SymbolicTime - SetupTime << std::endl ;
435 std::cout << __FILE__ <<
"::" << __LINE__ <<
" NumericTime = " << NumericTime - SymbolicTime<< std::endl ;
436 std::cout << __FILE__ <<
"::" << __LINE__ <<
" RefactorTime = " << RefactorTime - NumericTime << std::endl ;
437 std::cout << __FILE__ <<
"::" << __LINE__ <<
" SolveTime = " << SolveTime - RefactorTime << std::endl ;
442 std::cerr <<
"\n\n#################### Requested solver not available on this platform ##################### ATS\n" << std::endl ;
443 std::cout <<
" SparseSolver = " << SparseSolver << std::endl ;
444 std::cerr <<
" SparseSolver = " << SparseSolver << std::endl ;
454 passresid->
Update(1.0, *passx, -1.0, *passxexact, 0.0);
467 passA->
Multiply( transpose, *passx, *passtmp);
468 passresid->
Update(1.0, *passtmp, -1.0, *passb, 0.0);
470 passresid->
Norm2(&residual);
475 passb->
Norm2( &bnorm ) ;
479 passx->
Norm2( &xnorm ) ;
int NumericFactorization()
Performs NumericFactorization on the matrix A.
#define EPETRA_CHK_ERR(xxx)
int SetParameters(Teuchos::ParameterList &ParameterList)
Set parameters from the input parameters list, returns 0 if successful.
int SetUseTranspose(bool UseTranspose)
Amesos_Superludist does not support transpose at this time.
int SymbolicFactorization()
Performs SymbolicFactorization on the matrix A.
int NumericFactorization()
Performs NumericFactorization on the matrix A.
int NumericFactorization()
Performs NumericFactorization on the matrix A.
int SymbolicFactorization()
Performs SymbolicFactorization on the matrix A.
Amesos_Klu: A serial, unblocked code ideal for getting started and for very sparse matrices,...
int SymbolicFactorization()
Performs SymbolicFactorization on the matrix A.
int Solve()
Solves A X = B (or AT x = B)
int Amesos_TestSolver(Epetra_Comm &Comm, char *matrix_file, SparseSolverType SparseSolver, bool transpose, int special, AMESOS_MatrixType matrix_type)
int NumericFactorization()
Performs NumericFactorization on the matrix A.
int NumericFactorization()
Performs NumericFactorization on the matrix A.
int SetUseTranspose(bool useTheTranspose)
If set true, X will be set to the solution of AT X = B (not A X = B)
virtual int Broadcast(double *MyVals, int Count, int Root) const=0
int SetUseTranspose(bool UseTranspose_in)
If set true, X will be set to the solution of AT X = B (not A X = B)
double GetTime(const std::string what) const
Gets the cumulative time using the string.
virtual void Barrier() const=0
int SetParameters(Teuchos::ParameterList &ParameterList)
Updates internal variables.
int SetParameters(Teuchos::ParameterList &ParameterList)
Updates internal variables.
int AddTime(const std::string what, int dataID, const int timerID=0)
Adds to field what the time elapsed since last call to ResetTimer().
virtual double NormInf() const=0
int NumericFactorization()
Performs NumericFactorization on the matrix A.
int NumGlobalElements() const
Class Amesos_Umfpack: An object-oriented wrapper for UMFPACK.
int Solve()
Solves A X = B (or AT x = B)
void Set_Anorm(double anorm_in)
int SymbolicFactorization()
Performs SymbolicFactorization on the matrix A.
int NumericFactorization()
Performs NumericFactorization on the matrix A.
int SetParameters(Teuchos::ParameterList &ParameterList)
Updates internal variables.
void Set_Xnorm(double xnorm_in)
int Export(const Epetra_SrcDistObject &A, const Epetra_Import &Importer, Epetra_CombineMode CombineMode, const Epetra_OffsetIndex *Indexor=0)
int SetUseTranspose(bool UseTranspose_in)
If set true, X will be set to the solution of AT X = B (not A X = B)
int SymbolicFactorization()
Performs SymbolicFactorization on the matrix A.
Amesos_Scalapack: A serial and parallel dense solver. For now, we implement only the unsymmetric ScaL...
ParameterList & set(std::string const &name, T const &value, std::string const &docString="", RCP< const ParameterEntryValidator > const &validator=null)
Amesos_Lapack: an interface to LAPACK.
Amesos_Dscpack: An object-oriented wrapper for Dscpack.
const Epetra_Map & RowMatrixRowMap() const
RCP< ParameterList > sublist(const RCP< ParameterList > ¶mList, const std::string &name, bool mustAlreadyExist=false, const std::string &docString="")
int SymbolicFactorization()
Performs SymbolicFactorization on the matrix A.
int SetParameters(Teuchos::ParameterList &ParameterList)
Updates internal variables.
int Norm2(double *Result) const
int NumericFactorization()
Performs NumericFactorization on the matrix A.
Amesos_Superludist: An object-oriented wrapper for Superludist.
int SetParameters(Teuchos::ParameterList &ParameterList)
Updates internal variables.
int Solve()
Solves A X = B (or AT x = B)
int Solve()
Solves A X = B (or AT X = B)
int SymbolicFactorization()
Performs SymbolicFactorization on the matrix A.
int SetUseTranspose(bool UseTranspose)
SetUseTranpose()
int MyGlobalElements(int *MyGlobalElementList) const
int SymbolicFactorization()
Performs SymbolicFactorization on the matrix A.
static SparseSolverResult SS_Result
bool SameAs(const Epetra_BlockMap &Map) const
void CreateTimer(const Epetra_Comm &Comm, int size=1)
Initializes the Time object.
int Solve()
Solves A X = B (or AT x = B)
int NumericFactorization()
Performs NumericFactorization on the matrix A.
Amesos_Mumps: An object-oriented wrapper for the double precision version of MUMPS.
int CrsMatrixTranspose(Epetra_CrsMatrix *In, Epetra_CrsMatrix *Out)
Amesos_Taucs: An interface to the TAUCS package.
int SetParameters(Teuchos::ParameterList &ParameterList)
Updates internal variables.
void Set_Total_Time(double Total_Time_in)
int SetParameters(Teuchos::ParameterList &ParameterList)
Deprecated - Sets parameters.
int SetParameters(Teuchos::ParameterList &ParameterList)
Updates internal variables.
int SymbolicFactorization()
Performs SymbolicFactorization on the matrix A.
int Solve()
Solves A X = B (or AT x = B)
int SetUseTranspose(bool UseTranspose)
SetUseTranpose(true) is more efficient in Amesos_Scalapack.
int SetParameters(Teuchos::ParameterList &ParameterList)
Updates internal variables.
int Solve()
Solves A X = B (or AT x = B)
int SetParameters(Teuchos::ParameterList &ParameterList)
Updates internal variables.
int SymbolicFactorization()
Performs SymbolicFactorization on the matrix A.
double ElapsedTime(void) const
int SetUseTranspose(bool UseTranspose_in)
If set true, X will be set to the solution of AT X = B (not A X = B)
Amesos_Paraklete: A serial, unblocked code ideal for getting started and for very sparse matrices,...
void Set_Bnorm(double bnorm_in)
static std::ofstream log_file
int NumericFactorization()
Performs NumericFactorization on the matrix A.
int Solve()
Solves A X = B (or AT X = B)
int SetUseTranspose(bool UseTranspose_in)
SetUseTranpose()
void ResetTimer(const int timerID=0)
Resets the internally stored time object.
Amesos_Superlu: Amesos interface to Xioye Li's SuperLU 3.0 serial code.
Amesos_Time: Container for timing information.
int Solve()
Solves A X = B (or AT x = B)
int Solve()
Solves A X = B (or AT x = B)
int SetUseTranspose(bool UseTranspose_in)
SetUseTranpose(true) is more efficient in Amesos_Klu.
int SetUseTranspose(bool UseTranspose)
Amesos_Taucs supports only symmetric matrices, hence transpose is irrelevant, but harmless.
void Set_Error(double error_in)
int SymbolicFactorization()
Performs SymbolicFactorization on the matrix A.
int NumericFactorization()
Performs NumericFactorization on the matrix A.
virtual int Multiply(bool TransA, const Epetra_MultiVector &X, Epetra_MultiVector &Y) const=0
Amesos_Pardiso: Interface to the PARDISO package.
int Solve()
Solves A X = B (or AT x = B)
int Update(double ScalarA, const Epetra_MultiVector &A, double ScalarThis)
void Set_Residual(double residual_in)