95int main(
int narg,
char *arg[])
97 Tpetra::ScopeGuard tscope(&narg, &arg);
98 Teuchos::RCP<const Teuchos::Comm<int> > comm = Tpetra::getDefaultComm();
100 int rank = comm->getRank();
103 Teuchos::RCP<Teuchos::FancyOStream> outStream =
104 Teuchos::VerboseObjectBase::getDefaultOStream();
105 Teuchos::EVerbosityLevel v=Teuchos::VERB_EXTREME;
107 typedef Tpetra::CrsMatrix<zscalar_t,zlno_t,zgno_t,znode_t>
tmatrix_t;
108 typedef Tpetra::CrsGraph<zlno_t,zgno_t,znode_t>
tgraph_t;
109 typedef Tpetra::Vector<zscalar_t,zlno_t,zgno_t,znode_t>
tvector_t;
110 typedef Tpetra::MultiVector<zscalar_t,zlno_t,zgno_t,znode_t> tmvector_t;
111 typedef Xpetra::CrsMatrix<zscalar_t,zlno_t,zgno_t,znode_t>
xmatrix_t;
112 typedef Xpetra::CrsGraph<zlno_t,zgno_t,znode_t>
xgraph_t;
113 typedef Xpetra::Vector<zscalar_t,zlno_t,zgno_t,znode_t>
xvector_t;
114 typedef Xpetra::MultiVector<zscalar_t,zlno_t,zgno_t,znode_t> xmvector_t;
118 RCP<UserInputForTests> uinput;
119 Teuchos::ParameterList params;
120 params.set(
"input file",
"simple");
121 params.set(
"file type",
"Chaco");
126 catch(std::exception &e){
128 std::cout << e.what() << std::endl;
145 M = uinput->getUITpetraCrsMatrix();
147 catch(std::exception &e){
149 std::cout << e.what() << std::endl;
154 std::cout <<
"Original Tpetra matrix " << M->getGlobalNumRows()
155 <<
" x " << M->getGlobalNumCols() << std::endl;
157 M->describe(*outStream,v);
159 ArrayRCP<zgno_t> newRowIds =
roundRobinMap(*(M->getRowMap()));
161 zgno_t localNumRows = newRowIds.size();
163 RCP<const tmatrix_t> newM;
166 localNumRows, newRowIds.getRawPtr());
168 catch(std::exception &e){
170 std::cout << e.what() << std::endl;
173 " Zoltan2::XpetraTraits<tmatrix_t>::doMigration ", 1);
176 std::cout <<
"Migrated Tpetra matrix" << std::endl;
178 newM->describe(*outStream,v);
186 G = uinput->getUITpetraCrsGraph();
188 catch(std::exception &e){
190 std::cout << e.what() << std::endl;
195 std::cout <<
"Original Tpetra graph" << std::endl;
197 G->describe(*outStream,v);
199 ArrayRCP<zgno_t> newRowIds =
roundRobinMap(*(G->getRowMap()));
201 zgno_t localNumRows = newRowIds.size();
203 RCP<const tgraph_t> newG;
206 localNumRows, newRowIds.getRawPtr());
208 catch(std::exception &e){
210 std::cout << e.what() << std::endl;
213 " Zoltan2::XpetraTraits<tgraph_t>::doMigration ", 1);
216 std::cout <<
"Migrated Tpetra graph" << std::endl;
218 newG->describe(*outStream,v);
226 V = rcp(
new tvector_t(uinput->getUITpetraCrsGraph()->getRowMap(), 1));
229 catch(std::exception &e){
231 std::cout << e.what() << std::endl;
236 std::cout <<
"Original Tpetra vector" << std::endl;
238 V->describe(*outStream,v);
242 zgno_t localNumRows = newRowIds.size();
244 RCP<const tvector_t> newV;
247 localNumRows, newRowIds.getRawPtr());
249 catch(std::exception &e){
251 std::cout << e.what() << std::endl;
254 " Zoltan2::XpetraTraits<tvector_t>::doMigration ", 1);
257 std::cout <<
"Migrated Tpetra vector" << std::endl;
259 newV->describe(*outStream,v);
267 MV = rcp(
new tmvector_t(uinput->getUITpetraCrsGraph()->getRowMap(), 3));
270 catch(std::exception &e){
272 std::cout << e.what() << std::endl;
277 std::cout <<
"Original Tpetra multivector" << std::endl;
279 MV->describe(*outStream,v);
283 zgno_t localNumRows = newRowIds.size();
285 RCP<const tmvector_t> newMV;
288 localNumRows, newRowIds.getRawPtr());
290 catch(std::exception &e){
292 std::cout << e.what() << std::endl;
295 " Zoltan2::XpetraTraits<tmvector_t>::doMigration ", 1);
298 std::cout <<
"Migrated Tpetra multivector" << std::endl;
300 newMV->describe(*outStream,v);
315 M = uinput->getUIXpetraCrsMatrix();
317 catch(std::exception &e){
319 std::cout << e.what() << std::endl;
324 std::cout <<
"Original Xpetra matrix" << std::endl;
326 M->describe(*outStream,v);
328 ArrayRCP<zgno_t> newRowIds =
roundRobinMap(*(M->getRowMap()));
330 zgno_t localNumRows = newRowIds.size();
332 RCP<const xmatrix_t> newM;
335 localNumRows, newRowIds.getRawPtr());
337 catch(std::exception &e){
339 std::cout << e.what() << std::endl;
342 " Zoltan2::XpetraTraits<xmatrix_t>::doMigration ", 1);
345 std::cout <<
"Migrated Xpetra matrix" << std::endl;
347 newM->describe(*outStream,v);
355 G = uinput->getUIXpetraCrsGraph();
357 catch(std::exception &e){
359 std::cout << e.what() << std::endl;
364 std::cout <<
"Original Xpetra graph" << std::endl;
366 G->describe(*outStream,v);
368 ArrayRCP<zgno_t> newRowIds =
roundRobinMap(*(G->getRowMap()));
370 zgno_t localNumRows = newRowIds.size();
372 RCP<const xgraph_t> newG;
375 localNumRows, newRowIds.getRawPtr());
377 catch(std::exception &e){
379 std::cout << e.what() << std::endl;
382 " Zoltan2::XpetraTraits<xgraph_t>::doMigration ", 1);
385 std::cout <<
"Migrated Xpetra graph" << std::endl;
387 newG->describe(*outStream,v);
396 rcp(
new tvector_t(uinput->getUITpetraCrsGraph()->getRowMap(), 1));
400 catch(std::exception &e){
402 std::cout << e.what() << std::endl;
407 std::cout <<
"Original Xpetra vector" << std::endl;
409 V->describe(*outStream,v);
413 zgno_t localNumRows = newRowIds.size();
415 RCP<const xvector_t> newV;
418 localNumRows, newRowIds.getRawPtr());
420 catch(std::exception &e){
422 std::cout << e.what() << std::endl;
425 " Zoltan2::XpetraTraits<xvector_t>::doMigration ", 1);
428 std::cout <<
"Migrated Xpetra vector" << std::endl;
430 newV->describe(*outStream,v);
438 RCP<tmvector_t> tMV =
439 rcp(
new tmvector_t(uinput->getUITpetraCrsGraph()->getRowMap(), 3));
443 catch(std::exception &e){
445 std::cout << e.what() << std::endl;
450 std::cout <<
"Original Xpetra multivector" << std::endl;
452 MV->describe(*outStream,v);
456 zgno_t localNumRows = newRowIds.size();
458 RCP<const xmvector_t> newMV;
461 localNumRows, newRowIds.getRawPtr());
463 catch(std::exception &e){
465 std::cout << e.what() << std::endl;
468 " Zoltan2::XpetraTraits<xmvector_t>::doMigration ", 1);
471 std::cout <<
"Migrated Xpetra multivector" << std::endl;
473 newMV->describe(*outStream,v);
481 std::cout <<
"PASS" << std::endl;