14 #include "Tpetra_Core.hpp"
18 int main(
int argc,
char* argv[])
26 Tpetra::ScopeGuard tpetraScope(&argc, &argv);
27 auto comm = Tpetra::getDefaultComm();
30 out = Teuchos::VerboseObjectBase::getDefaultOStream();
38 std::string matrixFile =
"";
39 std::string solverType =
"";
41 int numRandomVectors = 1;
42 double maxFwdError = 1e-14;
43 int outputFrequency = 10;
44 bool outputMaxResOnly =
true;
45 double maxResid = 1e-6;
46 double maxSolutionError = 1e-6;
50 CommandLineProcessor clp;
51 clp.throwExceptions(
false);
52 clp.addOutputSetupOptions(
true);
53 clp.setOption(
"matrix-file", &matrixFile,
"Matrix input file [Required]." );
54 clp.setOption(
"solver-type", &solverType,
"Type of solver to use [Required]." );
55 clp.setOption(
"num-rhs", &numRhs,
"Number of RHS in linear solve." );
56 clp.setOption(
"num-random-vectors", &numRandomVectors,
"Number of times a test is performed with different random vectors." );
57 clp.setOption(
"max-fwd-error", &maxFwdError,
"The maximum relative error in the forward operator." );
58 clp.setOption(
"output-frequency", &outputFrequency,
"Number of linear solver iterations between output" );
59 clp.setOption(
"output-max-res-only",
"output-all-res", &outputMaxResOnly,
"Determines if only the max residual is printed or if all residuals are printed per iteration." );
60 clp.setOption(
"max-resid", &maxResid,
"The maximum relative error in the residual." );
61 clp.setOption(
"max-solution-error", &maxSolutionError,
"The maximum relative error in the solution of the linear system." );
62 clp.setOption(
"verbose",
"quiet", &verbose,
"Set if output is printed or not." );
63 clp.setOption(
"show-all-tests",
"no-show-all-tests", &showAllTests,
"Set if all the tests are shown or not." );
64 clp.setOption(
"dump-all",
"no-dump-all", &dumpAll,
"Determines if vectors are printed or not." );
65 CommandLineProcessor::EParseCommandLineReturn parse_return = clp.parse(argc,argv);
66 if( parse_return != CommandLineProcessor::PARSE_SUCCESSFUL )
return parse_return;
73 amesos2LOWSFPL.
set(
"Solver Type",solverType);
76 = Thyra::test_single_amesos2_tpetra_solver(
77 matrixFile,numRhs,numRandomVectors
78 ,maxFwdError,maxResid,maxSolutionError,showAllTests,dumpAll
88 if(success) *out <<
"\nCongratulations! All of the tests checked out!\n";
89 else *out <<
"\nOh no! At least one of the tests failed!\n";
92 return ( success ? 0 : 1 );
int main(int argc, char *argv[])
ParameterList & set(std::string const &name, T &&value, std::string const &docString="", RCP< const ParameterEntryValidator > const &validator=null)
#define TEUCHOS_STANDARD_CATCH_STATEMENTS(VERBOSE, ERR_STREAM, SUCCESS_FLAG)
#define TEUCHOS_TEST_FOR_EXCEPT(throw_exception_test)