45 #include <qd/qd_real.h>
47 #include <Teuchos_CommandLineProcessor.hpp>
48 #include <Teuchos_GlobalMPISession.hpp>
49 #include <Teuchos_oblackholestream.hpp>
50 #include <Teuchos_XMLParameterListHelpers.hpp>
52 #include <Tpetra_DefaultPlatform.hpp>
53 #include <TpetraExt_TypeStack.hpp>
55 #include <IRTRDriver.hpp>
58 #undef HAVE_KOKKOSCLASSIC_THRUST
59 #include <Tpetra_HybridPlatform.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);
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 if (cmdp.parse(argc,argv) != Teuchos::CommandLineProcessor::PARSE_SUCCESSFUL) {
99 RCP<Teuchos::ParameterList> machinePL = Teuchos::parameterList();
100 std::string defaultMachine(
102 " <ParameterList name='%1=0'> "
103 " <Parameter name='NodeType' type='string' value='Kokkos::SerialNode'/> "
107 Teuchos::updateParametersFromXmlString(defaultMachine,machinePL.ptr());
108 if (machineFile !=
"") Teuchos::updateParametersFromXmlFile(machineFile,machinePL.ptr());
118 typedef qd_real Scalar;
119 typedef double ScalarInner;
124 IRTR_Driver<Scalar,ScalarInner> 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;
134 RCP<Teuchos::ParameterList> params = Teuchos::parameterList();
136 std::string xmlString(
137 " <ParameterList> \n"
138 " <Parameter name='tolerance' value='1e-62' type='double'/> \n"
139 " <Parameter name='verbose' value='1' type='int'/> \n"
140 " <Parameter name='rho_prime' value='.1' type='double'/> \n"
141 " <Parameter name='kappa' value='.1' type='double'/> \n"
142 " <Parameter name='theta' value='2' type='double'/> \n"
143 " </ParameterList> \n"
145 Teuchos::updateParametersFromXmlString(xmlString,params.ptr());
146 if (xmlfile !=
"") Teuchos::updateParametersFromXmlFile(xmlfile,params.ptr());
148 driver.params = params;
153 platform.runUserCode(driver);
157 if (driver.testPassed) {
158 *driver.out <<
"End Result: TEST PASSED" << std::endl;