13 const std::vector<bool> AmesosClassesInstalled,
28 double &maxrelresidual,
31 assert( NumTests == 0 ) ;
33 bool RowMapEqualsColMap = ( ReindexColMap == 0 ) ;
36 std::string StringFilename = filename ;
37 bool bcsstk04 = ( StringFilename.find(
"bcsstk04") < StringFilename.find(
"xdz_notaname_garbage") );
38 bool Khead = ( StringFilename.find(
"Khead") < StringFilename.find(
"xdz_notaname_garbage") );
39 bool Superlu_rua = ( StringFilename.find(
"Superlu") < StringFilename.find(
"xdz_notaname_garbage") );
40 bool ImpcolB = ( StringFilename.find(
"ImpcolB") < StringFilename.find(
"xdz_notaname_garbage") );
41 bool a662_bus_out = ( StringFilename.find(
"662_bus_out") < StringFilename.find(
"xdz_notaname_garbage") );
42 bool MissingADiagonal = ( StringFilename.find(
"MissingADiagonal") < StringFilename.find(
"xdz_notaname_garbage") ) ||
43 ( StringFilename.find(
"ImpcolB.rua") < StringFilename.find(
"xdz_notaname_garbage") );
44 bool FileIsDiagonal = ( StringFilename.find(
"Diagonal") < StringFilename.find(
"xdz_notaname_garbage") ) &&
47 bool NumericallySingular = ( StringFilename.find(
"NumericallySingular") < StringFilename.find(
"xdz_notaname_garbage") );
48 bool StructurallySingular = ( StringFilename.find(
"StructurallySingular") < StringFilename.find(
"xdz_notaname_garbage") );
50 int ExpectedError = 0;
59 if ( ( ReindexRowMap != 0 || ReindexColMap != 0 ) && EpetraMatrixType == 1 )
64 bool ReIndex = ReindexRowMap || ReindexColMap ;
67 if ( AmesosClassesInstalled[i] ) {
69 int NumTheseTests = 0 ;
71 if ( verbose && ( ! ReIndex ) ) {
73 std::cout <<
"TestAllClasses.cpp::" << __LINE__
74 <<
" Perhaps about to test "
75 << AmesosClasses[i] <<
" "
76 <<
" EMT=" << EpetraMatrixType
77 <<
" tr=" << transpose
78 <<
" sym=" << symmetric
81 <<
" RRM= " << ReindexRowMap
82 <<
" RCM= " << ReindexColMap
83 <<
" DMT= " << DomainMapType
84 <<
" RMT= " << RangeMapType
85 <<
" d=" << distribute
86 <<
" fn= " << filename
90 if ( AmesosClasses[i] ==
"Amesos_Scalapack") {
91 bool RunScalapackTest =
true;
92 if ( ExpectedError != 0 ) RunScalapackTest = false ;
93 if ( ReindexRowMap || ReindexColMap ) RunScalapackTest = false ;
94 if ( ( RangeMapType != 0 || DomainMapType != 0 ) )
95 RunScalapackTest =
false ;
96 if ( RunScalapackTest && verbose) std::cout <<
" Testing SCALAPACK " << std::endl ;
107 }
else if ( AmesosClasses[i] ==
"Amesos_Umfpack" ) {
108 bool RunUmfpackTest =
true;
109 if ( ( ReindexRowMap != 0 || ReindexColMap != 0 ) && row_map.
DistributedGlobal() )
110 RunUmfpackTest =
false ;
111 if ( ( RangeMapType != 0 || DomainMapType != 0 ) )
112 RunUmfpackTest =
false ;
113 if ( ExpectedError != 0 ) RunUmfpackTest = false ;
115 if ( RunUmfpackTest && verbose) std::cout <<
" Testing UMFPACK " << std::endl ;
134 }
else if ( AmesosClasses[i] ==
"Amesos_Klu" ) {
135 bool RunKluTest =
true;
137 if ( ( verbose && ( ReIndex ) ) {
139 std::cout << __FILE__ <<
"::" << __LINE__
140 <<
" Perhaps about to test "
141 << AmesosClasses[i] <<
" "
142 <<
" EpetraMatrixType = " << EpetraMatrixType
143 <<
" transpose = " << transpose
144 <<
" symmetric = " << symmetric
145 <<
" Levels = " << Levels
146 <<
" Diagonal = " << Diagonal
147 <<
" ReindexRowMap = " << ReindexRowMap
148 <<
" ReindexColMap = " << ReindexColMap
149 <<
" DomainMapType = " << DomainMapType
150 <<
" RangeMapType = " << RangeMapType
151 <<
" distribute = " << distribute
152 <<
" filename = " << filename
155 if ( ( ReindexRowMap != 0 || ReindexColMap != 0 ) && row_map.
DistributedGlobal() )
157 if ( ( ReindexColMap != 0 ) )
159 if ( ( RangeMapType != 0 || DomainMapType != 0 ) )
161 if ( ExpectedError != 0 ) RunUmfpackTest = false ;
166 if ( RunKluTest && verbose) std::cout <<
" Testing KLU " << std::endl ;
182 }
else if ( AmesosClasses[i] ==
"Amesos_Lapack" ) {
183 bool RunLapackTest =
true;
185 if ( ( ReindexRowMap != 0 || ReindexColMap != 0 ) && row_map.
DistributedGlobal() )
186 RunLapackTest =
false ;
188 if ( RunLapackTest && verbose) std::cout <<
" Testing LAPACK " << std::endl ;
203 }
else if ( AmesosClasses[i] ==
"Amesos_Taucs" ) {
204 bool RunTaucsTest =
true;
205 if ( ExpectedError != 0 ) RunTaucsTest = false ;
206 if ( ( ReindexRowMap != 0 || ReindexColMap != 0 ) )
207 RunTaucsTest = false ;
208 if ( ( RangeMapType != 0 || DomainMapType != 0 ) )
209 RunTaucsTest = false ;
212 if ( a662_bus_out) RunTaucsTest = false ;
213 if ( ! symmetric ) RunTaucsTest = false ;
214 if ( Khead ) RunTaucsTest = false ;
216 if ( RunTaucsTest && verbose) std::cout <<
" Testing TAUCS " << std::endl ;
233 }
else if ( AmesosClasses[i] ==
"Amesos_Pardiso" ) {
234 bool RunPardisoTest =
true;
235 if ( ExpectedError != 0 ) RunPardisoTest = false ;
236 if ( ReindexRowMap != 0 || ReindexColMap != 0 )
237 RunPardisoTest = false ;
238 if ( ( RangeMapType != 0 || DomainMapType != 0 ) )
239 RunPardisoTest = false ;
240 if ( bcsstk04 ) RunPardisoTest = false ;
241 if ( a662_bus_out ) RunPardisoTest = false ;
242 if ( transpose ) RunPardisoTest = false ;
243 if ( MissingADiagonal ) RunPardisoTest = false ;
244 if ( Khead ) RunPardisoTest = false ;
245 if ( EpetraMatrixType == 1 ) RunPardisoTest = false ;
246 if ( distribute ) RunPardisoTest = false ;
247 if ( RunPardisoTest && verbose) std::cout <<
" Testing PARDISO " << std::endl ;
248 if ( Amat->
Comm().
NumProc() > 1 ) RunPardisoTest =
false ;
264 }
else if ( AmesosClasses[i] ==
"Amesos_Mumps" ) {
265 bool RunMumpsTest =
true;
266 if ( ExpectedError != 0 ) RunMumpsTest = false ;
267 if ( ( ReindexRowMap || ReindexColMap ) )
268 RunMumpsTest = false ;
269 if ( ( RangeMapType != 0 || DomainMapType != 0 ) ) RunMumpsTest = false ;
270 if ( MissingADiagonal ) RunMumpsTest = false ;
271 if ( distribute ) RunMumpsTest = false ;
272 if ( RunMumpsTest && verbose) std::cout <<
" Testing MUMPS " << std::endl ;
288 }
else if ( AmesosClasses[i] ==
"Amesos_Klu" ) {
289 bool RunKluTest =
true;
290 if ( ( ReindexColMap != 0 ) )
296 if ( ReindexRowMap != 0 ) ParamList.
set(
"Reindex",
true );
297 if ( ( RangeMapType != 0 || DomainMapType != 0 || distribute ) )
298 ParamList.
set(
"DontTrustMe",
true );
299 #ifndef HAVE_AMESOS_EPETRAEXT
300 if ( ( ReindexRowMap || ReindexColMap ) )
303 if ( ImpcolB ) RunKluTest = false ;
304 if ( ( RangeMapType ==2 && DomainMapType == 1 && distribute == 1 && EpetraMatrixType == 2 && transpose == 0 && Superlu_rua ) ) RunKluTest = false ;
306 if ( RunKluTest && verbose) std::cout <<
" Testing KLU " << std::endl ;
307 if ( RunKluTest && verbose) std::cout <<
" Testing KLU ExpectedError = "
308 << ExpectedError << std::endl ;
310 if ( RunKluTest ) Errors =
TestKlu( Amat,
324 if ( Amat->
Comm().
MyPID() == 0 && Errors )
325 std::cout <<
" FAILURE in "
326 << __FILE__ <<
"::" << __LINE__
328 <<
" EpetraMatrixType = " << EpetraMatrixType
329 <<
" transpose = " << transpose
330 <<
" symmetric = " << symmetric
331 <<
" Levels = " << Levels
332 <<
" Diagonal = " << Diagonal
333 <<
" ReindexRowMap = " << ReindexRowMap
334 <<
" ReindexColMap = " << ReindexColMap
335 <<
" DomainMapType = " << DomainMapType
336 <<
" RangeMapType = " << RangeMapType
337 <<
" distribute = " << distribute
338 <<
" filename = " << filename
339 <<
" NumTheseTests = " << NumTheseTests
340 <<
" Errors = " << Errors << std::endl ;
342 }
else if ( AmesosClasses[i] ==
"Amesos_Superlu" ) {
343 bool RunSuperluTest =
true;
344 if ( ExpectedError != 0 ) RunSuperluTest = false ;
345 if ( ( ReindexRowMap != 0 || ReindexColMap != 0 ) && Amat->
Comm().
NumProc() > 1 )
346 RunSuperluTest =
false ;
347 if ( MissingADiagonal ) RunSuperluTest = false ;
348 if ( ( RangeMapType != 0 || DomainMapType != 0 ) ) RunSuperluTest =
false ;
349 if ( bcsstk04 && transpose ) RunSuperluTest = false ;
350 if ( a662_bus_out && transpose ) RunSuperluTest = false ;
351 if ( Khead ) RunSuperluTest= false ;
353 if ( RunSuperluTest ) {
354 if ( verbose) std::cout <<
" Testing SUPERLU " << std::endl ;
369 if ( Amat->
Comm().
MyPID() == 0 && Errors )
370 std::cout <<
" FAILURE in "
371 << __FILE__ <<
"::" << __LINE__
373 <<
" EpetraMatrixType = " << EpetraMatrixType
374 <<
" transpose = " << transpose
375 <<
" symmetric = " << symmetric
376 <<
" Levels = " << Levels
377 <<
" Diagonal = " << Diagonal
378 <<
" ReindexRowMap = " << ReindexRowMap
379 <<
" ReindexColMap = " << ReindexColMap
380 <<
" DomainMapType = " << DomainMapType
381 <<
" RangeMapType = " << RangeMapType
382 <<
" distribute = " << distribute
383 <<
" filename = " << filename
384 <<
" NumTheseTests = " << NumTheseTests
385 <<
" Errors = " << Errors << std::endl ;
387 }
else if ( AmesosClasses[i] ==
"Amesos_Paraklete" ) {
390 if ( verbose && ( ReIndex ) ) {
392 std::cout << __FILE__ <<
"::" << __LINE__
393 <<
" Perhaps about to test "
394 << AmesosClasses[i] <<
" "
395 <<
" EpetraMatrixType = " << EpetraMatrixType
396 <<
" transpose = " << transpose
397 <<
" symmetric = " << symmetric
398 <<
" Levels = " << Levels
399 <<
" Diagonal = " << Diagonal
400 <<
" ReindexRowMap = " << ReindexRowMap
401 <<
" ReindexColMap = " << ReindexColMap
402 <<
" DomainMapType = " << DomainMapType
403 <<
" RangeMapType = " << RangeMapType
404 <<
" distribute = " << distribute
405 <<
" filename = " << filename
408 bool RunParakleteTest =
true;
409 if ( ExpectedError != 0 ) RunParakleteTest = false ;
410 if ( ( ReindexColMap != 0 ) )
411 RunParakleteTest =
false ;
413 if ( ( RangeMapType != 0 || DomainMapType != 0 ) ) RunParakleteTest =
false ;
415 if ( ReindexRowMap != 0 ) ParamList.
set(
"Reindex",
true );
416 if ( ( RangeMapType != 0 || DomainMapType != 0 || distribute ) )
417 ParamList.
set(
"DontTrustMe",
true );
418 #ifdef HAVE_AMESOS_EPETRAEXT
419 if ( ! transpose && EpetraMatrixType != 0 ) RunParakleteTest = false ;
421 if ( ! transpose ) RunParakleteTest = false ;
423 #ifndef HAVE_AMESOS_EPETRAEXT
424 if ( ( ReindexRowMap || ReindexColMap ) )
425 RunParakleteTest = false ;
427 if ( FileIsDiagonal )
428 RunParakleteTest = false ;
431 if ( RunParakleteTest ) {
432 if ( verbose) std::cout <<
" Testing Paraklete " << std::endl ;
447 }
else if ( AmesosClasses[i] ==
"Amesos_Dscpack" ) {
451 const int sym_int = symmetric?0:1 ;
452 int sym_int_out = sym_int;
454 assert( sym_int == sym_int_out ) ;
456 bool RunDscpackTest =
true;
457 if ( ExpectedError != 0 ) RunDscpackTest = false ;
458 if ( ! symmetric ) RunDscpackTest = false ;
459 if ( ( ReindexRowMap != 0 || ReindexColMap != 0 ) )
460 RunDscpackTest = false ;
461 if ( ( RangeMapType != 0 || DomainMapType != 0 ) ) RunDscpackTest = false ;
462 if ( Khead ) RunDscpackTest = false ;
465 if ( RunDscpackTest ) {
466 if ( verbose) std::cout <<
" Testing DSCPACK " << std::endl ;
482 }
else if ( AmesosClasses[i] ==
"Amesos_Superludist" ) {
483 bool RunSuperludistTest =
true;
484 if ( ExpectedError != 0 ) RunSuperludistTest = false ;
486 RunSuperludistTest = false ;
488 if ( ReindexRowMap || ReindexColMap ) RunSuperludistTest = false ;
489 if ( ( RangeMapType != 0 || DomainMapType != 0 ) ) RunSuperludistTest = false ;
491 if ( Khead ) RunSuperludistTest= false ;
492 if ( RunSuperludistTest ) {
493 if ( verbose) std::cout <<
" Testing Superludist " << std::endl ;
508 if ( Errors || ( verbose && NumTheseTests > 0 ) ) {
510 std::cout <<
" FAILURE in " ;
512 std::cout <<
" NO FAILURE in " ;
515 std::cout <<
"TestAllClasses.cpp::" << __LINE__
516 << AmesosClasses[i] <<
" "
517 <<
" EMT=" << EpetraMatrixType
518 <<
" tr=" << transpose
519 <<
" sym=" << symmetric
522 <<
" RRM= " << ReindexRowMap
523 <<
" RCM= " << ReindexColMap
524 <<
" DMT= " << DomainMapType
525 <<
" RMT= " << RangeMapType
526 <<
" d=" << distribute
527 <<
" fn= " << filename
532 NumTests += NumTheseTests ;
536 if ( verbose) std::cout <<
" TestAllClasses errors = " << errors << std::endl ;
Amesos_Klu: A serial, unblocked code ideal for getting started and for very sparse matrices...
bool DistributedGlobal() const
ParameterList & set(std::string const &name, T const &value, std::string const &docString="", RCP< const ParameterEntryValidator > const &validator=null)
virtual int MyPID() const =0
const Epetra_Map & RowMap() const
int TestAllClasses(const std::vector< std::string > AmesosClasses, int EpetraMatrixType, const std::vector< bool > AmesosClassesInstalled, Epetra_CrsMatrix *&Amat, const bool transpose, const bool verbose, const bool symmetric, const int Levels, const double Rcond, int Diagonal, int ReindexRowMap, int ReindexColMap, int RangeMapType, int DomainMapType, bool distribute, const char *filename, double &maxrelerror, double &maxrelresidual, int &NumTests)
virtual int Broadcast(double *MyVals, int Count, int Root) const =0
virtual int NumProc() const =0
const int NumericallySingularMatrixError
int TestSuperludist(Epetra_CrsMatrix *&Amat, int EpetraMatrixType, bool transpose, bool verbose, int Levels, const double Rcond, double &maxrelerror, double &maxrelresidual, const char *filename, int &NumTests)
const int StructurallySingularMatrixError
int TestKlu(Epetra_CrsMatrix *&Amat, int EpetraMatrixType, const bool transpose, const bool verbose, const int Levels, const double Rcond, Teuchos::ParameterList ParamList, bool RowMapEqualsColMap, bool TestAddZeroToDiag, int ExpectedError, double &maxrelerror, double &maxrelresidual, int &NumTests)
int TestScalapack(Epetra_CrsMatrix *&Amat, int EpetraMatrixType, bool transpose, bool verbose, int Levels, const double Rcond, double &maxrelerror, double &maxrelresidual, int &NumTests)
const Epetra_Comm & Comm() const
int TestOtherClasses(const char *AmesosClass, int EpetraMatrixType, Epetra_CrsMatrix *&Amat, const bool transpose, const bool verbose, const int Levels, const double Rcond, bool RowMapEqualsColMap, bool TestAddZeroToDiag, int ExpectedError, double &maxrelerror, double &maxrelresidual, int &NumTests)
std::vector< string > AmesosClasses