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>
54 #include <TpetraExt_TypeStack.hpp>
58 #include "MultiPrecDriver.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);
86 std::string machineFile;
87 Teuchos::CommandLineProcessor cmdp(
false,
true);
88 cmdp.setOption(
"verbose",
"quiet",&verbose,
"Print messages and results.");
89 cmdp.setOption(
"matrix-file",&matfile,
"Filename for matrix");
90 cmdp.setOption(
"param-file", &xmlfile,
"XML file for solver parameters");
91 cmdp.setOption(
"machine-file",&machineFile,
"Filename for XML machine description file.");
92 cmdp.setOption(
"unfused",
"no-unfused",&unfused,
"Test unfused iteration.");
93 if (cmdp.parse(argc,argv) != Teuchos::CommandLineProcessor::PARSE_SUCCESSFUL) {
100 RCP<Teuchos::ParameterList> machinePL = Teuchos::parameterList();
101 std::string defaultMachine(
103 " <ParameterList name='%1=0'> "
104 " <Parameter name='NodeType' type='string' value='Kokkos::SerialNode'/> "
108 Teuchos::updateParametersFromXmlString(defaultMachine,machinePL.ptr());
109 if (machineFile !=
"") Teuchos::updateParametersFromXmlFile(machineFile,machinePL.ptr());
119 TPETRAEXT_TYPESTACK2(MPStack,
double,
float)
124 MultiPrecDriver<MPStack> driver;
126 if (verbose) driver.out = Teuchos::getFancyOStream(Teuchos::rcp(&std::cout,false));
127 else driver.out = Teuchos::getFancyOStream(Teuchos::rcp(new Teuchos::oblackholestream()));
129 driver.matrixFile = matfile;
131 driver.unfusedTest = unfused;
136 RCP<Teuchos::ParameterList> params = Teuchos::parameterList();
138 std::
string xmlString(
139 " <ParameterList> \n"
140 " <Parameter name='tolerance' value='1e-15' type='
double'/> \n"
141 " <Parameter name='verbose' value='2' type='
int'/> \n"
142 " <ParameterList name='child'> \n"
143 " <Parameter name='tolerance' value='1e-7' type='
double'/> \n"
144 " <Parameter name='verbose' value='1' type='
int'/> \n"
145 " <Parameter name='Extract Diagonal' value='true' type='
bool'/> \n"
146 " </ParameterList> \n"
147 " </ParameterList> \n"
149 Teuchos::updateParametersFromXmlString(xmlString,params.ptr());
150 if (xmlfile != "") Teuchos::updateParametersFromXmlFile(xmlfile,params.ptr());
152 driver.params = params;
157 platform.runUserCode(driver);
161 if (driver.testPassed) {
162 *driver.out <<
"End Result: TEST PASSED" << std::endl;