Skip to content

Commit 464f50c

Browse files
committed
foreach_inplace(A,B) needs to fence on entry and exit
1 parent 4f811c2 commit 464f50c

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

src/TiledArray/conversions/foreach.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -692,6 +692,10 @@ inline std::enable_if_t<!is_dense_v<Policy>, void> foreach_inplace(
692692
// Set the arg with the new array
693693
left = detail::foreach<true, Op, LeftTile, LeftTile, Policy, RightTile>(
694694
std::forward<Op>(op), shape_reduction, left, right);
695+
696+
// must also fence after to prevent remote ranks start work on unprocessed
697+
// tiles
698+
if (fence) left.world().gop.fence();
695699
}
696700

697701
/// @}

0 commit comments

Comments
 (0)