Skip to content

Commit

Permalink
import future annotations for type hints in python 3.8; remove bounds…
Browse files Browse the repository at this point in the history
… update from nonant LShapedHub update
  • Loading branch information
jmaack24 committed Jan 14, 2025
1 parent b070576 commit 7060142
Show file tree
Hide file tree
Showing 6 changed files with 17 additions and 7 deletions.
4 changes: 4 additions & 0 deletions mpisppy/cylinders/cross_scen_spoke.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@
# All rights reserved. Please see the files COPYRIGHT.md and LICENSE.md for
# full copyright and license information.
###############################################################################

# TODO Remove after this program no longer support Python 3.8
from __future__ import annotations

from mpisppy.cylinders.spcommunicator import communicator_array
from pyomo.repn.standard_repn import generate_standard_repn
from mpisppy import MPI
Expand Down
7 changes: 4 additions & 3 deletions mpisppy/cylinders/hub.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@
# All rights reserved. Please see the files COPYRIGHT.md and LICENSE.md for
# full copyright and license information.
###############################################################################

# TODO Remove after this program no longer support Python 3.8
from __future__ import annotations

import numpy as np
import abc
import logging
Expand Down Expand Up @@ -740,10 +744,7 @@ def send_nonants(self):
nonant_send_buffer[ci] = nonant_to_root_var_map[xvar]._value
ci += 1
logging.debug("hub is sending X nonants={}".format(nonant_send_buffer))
self._populate_boundsout_cache(nonant_send_buffer)

# for idx in self.nonant_spoke_indices:
# self.hub_to_spoke(nonant_send_buffer, idx)
my_nonants = self._sends[Field.NONANT]
self.hub_to_spoke(nonant_send_buffer, Field.NONANT, my_nonants.next_write_id())

Expand Down
2 changes: 1 addition & 1 deletion mpisppy/cylinders/lshaped_bounder.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ def main(self):
while not self.got_kill_signal():

if self.new_nonants:

self.opt._put_nonant_cache(self.localnonants)
self.opt._restore_nonants()
obj = self.opt.calculate_incumbent(fix_nonants=True)
Expand Down
5 changes: 4 additions & 1 deletion mpisppy/cylinders/spcommunicator.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,16 @@
Separate hub and spoke classes for memory/window management?
"""

# TODO Remove after this program no longer support Python 3.8
from __future__ import annotations

import numpy as np
import abc
import time

from mpisppy.cylinders.spwindow import Field, SPWindow


def communicator_array(size):
arr = np.empty(size+1)
arr[:] = np.nan
Expand Down
4 changes: 4 additions & 0 deletions mpisppy/cylinders/spoke.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@
# All rights reserved. Please see the files COPYRIGHT.md and LICENSE.md for
# full copyright and license information.
###############################################################################

# TODO Remove after this program no longer support Python 3.8
from __future__ import annotations

import numpy as np
import abc
import enum
Expand Down
2 changes: 0 additions & 2 deletions mpisppy/cylinders/spwindow.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,8 +70,6 @@ def __init__(self, my_fields: dict, strata_comm: MPI.Comm, field_order=None):
self.buff[offset + length - 1] = 0.0
## End for

# print(self.buff)

self.strata_buffer_layouts = strata_comm.allgather(self.buffer_layout)

self.window_constructed = True
Expand Down

0 comments on commit 7060142

Please sign in to comment.