Skip to content

Work around nvc++ 26.5 bugs#4496

Draft
roystgnr wants to merge 1 commit into
libMesh:develfrom
roystgnr:nvhpc_workarounds
Draft

Work around nvc++ 26.5 bugs#4496
roystgnr wants to merge 1 commit into
libMesh:develfrom
roystgnr:nvhpc_workarounds

Conversation

@roystgnr

@roystgnr roystgnr commented Jul 9, 2026

Copy link
Copy Markdown
Member

I'm reporting the compilation errors that prompted these upstream, but in the meantime the changes here (a couple intermediate references) seem like a reasonable workaround to me, for the first nvc++ release (literally in forever? at least since I started testing in 2022; see pull #3409) that passes all our unit tests at all optimization levels without problems.

Marking this as "Draft" until I'm done playing with example apps, MOOSE, etc. and I'm confident we don't need more libMesh-level changes.

I'm reporting the compilation errors that prompted these upstream, but
in the meantime the changes here (a couple intermediate references) seem
like a reasonable workaround to me, for the first nvc++ release
(literally in forever? at least since I started testing in 2022; see
pull libMesh#3409) that passes all our unit tests at all optimization levels
without problems.
@roystgnr

roystgnr commented Jul 9, 2026

Copy link
Copy Markdown
Member Author

You'd think "Draft" would have indicated sufficient tempering of my excitement that the sum wouldn't count as hubris, but no: I'm getting a segfault in miscellaneous_ex16.

@roystgnr

roystgnr commented Jul 9, 2026

Copy link
Copy Markdown
Member Author

On the other hand, that might be an Eigen bug? Debugger shows it failing deep within Eigen, and my first instinct (see if the Eigen project's own test suite passes with nvc++) was thwarted by a compilation bug there that does look like it's the fault of Eigen, not of nvc++.

@moosebuild

Copy link
Copy Markdown

Job Coverage, step Generate coverage on 3ee6b5d wanted to post the following:

Coverage

125e14 #4496 3ee6b5
Total Total +/- New
Rate 65.65% 65.64% -0.00% -
Hits 78738 78737 -1 0
Misses 41207 41208 +1 0

Diff coverage report

Full coverage report

This comment will be updated on new commits.

@roystgnr

Copy link
Copy Markdown
Member Author

With Eigen disabled and #4497 to make sure everything knows it's disabled, make check is passing (with hybrid MPI + threading) for me with nvc++.

Comment thread tests/fe/fe_test.h
Comment on lines +506 to +507
// Workaround for nvc++ bug
Elem & e = *elem;

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.

Don't we have this same loop idiom in like a million places? Why does nvc++ compiler only have an issue with two of them?

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.

I wish I knew! Boiling it down to a reproducer with no red herrings (no libMesh dependencies, no CppUnit dependencies, not even libstdc++ dependencies just in case there was something dubious in headers there) was a nightmare, because there were so many seemingly innocuous layers of complexity that had to stay in otherwise the bug went away. I did manage to end up with a reproducer that was only a few hundred lines, but in addition to this relatively-clean workaround I found like 4 other workarounds that still were applicable to the reproducer but that were even more confusing than this one.

I'd still call this a huge win, if it wasn't for that Eigen segfault I still haven't figured out the blame for. Compilation failures are an annoyance, but much less horrific than incorrect optimizer output.

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.

3 participants