Skip to content

Fix SIGFPE (integer divide by zero) in MAPL_LoadBalanceMod#4643

Merged
mathomp4 merged 4 commits into
developfrom
bugfix/load-balance-fix
Apr 21, 2026
Merged

Fix SIGFPE (integer divide by zero) in MAPL_LoadBalanceMod#4643
mathomp4 merged 4 commits into
developfrom
bugfix/load-balance-fix

Conversation

@mathomp4
Copy link
Copy Markdown
Member

Summary

  • Added safety check in MAPL_BalanceWork4 and MAPL_BalanceWork8 to handle Idim == 0 preventing division by zero.
  • This occurs when the max work difference evaluates to 0 in load balancing, causing NumMax (and thus Idim) to be 0 (e.g. single sunlit gridpoint among processes).
  • Updated CHANGELOG.md with an entry for this fix.

@mathomp4 mathomp4 requested a review from a team as a code owner April 15, 2026 14:48
@mathomp4 mathomp4 marked this pull request as draft April 15, 2026 14:50
@mathomp4 mathomp4 added the 0 Diff The changes in this pull request have verified to be zero-diff with the target branch. label Apr 15, 2026
@mathomp4 mathomp4 requested a review from wmputman April 15, 2026 17:31
@mathomp4
Copy link
Copy Markdown
Member Author

CC'ing @wmputman has he saw the issue this might fix

@mathomp4
Copy link
Copy Markdown
Member Author

Per @wmputman this seems to have ... not hurt. That is, when he added this change, he did not get an FPE in MAPL anymore. The error just sort of "moved".

So my guess is this was acting more like a trap. Something bad happened and the divide-by-zero here was the first place the model tripped.

Comment thread shared/MAPL_LoadBalance.F90 Outdated
Comment thread shared/MAPL_LoadBalance.F90 Outdated
mathomp4 and others added 2 commits April 20, 2026 12:59
Co-authored-by: Tom Clune <thomas.l.clune@nasa.gov>
Co-authored-by: Tom Clune <thomas.l.clune@nasa.gov>
@mathomp4 mathomp4 marked this pull request as ready for review April 20, 2026 17:00
@mathomp4
Copy link
Copy Markdown
Member Author

Ahh. I forgot about doing that. I need to remind myself!

@mathomp4 mathomp4 merged commit a03380a into develop Apr 21, 2026
50 checks passed
@mathomp4 mathomp4 deleted the bugfix/load-balance-fix branch April 21, 2026 13:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

0 Diff The changes in this pull request have verified to be zero-diff with the target branch.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants