49 #include "Tpetra_Core.hpp"
53 int main(
int argc,
char* argv[])
61 Tpetra::ScopeGuard tpetraScope(&argc, &argv);
62 auto comm = Tpetra::getDefaultComm();
65 out = Teuchos::VerboseObjectBase::getDefaultOStream();
73 std::string matrixFile =
"";
74 std::string solverType =
"";
76 int numRandomVectors = 1;
77 double maxFwdError = 1e-14;
78 int outputFrequency = 10;
79 bool outputMaxResOnly =
true;
80 double maxResid = 1e-6;
81 double maxSolutionError = 1e-6;
85 CommandLineProcessor clp;
86 clp.throwExceptions(
false);
87 clp.addOutputSetupOptions(
true);
88 clp.setOption(
"matrix-file", &matrixFile,
"Matrix input file [Required]." );
89 clp.setOption(
"solver-type", &solverType,
"Type of solver to use [Required]." );
90 clp.setOption(
"num-rhs", &numRhs,
"Number of RHS in linear solve." );
91 clp.setOption(
"num-random-vectors", &numRandomVectors,
"Number of times a test is performed with different random vectors." );
92 clp.setOption(
"max-fwd-error", &maxFwdError,
"The maximum relative error in the forward operator." );
93 clp.setOption(
"output-frequency", &outputFrequency,
"Number of linear solver iterations between output" );
94 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." );
95 clp.setOption(
"max-resid", &maxResid,
"The maximum relative error in the residual." );
96 clp.setOption(
"max-solution-error", &maxSolutionError,
"The maximum relative error in the solution of the linear system." );
97 clp.setOption(
"verbose",
"quiet", &verbose,
"Set if output is printed or not." );
98 clp.setOption(
"show-all-tests",
"no-show-all-tests", &showAllTests,
"Set if all the tests are shown or not." );
99 clp.setOption(
"dump-all",
"no-dump-all", &dumpAll,
"Determines if vectors are printed or not." );
100 CommandLineProcessor::EParseCommandLineReturn parse_return = clp.parse(argc,argv);
101 if( parse_return != CommandLineProcessor::PARSE_SUCCESSFUL )
return parse_return;
108 amesos2LOWSFPL.
set(
"Solver Type",solverType);
111 = Thyra::test_single_amesos2_tpetra_solver(
112 matrixFile,numRhs,numRandomVectors
113 ,maxFwdError,maxResid,maxSolutionError,showAllTests,dumpAll
123 if(success) *out <<
"\nCongratulations! All of the tests checked out!\n";
124 else *out <<
"\nOh no! At least one of the tests failed!\n";
127 return ( success ? 0 : 1 );
int main(int argc, char *argv[])
ParameterList & set(std::string const &name, T const &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)