mpp_check_field fix for test_mpp_domains2 #1292
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
The test_mpp_domains2 test fails at line 234 in mpp_update_domains.fh with a seg fault. Tracking through the backtrace of this error (you can see the full backtrace in issue #1290) I think I have found the root cause:
In file
mpp_domains_misc.inc
subroutinempp_check_field_2d_type2
we callmpp_redistribute
at line 426 with the following arguments:FMS/mpp/include/mpp_domains_misc.inc
Line 426 in 2be8aa4
Because
field1
andfield2
are 2D arrays, mpp_redistribute will use the subroutineMPP_REDISTRIBUTE_2D_
frommpp_update_domains2D.fh
field1
inmpp_check_field_2d_type2
isfield_out
inMPP_REDISTRIBUTE_2D_
and the program fails when we try to setFMS/mpp/include/mpp_update_domains2D.fh
Line 234 in 2be8aa4
I think that this is happening because
field1
was only allocated onpelist2
but mpp_redistribute is called from all pes . So pes frompelist1
will not have allocatedfield1
.FMS/mpp/include/mpp_domains_misc.inc
Lines 412 to 420 in 2be8aa4
The solution I propose in this PR is to allocate
field1
outside of theif(any(pelist2 == pe))
condition so that all pes allocate.Fixes #1290
How Has This Been Tested?
Tested with GCC 13.1.0 on GFDL dev box with openmpi make and make check
Checklist:
make distcheck
passes