46 #include <Teuchos_CommandLineProcessor.hpp>
47 #include <Teuchos_GlobalMPISession.hpp>
48 #include <Teuchos_oblackholestream.hpp>
49 #include <Teuchos_XMLParameterListHelpers.hpp>
51 #include <Tpetra_DefaultPlatform.hpp>
52 #include <TpetraExt_TypeStack.hpp>
55 #undef HAVE_KOKKOSCLASSIC_THRUST
56 #include <Tpetra_HybridPlatform.hpp>
58 #include <IRTRDriver.hpp>
64 int main(
int argc,
char *argv[])
69 using Teuchos::ParameterList;
74 Teuchos::oblackholestream blackhole;
75 Teuchos::GlobalMPISession mpiSession(&argc,&argv,&blackhole);
77 const int myImageID = comm->getRank();
82 bool verbose = (myImageID==0);
85 std::string machineFile;
86 Teuchos::CommandLineProcessor cmdp(
false,
true);
87 cmdp.setOption(
"verbose",
"quiet",&verbose,
"Print messages and results.");
88 cmdp.setOption(
"matrix-file",&matfile,
"Filename for matrix");
89 cmdp.setOption(
"param-file", &xmlfile,
"XML file for solver parameters");
90 cmdp.setOption(
"machine-file",&machineFile,
"Filename for XML machine description file.");
91 if (cmdp.parse(argc,argv) != Teuchos::CommandLineProcessor::PARSE_SUCCESSFUL) {
98 RCP<Teuchos::ParameterList> machinePL = Teuchos::parameterList();
99 std::string defaultMachine(
101 " <ParameterList name='%1=0'> "
102 " <Parameter name='NodeType' type='string' value='Kokkos::SerialNode'/> "
106 Teuchos::updateParametersFromXmlString(defaultMachine,machinePL.ptr());
107 if (machineFile !=
"") Teuchos::updateParametersFromXmlFile(machineFile,machinePL.ptr());
117 typedef double Scalar;
122 IRTR_Driver<Scalar> driver;
124 if (verbose) driver.out = Teuchos::getFancyOStream(Teuchos::rcp(&std::cout,
false));
125 else driver.out = Teuchos::getFancyOStream(Teuchos::rcp(
new Teuchos::oblackholestream()));
127 driver.matrixFile = matfile;
132 RCP<Teuchos::ParameterList> params = Teuchos::parameterList();
134 std::string xmlString(
135 " <ParameterList> \n"
136 " <Parameter name='tolerance' value='5e-15' type='double'/> \n"
137 " <Parameter name='verbose' value='1' type='int'/> \n"
138 " <Parameter name='rho_prime' value='.1' type='double'/> \n"
139 " <Parameter name='kappa' value='.1' type='double'/> \n"
140 " <Parameter name='theta' value='2' type='double'/> \n"
141 " </ParameterList> \n"
143 Teuchos::updateParametersFromXmlString(xmlString,params.ptr());
144 if (xmlfile !=
"") Teuchos::updateParametersFromXmlFile(xmlfile,params.ptr());
146 driver.params = params;
151 platform.runUserCode(driver);
155 if (driver.testPassed) {
156 *driver.out <<
"End Result: TEST PASSED" << std::endl;