Skip to content

Commit

Permalink
Always check MPI buffer size for overflow
Browse files Browse the repository at this point in the history
Always check MPI buffer size for overflow. This check is very fast compared to the overall communication time.
  • Loading branch information
eschnett authored Dec 31, 2019
1 parent 04f34c9 commit ff3264f
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions Src/Base/AMReX_FabArrayCommI.H
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ FabArray<FAB>::FBEP_nowait (int scomp, int ncomp, const IntVect& nghost,
nbytes += (*this)[cct.srcIndex].nBytes(cct.sbox,scomp,ncomp);
}

BL_ASSERT(nbytes < std::size_t(std::numeric_limits<int>::max()));
AMREX_ALWAYS_ASSERT(nbytes < std::size_t(std::numeric_limits<int>::max()));

total_volume += nbytes;

Expand Down Expand Up @@ -448,7 +448,7 @@ FabArray<FAB>::ParallelCopy (const FabArray<FAB>& src,
nbytes += src[cct.srcIndex].nBytes(cct.sbox,SC,NC);
}

BL_ASSERT(nbytes < std::size_t(std::numeric_limits<int>::max()));
AMREX_ALWAYS_ASSERT(nbytes < std::size_t(std::numeric_limits<int>::max()));

total_volume += nbytes;

Expand Down Expand Up @@ -672,7 +672,7 @@ FabArray<FAB>::PostRcvs (const MapOfCopyComTagContainers& m_RcvTags,
nbytes += (*this)[cct.dstIndex].nBytes(cct.dbox,icomp,ncomp);
}

BL_ASSERT(nbytes < std::size_t(std::numeric_limits<int>::max()));
AMREX_ALWAYS_ASSERT(nbytes < std::size_t(std::numeric_limits<int>::max()));

TotalRcvsVolume += nbytes;

Expand Down

0 comments on commit ff3264f

Please sign in to comment.