81 typedef Tpetra::CrsMatrix<z2TestScalar, z2TestLO, z2TestGO>
SparseMatrix;
83 typedef Tpetra::Vector<z2TestScalar, z2TestLO, z2TestGO>
Vector;
84 typedef Vector::node_type
Node;
94 typedef Tpetra::Vector<int, z2TestLO, z2TestGO>
IntVector;
97 #define epsilon 0.00000001
103 std::string inputFile =
"";
109 std::string method =
"scotch";
110 bool verbose =
false;
111 bool distributeInput =
true;
118 Tpetra::ScopeGuard tscope(&narg, &arg);
119 Teuchos::RCP<const Teuchos::Comm<int> > comm = Tpetra::getDefaultComm();
120 int me = comm->getRank();
123 Teuchos::CommandLineProcessor cmdp (
false,
false);
124 cmdp.setOption(
"inputPath", &inputPath,
125 "Path to the MatrixMarket or Zoltan file to be read; ",
true);
127 cmdp.setOption(
"inputFile", &inputFile,
128 "Name of the Matrix Market or Zoltan file to read; ",
true);
134 cmdp.setOption(
"verbose",
"quiet", &verbose,
135 "Print messages and results.");
141 cmdp.parse(narg, arg);
143 RCP<UserInputForTests> uinput;
146 uinput = rcp(
new UserInputForTests(inputPath, inputFile, comm,
true, distributeInput));
148 RCP<SparseMatrix> origMatrix = uinput->getUITpetraCrsMatrix();
150 if (origMatrix->getGlobalNumRows() < 40)
152 Teuchos::FancyOStream out(Teuchos::rcp(&std::cout,
false));
153 origMatrix->describe(out, Teuchos::VERB_EXTREME);
159 std::cout <<
"NumRows = " << origMatrix->getGlobalNumRows() << std::endl
160 <<
"NumNonzeros = " << origMatrix->getGlobalNumEntries() << std::endl
161 <<
"NumProcs = " << comm->getSize() << std::endl
162 <<
"NumLocalRows (rank 0) = " << origMatrix->getNodeNumRows() << std::endl;
176 Teuchos::ParameterList params;
178 params.set(
"partitioning_approach",
"partition");
198 if (me == 0) std::cout <<
"Calling solve() " << std::endl;
202 if (me == 0) std::cout <<
"Done solve() " << std::endl;
205 catch (std::runtime_error &e)
207 std::cout <<
"Runtime exception returned from solve(): " << e.what();
208 if (!strncmp(e.what(),
"BUILD ERROR", 11)) {
210 std::cout <<
" PASS" << std::endl;
215 std::cout <<
" FAIL" << std::endl;
219 catch (std::logic_error &e) {
220 std::cout <<
"Logic exception returned from solve(): " << e.what()
221 <<
" FAIL" << std::endl;
224 catch (std::bad_alloc &e) {
225 std::cout <<
"Bad_alloc exception returned from solve(): " << e.what()
226 <<
" FAIL" << std::endl;
229 catch (std::exception &e) {
230 std::cout <<
"Unknown exception returned from solve(). " << e.what()
231 <<
" FAIL" << std::endl;
318 std::cout <<
"Finished" << std::endl;
Tpetra::Vector< z2TestScalar, z2TestLO, z2TestGO > Vector
MatrixPartitioningProblem sets up partitioning problems for the user.
Provides access for Zoltan2 to Xpetra::CrsMatrix data.
int main(int narg, char *arg[])
common code used by tests
Defines the XpetraCrsMatrixAdapter class.
Defines the MatrixPartitioningProblem class.
Tpetra::CrsMatrix< z2TestScalar, z2TestLO, z2TestGO > SparseMatrix
An adapter for Xpetra::MultiVector.
Zoltan2::XpetraMultiVectorAdapter< IntVector > IntVectorAdapter
Tpetra::CrsGraph< z2TestLO, z2TestGO > SparseGraph
void solve(bool updateInputData=true)
Direct the problem to create a solution.
Zoltan2::XpetraCrsMatrixAdapter< SparseMatrix > SparseMatrixAdapter
Tpetra::Vector< int, z2TestLO, z2TestGO > IntVector
Zoltan2::XpetraMultiVectorAdapter< Vector > MultiVectorAdapter
std::string testDataFilePath(".")