Skip to content

NumericVector::is_effectively_serial(), to avoid overloading metadata#4428

Merged
roystgnr merged 3 commits into
libMesh:develfrom
roystgnr:parallel_1_isnt_serial
Mar 27, 2026
Merged

NumericVector::is_effectively_serial(), to avoid overloading metadata#4428
roystgnr merged 3 commits into
libMesh:develfrom
roystgnr:parallel_1_isnt_serial

Conversation

@roystgnr
Copy link
Copy Markdown
Member

Hopefully this will fix the regressions @jwpeterson saw in write-1-to-read-N after #4374

Shorthand to make it easier to determine whether a vector can be handled
using optimized-for-serial code paths regardless of its conceptual
status.
This ought to preserve the performance improvements of Seq vectors and
serial codepaths without losing PARALLEL-vs-GHOSTED metadata.
@jwpeterson
Copy link
Copy Markdown
Member

Thanks, this fixes the original test that was failing for me, I'm going to temporarily push your branch into upstream so that I can run all of our internal testing on it as well.

@jwpeterson
Copy link
Copy Markdown
Member

Huh, looks like maybe only one MOOSE test doesn't like this.

time_integrators/multiple-integrators.test_part1: *** ERROR ***
time_integrators/multiple-integrators.test_part1: Cannot store ghosted numeric vectors

@roystgnr
Copy link
Copy Markdown
Member Author

It's so insulting when just one test fails. "Hey, your code sucks and your test coverage sucks!"

I can reproduce this but probably won't find time to fix it before tomorrow.

@moosebuild
Copy link
Copy Markdown

moosebuild commented Mar 25, 2026

Job Coverage, step Generate coverage on 771fc4a wanted to post the following:

Coverage

7e6052 #4428 771fc4
Total Total +/- New
Rate 65.47% 65.47% +0.00% 100.00%
Hits 78224 78226 +2 10
Misses 41253 41251 -2 0

Diff coverage report

Full coverage report

This comment will be updated on new commits.

And even in the serial case our metadata should reflect that.

This fixes a conflict with MOOSE restarts (which want to save a
subvector in one cases but can't save a ghosted vector) for me.
@roystgnr
Copy link
Copy Markdown
Member Author

@lindsayad won't have time to check this for performance regressions for a while, but it's at least fixing correctness regressions so he's good with us merging now.

@roystgnr roystgnr merged commit ccf26f2 into libMesh:devel Mar 27, 2026
25 checks passed
@roystgnr roystgnr deleted the parallel_1_isnt_serial branch March 27, 2026 15:55
Comment on lines +1079 to +1082
// You'd think we would create GHOSTED from GHOSTED, but we
// never have, and now there'd be downstream compatibility
// issues if we started even marking an effectively-serial
// subvector as GHOSTED.
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I guess I could have changed the libmesh_error_msg_if on line 1058 to libmesh_not_implemented() to maybe avoid your ire here? I had thought about this and decided to not implement support (yet) and hence created the error

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Well, the catch isn't a problem with the incoming type of the subvector that we pass in and assert about, it's on the type of this.

In hindsight we probably should have been looking at both types: if the subvector has a type() other than AUTOMATIC, respect that; if it has AUTOMATIC, determine its new type() from this->type(). And then at that point it would be reasonable to libmesh_not_implemented() on the this->type() == GHOSTED, subvector.type() == AUTOMATIC and the subvector.type() == GHOSTED cases.

Maybe that's not too late to do, actually, if you think it's a reasonable idea? We could patch downstream to use that mechanism to request the GHOSTED->PARALLEL case that we now do implicitly, then patch here to respect that mechanism afterward.

No ire in your direction, BTW, just frustration at the situation. The first version of create_subvector was from John in 2004, and didn't consider type() at all. We have more than a few code design decisions from circa 2004-2007 (including my own) that have caused us backwards compatibility hassle but that I find hard to criticize anyway. 2004 libMesh is like that Russian quip: "The marvel is not how well the dancing bear dances, but that it dances at all".

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I think it's a good idea!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants