Skip to content

Commit 98c2a07

Browse files
committed
fixing missing variable when verbose=True
1 parent d38b29d commit 98c2a07

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

Diff for: mpisppy/opt/subgradient.py

+4-3
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,12 @@
88
###############################################################################
99

1010
import mpisppy.phbase
11-
import shutil
1211
import mpisppy.MPI as mpi
1312

1413
from pyomo.common.collections import ComponentSet
1514

15+
_global_rank = mpi.COMM_WORLD.Get_rank()
16+
1617
class Subgradient(mpisppy.phbase.PHBase):
1718
""" Subgradient Algorithm """
1819

@@ -46,11 +47,11 @@ def subgradient_main(self, finalize=True):
4647
self.PH_Prep(attach_prox=False, attach_smooth=smoothed)
4748

4849
if (verbose):
49-
print('Calling Subgradient Iter0 on global rank {}'.format(global_rank))
50+
print('Calling Subgradient Iter0 on global rank {}'.format(_global_rank))
5051
trivial_bound = self.Iter0()
5152
self.best_bound_obj_val = trivial_bound
5253
if (verbose):
53-
print ('Completed Subgradient Iter0 on global rank {}'.format(global_rank))
54+
print('Completed Subgradient Iter0 on global rank {}'.format(_global_rank))
5455

5556
self.iterk_loop()
5657

0 commit comments

Comments
 (0)