diff --git a/src/TiledArray/conversions/foreach.h b/src/TiledArray/conversions/foreach.h index 2c77c91a0f..9129d4b321 100644 --- a/src/TiledArray/conversions/foreach.h +++ b/src/TiledArray/conversions/foreach.h @@ -692,6 +692,10 @@ inline std::enable_if_t, void> foreach_inplace( // Set the arg with the new array left = detail::foreach( std::forward(op), shape_reduction, left, right); + + // must also fence after to prevent remote ranks start work on unprocessed + // tiles + if (fence) left.world().gop.fence(); } /// @}