Skip to content

Comments

Fix NaN check reading wrong index in MPI unpack#1231

Closed
sbryngelson wants to merge 1 commit intoMFlowCode:masterfrom
sbryngelson:fix/nan-check-offset
Closed

Fix NaN check reading wrong index in MPI unpack#1231
sbryngelson wants to merge 1 commit intoMFlowCode:masterfrom
sbryngelson:fix/nan-check-offset

Conversation

@sbryngelson
Copy link
Member

@sbryngelson sbryngelson commented Feb 21, 2026

User description

Summary

  • The Intel-only NaN diagnostic check after MPI buffer unpacking used q_comm(i)%sf(j, k, l) instead of q_comm(i)%sf(j + unpack_offset, k, l)
  • The data is written to the offset index but the NaN check read from the non-offset index, checking the wrong cell

Test plan

  • Intel-compiler-only diagnostic code path; no functional change on other compilers
  • No golden file changes expected

🤖 Generated with Claude Code


CodeAnt-AI Description

Fix NaN diagnostic to check unpacked MPI buffer locations

What Changed

  • The Intel-only NaN check now inspects the exact array cell that was just written by MPI unpack (uses the unpack offset) instead of an unrelated cell
  • Eliminates checks against stale or wrong elements after receiving MPI buffer data

Impact

✅ Fewer spurious NaN error stops during MPI unpack
✅ Clearer diagnostics that point to the just-received value
✅ More reliable MPI data validation on Intel compilers

💡 Usage Guide

Checking Your Pull Request

Every time you make a pull request, our system automatically looks through it. We check for security issues, mistakes in how you're setting up your infrastructure, and common code problems. We do this to make sure your changes are solid and won't cause any trouble later.

Talking to CodeAnt AI

Got a question or need a hand with something in your pull request? You can easily get in touch with CodeAnt AI right here. Just type the following in a comment on your pull request, and replace "Your question here" with whatever you want to ask:

@codeant-ai ask: Your question here

This lets you have a chat with CodeAnt AI about your pull request, making it easier to understand and improve your code.

Example

@codeant-ai ask: Can you suggest a safer alternative to storing this secret?

Preserve Org Learnings with CodeAnt

You can record team preferences so CodeAnt AI applies them in future reviews. Reply directly to the specific CodeAnt AI suggestion (in the same thread) and replace "Your feedback here" with your input:

@codeant-ai: Your feedback here

This helps CodeAnt AI learn and adapt to your team's coding style and standards.

Example

@codeant-ai: Do not flag unused imports.

Retrigger review

Ask CodeAnt AI to review the PR again, by typing:

@codeant-ai: review

Check Your Repository Health

To analyze the health of your code repository, visit our dashboard at https://app.codeant.ai. This tool helps you identify potential issues and areas for improvement in your codebase, ensuring your repository maintains high standards of code health.

The NaN diagnostic check used q_comm(i)%sf(j, k, l) but the value
was unpacked into q_comm(i)%sf(j + unpack_offset, k, l). This meant
the check was reading a stale or unrelated cell instead of the just-
received value.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Copilot AI review requested due to automatic review settings February 21, 2026 22:58
@codeant-ai

This comment has been minimized.

@coderabbitai

This comment has been minimized.

@codeant-ai codeant-ai bot added the size:XS This PR changes 0-9 lines, ignoring generated files label Feb 21, 2026
Copy link
Contributor

@cubic-dev-ai cubic-dev-ai bot left a comment

Choose a reason for hiding this comment

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

No issues found across 1 file

Confidence score: 5/5

  • Automated review surfaced no issues in the provided summaries.
  • No files require special attention.

@codeant-ai

This comment has been minimized.

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR fixes a bug in Intel compiler-specific diagnostic code where NaN checks after MPI buffer unpacking were reading from incorrect array indices. The data was being written to offset indices (j + unpack_offset, k + unpack_offset, or l + unpack_offset depending on the spatial direction), but the NaN checks were reading from non-offset indices (j, k, or l), effectively checking the wrong memory cells.

Changes:

  • Fixed NaN check index in j-direction MPI buffer unpacking to use j + unpack_offset instead of j
  • Fixed NaN check index in k-direction MPI buffer unpacking to use k + unpack_offset instead of k
  • Fixed NaN check index in l-direction MPI buffer unpacking to use l + unpack_offset instead of l

@codecov
Copy link

codecov bot commented Feb 22, 2026

Codecov Report

❌ Patch coverage is 66.66667% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 44.05%. Comparing base (d048c4b) to head (1819d87).
⚠️ Report is 19 commits behind head on master.

Files with missing lines Patch % Lines
src/common/m_mpi_common.fpp 66.66% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #1231      +/-   ##
==========================================
- Coverage   44.07%   44.05%   -0.02%     
==========================================
  Files          70       70              
  Lines       20431    20498      +67     
  Branches     1974     1990      +16     
==========================================
+ Hits         9004     9030      +26     
- Misses      10291    10329      +38     
- Partials     1136     1139       +3     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@sbryngelson
Copy link
Member Author

Superseded by #1242 (batched HPC-sensitive fixes)

@sbryngelson sbryngelson deleted the fix/nan-check-offset branch February 22, 2026 21:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:XS This PR changes 0-9 lines, ignoring generated files

Development

Successfully merging this pull request may close these issues.

1 participant