46 #include "az_aztec_defs.h" 50 std::string _matrixFile
54 ,
double _maxSolutionError
55 ,
double _maxSlackErrorFrac
58 ,
double _maxPrecSolutionError
59 ,
double _maxPrecSlackErrorFrac
84 int main(
int argc,
char* argv[])
91 bool result, success =
true;
102 std::string matrixDir =
".";
103 int numRandomVectors = 1;
104 bool showAllTests =
false;
105 bool showAllTestsDetails =
false;
106 bool dumpAll =
false;
107 std::string aztecOutputLevel =
"freq";
108 int aztecOutputFreq = 0;
110 CommandLineProcessor clp(
false);
111 clp.setOption(
"matrix-dir", &matrixDir,
"Base directory for the test matrices" );
112 clp.setOption(
"num-random-vectors", &numRandomVectors,
"Number of times a test is performed with different random vectors." );
113 clp.setOption(
"verbose",
"quiet", &verbose,
"Set if output is printed or not." );
114 clp.setOption(
"show-all-tests",
"no-show-all-tests", &showAllTests,
"Set if all the tests are shown or not." );
115 clp.setOption(
"show-all-tests-details",
"no-show-all-tests-details", &showAllTestsDetails,
"Set if all the details of the tests are shown or not." );
116 clp.setOption(
"dump-all",
"no-dump-all", &dumpAll,
"Determines if vectors are printed or not." );
117 clp.setOption(
"aztec-output-level", &aztecOutputLevel,
"Aztec output level (freq,last,summary,warnings,all)" );
118 clp.setOption(
"aztec-output-freq", &aztecOutputFreq,
"Aztec output freqency (> 0)" );
119 CommandLineProcessor::EParseCommandLineReturn parse_return = clp.parse(argc,argv);
120 if( parse_return != CommandLineProcessor::PARSE_SUCCESSFUL )
return parse_return;
128 const int numTestMatrices = 9;
134 const MTP testMatrices[numTestMatrices] =
136 MTP(
"bcsstk01.mtx" ,1e-12, 40 , 1e-4, 0.6, 1.0, 20 , 1e-10, 0.5, 1.0)
137 ,MTP(
"bcsstk02.mtx" ,1e-12, 40 , 1e-3, 0.5, 1.0, 2 , 1e-10, 0.5, 1.0)
138 ,MTP(
"bcsstk04.mtx" ,1e-12, 80 , 1e-4, 0.999990, 1.0, 40 , 1e-10, 0.999990, 1.0)
139 ,MTP(
"Diagonal.mtx" ,1e-12, 4 , 1e-6, 1e-14, 1.0, 2 , 1e-10, 1e-14, 1.0)
140 ,MTP(
"FourByFour.mtx" ,1e-12, 4 , 1e-6, 1e-14, 1.0, 2 , 1e-10, 1e-14, 1.0)
141 ,MTP(
"KheadK.mtx" ,1e-12, 8 , 1e-6, 1e-14, 1.0, 2 , 1e-10, 1e-14, 1.0)
142 ,MTP(
"KheadSorted.mtx" ,1e-12, 8 , 1e-6, 1e-14, 1.0, 2 , 1e-10, 1e-14, 1.0)
143 ,MTP(
"nos1.mtx" ,1e-11, 200, 1e-4, 0.8, 1.0, 237, 1e-2, 5.0, 1.0)
144 ,MTP(
"nos5.mtx" ,1e-12, 468, 1e-5, 0.5, 1.0, 468, 1e-10, 0.5, 1.0)
149 for(
int matrix_i = 0; matrix_i < numTestMatrices; ++matrix_i ) {
151 mtp = testMatrices[matrix_i];
155 for(
int prec_i = 0; prec_i < 2; ++prec_i ) {
157 out << std::endl<<matrix_i<<
":"<<prec_i<<
": Testing, matrixFile=\'"<<mtp.
matrixFile<<
"\', ";
163 paramList(
"AztecOOLinearOpWithSolveFactory");
165 &fwdSolvePL = paramList.
sublist(
"Forward Solve"),
166 &adjSolvePL = paramList.
sublist(
"Adjoint Solve");
168 &fwdAztecOOPL = fwdSolvePL.
sublist(
"AztecOO Settings"),
169 &adjAztecOOPL = adjSolvePL.sublist(
"AztecOO Settings");
170 if( aztecOutputLevel !=
"freq" ) {
171 fwdAztecOOPL.
set(
"Output Frequency",aztecOutputLevel);
172 adjAztecOOPL.
set(
"Output Frequency",aztecOutputLevel);
175 fwdAztecOOPL.
set(
"Output Frequency",aztecOutputFreq);
176 adjAztecOOPL.
set(
"Output Frequency",aztecOutputFreq);
179 out <<
"no aztec preconditioning ... ";
180 fwdAztecOOPL.
set(
"Aztec Preconditioner",
"none");
181 testTranspose =
true;
189 out <<
"using aztec preconditioning ... ";
190 fwdAztecOOPL.
set(
"Aztec Preconditioner",
"ilu");
191 testTranspose =
false;
198 std::ostringstream oss;
202 matrixDir+
"/"+mtp.
matrixFile,testTranspose,numRandomVectors
204 ,showAllTestsDetails,dumpAll,¶mList,&fancy_oss
206 if(!result) success =
false;
210 out << std::endl << oss.str();
212 out <<
" : passed!\n";
216 out << std::endl << oss.str();
218 out <<
" : failed!\n";
225 catch(
const std::exception &excpt ) {
226 std::cerr <<
"*** Caught standard exception : " << excpt.what() << std::endl;
230 std::cerr <<
"*** Caught an unknown exception\n";
235 if(success) out <<
"\nCongratulations! All of the tests checked out!\n";
236 else out <<
"\nOh no! At least one of the tests failed!\n";
239 return ( success ? 0 : 1 );
ParameterList & set(std::string const &name, T const &value, std::string const &docString="", RCP< const ParameterEntryValidator > const &validator=null)
RCP< ParameterList > sublist(const RCP< ParameterList > ¶mList, const std::string &name, bool mustAlreadyExist=false, const std::string &docString="")
TEUCHOS_DEPRECATED RCP< T > rcp(T *p, Dealloc_T dealloc, bool owns_mem)
double maxPrecSolutionError
bool test_single_aztecoo_thyra_solver(const std::string matrixFile, const bool testTranspose, const int numRandomVectors, const double maxFwdError, const double maxResid, const double maxSolutionError, const bool showAllTests, const bool dumpAll, Teuchos::ParameterList *paramList, Teuchos::FancyOStream *out)
Testing function for a single aztecoo solver with a single matrix.
double maxPrecSlackErrorFrac
MatrixTestPacket(std::string _matrixFile, double _maxFwdError, int _maxIters, double _maxResid, double _maxSolutionError, double _maxSlackErrorFrac, int _maxPrecIters, double _maxPrecResid, double _maxPrecSolutionError, double _maxPrecSlackErrorFrac)
int main(int argc, char *argv[])
#define TEUCHOS_TEST_FOR_EXCEPT(throw_exception_test)