Skip to content

Commit 4e32552

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 e2bd6d9 commit 4e32552

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
@@ -936,7 +936,7 @@ contains
936936
(j + buff_size*((k + 1) + (n + 1)*l))
937937
q_comm(i)%sf(j + unpack_offset, k, l) = real(buff_recv(r), kind=stp)
938938
#if defined(__INTEL_COMPILER)
939-
if (ieee_is_nan(q_comm(i)%sf(j, k, l))) then
939+
if (ieee_is_nan(q_comm(i)%sf(j + unpack_offset, k, l))) then
940940
print *, "Error", j, k, l, i
941941
error stop "NaN(s) in recv"
942942
end if
@@ -991,7 +991,7 @@ contains
991991
((k + buff_size) + buff_size*l))
992992
q_comm(i)%sf(j, k + unpack_offset, l) = real(buff_recv(r), kind=stp)
993993
#if defined(__INTEL_COMPILER)
994-
if (ieee_is_nan(q_comm(i)%sf(j, k, l))) then
994+
if (ieee_is_nan(q_comm(i)%sf(j, k + unpack_offset, l))) then
995995
print *, "Error", j, k, l, i
996996
error stop "NaN(s) in recv"
997997
end if
@@ -1050,7 +1050,7 @@ contains
10501050
(l + buff_size)))
10511051
q_comm(i)%sf(j, k, l + unpack_offset) = real(buff_recv(r), kind=stp)
10521052
#if defined(__INTEL_COMPILER)
1053-
if (ieee_is_nan(q_comm(i)%sf(j, k, l))) then
1053+
if (ieee_is_nan(q_comm(i)%sf(j, k, l + unpack_offset))) then
10541054
print *, "Error", j, k, l, i
10551055
error stop "NaN(s) in recv"
10561056
end if

0 commit comments

Comments
 (0)