Example #1
0
int main(int argc, char*argv[])
{
  Teuchos::GlobalMPISession mpisess(&argc,&argv,&cout);
  RCP<const Comm<int> > comm = Teuchos::createMpiComm<int>(Teuchos::opaqueWrapper<MPI_Comm>(MPI_COMM_WORLD));

  const int numImages = comm->getSize(),
            myImageID = comm->getRank();
  const bool IAmRoot = (myImageID == 0);

  // Time timer("Total time for BelosTpetraHybridDriver test");
  // timer.start();

  // Get macine and test parameter files from command line
  string fnTestParams("");
  string fnMachine("");
  Teuchos::CommandLineProcessor cmdp(false,true);
  cmdp.setOption("param-file", &fnTestParams, "XML Parameters file");
  cmdp.setOption("machine-file",&fnMachine,"Filename for XML machine description file.");
  if (cmdp.parse(argc,argv) != Teuchos::CommandLineProcessor::PARSE_SUCCESSFUL) {
    return -1;
  }

  // Read XML machine file into a ParameterList
  if (IAmRoot) {
    cout << "Every proc machine parameters from: " << fnMachine << endl;
  }
  ParameterList plMachine = ParameterXMLFileReader(fnMachine).getParameters();

  // Read the contents of the xml file into a ParameterList.
  if (IAmRoot) {
    cout << "Every proc reading parameters from: " << fnTestParams << endl;
  }
  BelosTpetraHybridDriverTest::plTestParams = ParameterXMLFileReader(fnTestParams).getParameters();

  // Everything is node based from here on out; have the HybridPlatform launch us appropriately
  Tpetra::HybridPlatform platform(comm,plMachine);
  platform.runUserCode<runTest>();

  // timer.stop();
  // if (IAmRoot) {
  //   cout << "proc 0 total program time: " << timer.totalElapsedTime() << endl;
  // }
  
  return 0;
}