Skip to content

Commit eb01419

Browse files
authored
Merge pull request #540 from ValeevGroup/evaleev/fix/foreach-inplace-binary-needs-fence-on-exit
`foreach_inplace(A,B)` needs to fence on entry and exit
2 parents 4f811c2 + 464f50c commit eb01419

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)