Skip to content

Commit

Permalink
MueLu: fixing the Zoltan unit-test for static allocation of Tpetra::C…
Browse files Browse the repository at this point in the history
…rsGraph see issue trilinos#5614

This work will make the test pass after Tpetra removes its deprecated code.
  • Loading branch information
lucbv committed Jul 31, 2019
1 parent 814856d commit 11af215
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 7 deletions.
9 changes: 4 additions & 5 deletions packages/muelu/test/unit_tests/PgPFactory.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -831,10 +831,9 @@ namespace MueLuTests {
out << "version: " << MueLu::Version() << std::endl;
out << "Test PgPFactory (reuse row based omegas for restriction operator)" << std::endl;

typedef typename Teuchos::ScalarTraits<SC>::magnitudeType real_type;
typedef typename Xpetra::MultiVector<real_type,LO,GO,NO> RealValuedMultiVector;

typedef typename Teuchos::ScalarTraits<SC>::magnitudeType magnitude_type;
using magnitude_type = typename Teuchos::ScalarTraits<SC>::magnitudeType;
using real_type = typename Teuchos::ScalarTraits<SC>::coordinateType;
using RealValuedMultiVector = typename Xpetra::MultiVector<real_type,LO,GO,NO>;

RCP<const Teuchos::Comm<int> > comm = Teuchos::DefaultComm<int>::getComm();

Expand Down Expand Up @@ -884,7 +883,7 @@ namespace MueLuTests {

RCP<TentativePFactory> Ptentfact = rcp(new TentativePFactory());
RCP<PgPFactory> Pfact = rcp( new PgPFactory());
RCP<Factory> Rfact = rcp( new TransPFactory() );
RCP<Factory> Rfact = rcp( new TransPFactory() );
RCP<RAPFactory> Acfact = rcp( new RAPFactory() );
H->SetMaxCoarseSize(1);

Expand Down
6 changes: 4 additions & 2 deletions packages/muelu/test/unit_tests/Zoltan.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -104,17 +104,19 @@ namespace MueLuTests {
RCP<const Map> map = MapFactory::Build(TestHelpers::Parameters::getLib(), numGlobalElements, 0/*indexBase*/, comm);
const size_t numMyElements = map->getNodeNumElements();
Teuchos::ArrayView<const GlobalOrdinal> myGlobalElements = map->getNodeElementList();
RCP<Matrix> A = rcp(new CrsMatrixWrap(map, 1)); // Force underlying linear algebra library to allocate more
// memory on the fly. While not super efficient, this
// ensures that no zeros are being stored. Thus, from
// Zoltan's perspective the matrix is imbalanced.
// Create a vector with random integer entries in [1,maxEntriesPerRow].
ST::seedrandom(666*comm->getRank());
LO maxNnzPerRow = 0;
RCP<Xpetra::Vector<LO,LO,GO,NO> > entriesPerRow = Xpetra::VectorFactory<LO,LO,GO,NO>::Build(map,false);
Teuchos::ArrayRCP<LO> eprData = entriesPerRow->getDataNonConst(0);
for (typename Teuchos::ArrayRCP<LO>::iterator i=eprData.begin(); i!=eprData.end(); ++i) {
*i = (LO)(std::floor(((Teuchos::ScalarTraits<double>::random()+1)*0.5*maxEntriesPerRow)+1));
*i = static_cast<LO>(std::floor(((Teuchos::ScalarTraits<double>::random()+1)*0.5*maxEntriesPerRow)+1));
if(maxNnzPerRow < *i) {maxNnzPerRow = *i;}
}
RCP<Matrix> A = rcp(new CrsMatrixWrap(map, maxNnzPerRow)); // Force underlying linear algebra library to allocate more

RCP<Teuchos::FancyOStream> fos = Teuchos::fancyOStream(Teuchos::rcpFromRef(std::cout));
fos->setOutputToRootOnly(-1);
Expand Down

0 comments on commit 11af215

Please sign in to comment.