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 <qd/qd_real.h>
60 #include "MultiPrecDriver.hpp"
66 int main(
int argc,
char *argv[])
71 using Teuchos::ParameterList;
76 Teuchos::oblackholestream blackhole;
77 Teuchos::GlobalMPISession mpiSession(&argc,&argv,&blackhole);
79 const int myImageID = comm->getRank();
84 bool verbose = (myImageID==0);
88 std::string machineFile;
89 Teuchos::CommandLineProcessor cmdp(
false,
true);
90 cmdp.setOption(
"verbose",
"quiet",&verbose,
"Print messages and results.");
91 cmdp.setOption(
"matrix-file",&matfile,
"Filename for matrix");
92 cmdp.setOption(
"param-file", &xmlfile,
"XML file for solver parameters");
93 cmdp.setOption(
"machine-file",&machineFile,
"Filename for XML machine description file.");
94 cmdp.setOption(
"unfused",
"no-unfused",&unfused,
"Test unfused iteration.");
95 if (cmdp.parse(argc,argv) != Teuchos::CommandLineProcessor::PARSE_SUCCESSFUL) {
102 RCP<Teuchos::ParameterList> machinePL = Teuchos::parameterList();
103 std::string defaultMachine(
105 " <ParameterList name='%1=0'> "
106 " <Parameter name='NodeType' type='string' value='Kokkos::SerialNode'/> "
110 Teuchos::updateParametersFromXmlString(defaultMachine,machinePL.ptr());
111 if (machineFile !=
"") Teuchos::updateParametersFromXmlFile(machineFile,machinePL.ptr());
121 TPETRAEXT_TYPESTACK3(MPStack, qd_real, dd_real,
double )
126 MultiPrecDriver<MPStack> driver;
128 if (verbose) driver.out = Teuchos::getFancyOStream(Teuchos::rcp(&std::cout,false));
129 else driver.out = Teuchos::getFancyOStream(Teuchos::rcp(new Teuchos::oblackholestream()));
131 driver.matrixFile = matfile;
133 driver.unfusedTest = unfused;
138 RCP<Teuchos::ParameterList> params = Teuchos::parameterList();
140 std::
string xmlString(
141 " <ParameterList> \n"
142 " <Parameter name='tolerance' value='1e-60' type='
double'/> \n"
143 " <Parameter name='verbose' value='2' type='
int'/> \n"
144 " <ParameterList name='child'> \n"
145 " <Parameter name='tolerance' value='1e-28' type='
double'/> \n"
146 " <Parameter name='verbose' value='2' type='
int'/> \n"
147 " <ParameterList name='child'> \n"
148 " <Parameter name='tolerance' value='1e-14' type='
double'/> \n"
149 " <Parameter name='verbose' value='0' type='
int'/> \n"
150 " <Parameter name='Extract Diagonal' value='true' type='
bool'/> \n"
151 " </ParameterList> \n"
152 " </ParameterList> \n"
153 " </ParameterList> \n"
155 Teuchos::updateParametersFromXmlString(xmlString,params.ptr());
156 if (xmlfile != "") Teuchos::updateParametersFromXmlFile(xmlfile,params.ptr());
158 driver.params = params;
163 platform.runUserCode(driver);
167 if (driver.testPassed) {
168 *driver.out <<
"End Result: TEST PASSED" << std::endl;