Skip to content

Commit 061756a

Browse files
authored
Merge pull request #132 from Pyomo/iteration_limit_barrier
2 parents 4c036d3 + c798adc commit 061756a

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

mpisppy/phbase.py

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -879,8 +879,14 @@ def iterk_loop(self):
879879
if dconvergence_detail:
880880
self.report_var_values_at_rank0(header="Convergence detail:")
881881

882-
if (self._PHIter == max_iterations):
883-
global_toc("Reached user-specified limit=%d on number of PH iterations" % max_iterations, self.cylinder_rank == 0)
882+
else: # no break, (self._PHIter == max_iterations)
883+
# NOTE: If we return for any other reason things are reasonably in-sync.
884+
# due to the convergence check. However, here we return we'll be
885+
# out-of-sync because of the solve_loop could take vasty different
886+
# times on different threads. This can especially mess up finalization.
887+
# As a guard, we'll put a barrier here.
888+
self.mpicomm.Barrier()
889+
global_toc("Reached user-specified limit=%d on number of PH iterations" % max_iterations, self.cylinder_rank == 0)
884890

885891

886892
def post_loops(self, extensions=None):

0 commit comments

Comments
 (0)