Skip to content

Commit 7c92596

Browse files
sbryngelsonclaude
andcommitted
Fix NaN check reading wrong index in MPI unpack
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>
1 parent 5b349a3 commit 7c92596

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

src/common/m_mpi_common.fpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -929,7 +929,7 @@ contains
929929
(j + buff_size*((k + 1) + (n + 1)*l))
930930
q_comm(i)%sf(j + unpack_offset, k, l) = real(buff_recv(r), kind=stp)
931931
#if defined(__INTEL_COMPILER)
932-
if (ieee_is_nan(q_comm(i)%sf(j, k, l))) then
932+
if (ieee_is_nan(q_comm(i)%sf(j + unpack_offset, k, l))) then
933933
print *, "Error", j, k, l, i
934934
error stop "NaN(s) in recv"
935935
end if
@@ -984,7 +984,7 @@ contains
984984
((k + buff_size) + buff_size*l))
985985
q_comm(i)%sf(j, k + unpack_offset, l) = real(buff_recv(r), kind=stp)
986986
#if defined(__INTEL_COMPILER)
987-
if (ieee_is_nan(q_comm(i)%sf(j, k, l))) then
987+
if (ieee_is_nan(q_comm(i)%sf(j, k + unpack_offset, l))) then
988988
print *, "Error", j, k, l, i
989989
error stop "NaN(s) in recv"
990990
end if
@@ -1043,7 +1043,7 @@ contains
10431043
(l + buff_size)))
10441044
q_comm(i)%sf(j, k, l + unpack_offset) = real(buff_recv(r), kind=stp)
10451045
#if defined(__INTEL_COMPILER)
1046-
if (ieee_is_nan(q_comm(i)%sf(j, k, l))) then
1046+
if (ieee_is_nan(q_comm(i)%sf(j, k, l + unpack_offset))) then
10471047
print *, "Error", j, k, l, i
10481048
error stop "NaN(s) in recv"
10491049
end if

0 commit comments

Comments
 (0)