Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue 4283: refactor muelu to not use dynamic profile when declaring crsgraph #4411

Merged
merged 3 commits into from
Apr 12, 2019
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -828,7 +828,7 @@ namespace MueLu {
GetOStream(Statistics1) << "CoalesceDropFactory: nodeMap " << nodeMap->getNodeNumElements() << "/" << nodeMap->getGlobalNumElements() << " elements" << std::endl;

// 3) create graph of amalgamated matrix
RCP<CrsGraph> crsGraph = CrsGraphFactory::Build(nodeMap, 10, Xpetra::DynamicProfile);
RCP<CrsGraph> crsGraph = CrsGraphFactory::Build(nodeMap, 10, Xpetra::StaticProfile);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@GeoffDanielson Ugh. I suspect 10 is arbitrary, and that this code relies on having the matrix expand its row storage as needed. Did you run the MueLu unit tests to see if this branch is ever hit?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I did run the muelu unit tests and the limit doesn't get hit. I suspect you're right, but I'm not sure whether it'd be more correct to fix it with the proper upper limit or just leave as is.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If the matrix is an Xpetra::BlockedCrsMatrix, then the method getNodeMaxNumRowEntries is available. I am fine with this change.


LO numRows = A->getRowMap()->getNodeNumElements();
LO numNodes = nodeMap->getNodeNumElements();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -249,7 +249,7 @@ namespace MueLu {
myGraph = CrsGraphFactory::Build(rowMap,
colMap,
nnzOnRow,
Xpetra::DynamicProfile);
Xpetra::StaticProfile);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@lucbv should really comment on this.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My feeling is: this should be fine, the graph constructor actually allocates the exact amount of memory it needs since nnzOnRow is specified.
Of course I would still want this example to be tested to double check correctness.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @lucbv :-)


*out << "Fill CrsGraph" << std::endl;
LO rowIdx = 0;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ namespace MueLu {
// create new empty Matrix
RCP<const Map> rowmap = Ain->getRowMap();
RCP<const Map> colmap = Ain->getColMap();
RCP<CrsOMatrix> Aout = rcp(new CrsOMatrix(rowmap, expectedNNZperRow_ <= 0 ? Ain->getGlobalMaxNumRowEntries() : expectedNNZperRow_ , Xpetra::DynamicProfile));
RCP<CrsOMatrix> Aout = rcp(new CrsOMatrix(rowmap, expectedNNZperRow_ <= 0 ? Ain->getGlobalMaxNumRowEntries() : expectedNNZperRow_ , Xpetra::StaticProfile));
// loop over local rows
for(size_t row=0; row<Ain->getNodeNumRows(); row++)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ namespace MueLu {


// 3) create graph of amalgamated matrix
RCP<CrsGraph> crsGraph = CrsGraphFactory::Build(nodeMap, 10, Xpetra::DynamicProfile);
RCP<CrsGraph> crsGraph = CrsGraphFactory::Build(nodeMap, 10, Xpetra::StaticProfile);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, for the same reason as for MueLu::CoalesceDropFactory_def.hpp.


// 4) do amalgamation. generate graph of amalgamated matrix
for(LO row=0; row<Teuchos::as<LO>(A->getRowMap()->getNodeNumElements()); row++) {
Expand Down