44 #include <Teuchos_CommandLineProcessor.hpp>
45 #include <Teuchos_GlobalMPISession.hpp>
46 #include <Teuchos_oblackholestream.hpp>
47 #include <Teuchos_XMLParameterListHelpers.hpp>
49 #include <Tpetra_DefaultPlatform.hpp>
52 #undef HAVE_KOKKOSCLASSIC_THRUST
53 #include <Tpetra_HybridPlatform.hpp>
55 #include <TpetraExt_TypeStack.hpp>
59 #include "MultiPrecDriver.hpp"
65 int main(
int argc,
char *argv[])
70 using Teuchos::ParameterList;
75 Teuchos::oblackholestream blackhole;
76 Teuchos::GlobalMPISession mpiSession(&argc,&argv,&blackhole);
78 const int myImageID = comm->getRank();
83 bool verbose = (myImageID==0);
87 std::string machineFile;
88 Teuchos::CommandLineProcessor cmdp(
false,
true);
89 cmdp.setOption(
"verbose",
"quiet",&verbose,
"Print messages and results.");
90 cmdp.setOption(
"matrix-file",&matfile,
"Filename for matrix");
91 cmdp.setOption(
"param-file", &xmlfile,
"XML file for solver parameters");
92 cmdp.setOption(
"machine-file",&machineFile,
"Filename for XML machine description file.");
93 cmdp.setOption(
"unfused",
"no-unfused",&unfused,
"Test unfused iteration.");
94 if (cmdp.parse(argc,argv) != Teuchos::CommandLineProcessor::PARSE_SUCCESSFUL) {
101 RCP<Teuchos::ParameterList> machinePL = Teuchos::parameterList();
102 std::string defaultMachine(
104 " <ParameterList name='%1=0'> "
105 " <Parameter name='NodeType' type='string' value='Kokkos::SerialNode'/> "
109 Teuchos::updateParametersFromXmlString(defaultMachine,machinePL.ptr());
110 if (machineFile !=
"") Teuchos::updateParametersFromXmlFile(machineFile,machinePL.ptr());
120 TPETRAEXT_TYPESTACK1(MPStack,
double)
125 MultiPrecDriver<MPStack> driver;
127 if (verbose) driver.out = Teuchos::getFancyOStream(Teuchos::rcp(&std::cout,false));
128 else driver.out = Teuchos::getFancyOStream(Teuchos::rcp(new Teuchos::oblackholestream()));
130 driver.matrixFile = matfile;
132 driver.unfusedTest = unfused;
137 RCP<Teuchos::ParameterList> params = Teuchos::parameterList();
139 std::
string xmlString(
140 " <ParameterList> \n"
141 " <Parameter name='tolerance' value='5e-15' type='
double'/> \n"
142 " <Parameter name='verbose' value='1' type='
int'/> \n"
143 " <Parameter name='Extract Diagonal' value='true' type='
bool'/> \n"
144 " </ParameterList> \n"
146 Teuchos::updateParametersFromXmlString(xmlString,params.ptr());
147 if (xmlfile != "") Teuchos::updateParametersFromXmlFile(xmlfile,params.ptr());
149 driver.params = params;
154 platform.runUserCode(driver);
158 if (driver.testPassed) {
159 *driver.out <<
"End Result: TEST PASSED" << std::endl;