Skip to content

Commit 6e2f8b2

Browse files
committed
#611: pushing the part that now works (still incomplete)
1 parent a52a6c3 commit 6e2f8b2

File tree

5 files changed

+32
-5
lines changed

5 files changed

+32
-5
lines changed

config/synthetic-blocks.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ work_model:
1212
parameters:
1313
beta: 0.0
1414
gamma: 0.0
15-
delta: 0.1
15+
delta: 0.0
1616
upper_bounds:
1717
max_memory_usage: 45.0
1818

src/lbaf/Execution/lbsTemperedWithUpdatesCriterion.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,8 @@ def compute(self, r_src: Rank, o_src: list, r_dst: Rank, o_dst: Optional[list]=N
6666
self._work_model.compute(r_src),
6767
self._work_model.compute(r_dst))
6868

69+
# Compute update formulae
70+
6971
# Move objects into proposed new arrangement
7072
self._phase.transfer_objects(r_src, o_src, r_dst, o_dst)
7173

src/lbaf/Model/lbsAffineCombinationWorkModel.py

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,6 @@ def affine_combination(self, a, l, v1, v2, h):
9393

9494
def compute(self, rank: Rank):
9595
"""A work model with affine combination of load and communication.
96-
9796
alpha * load + beta * max(sent, received) + gamma + delta * homing,
9897
under optional strict upper bounds.
9998
"""
@@ -111,3 +110,19 @@ def compute(self, rank: Rank):
111110
rank.get_received_volume(),
112111
rank.get_sent_volume(),
113112
rank.get_homing())
113+
114+
def update_load(self, rank: Rank, o_snd: list, o_rcv: list):
115+
"""Update total load if objects are to be sent and received."""
116+
return rank.get_load() + sum(
117+
o.get_load() for o in o_rcv) - sum(
118+
o.get_load() for o in o_snd)
119+
120+
def update(self, rank: Rank, o_snd: list, o_rcv: list):
121+
"""Update work if objects are to be sent and received."""
122+
# Return combination of load and volumes
123+
return self.affine_combination(
124+
rank.get_alpha(),
125+
rank.update_load(),
126+
rank.get_received_volume(),
127+
rank.get_sent_volume(),
128+
rank.get_homing())

src/lbaf/Model/lbsLoadOnlyWorkModel.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,11 @@ def __init__(self, _, lgr: Logger):
6060
self.__logger.info("Instantiated concrete work model")
6161

6262
def compute(self, rank: Rank):
63-
"""A work model summing all object loads on given rank."""
64-
# Return total load on this rank
63+
"""This work model only considers total object load."""
6564
return rank.get_load()
65+
66+
def update(self, rank: Rank, o_snd: list, o_rcv: list):
67+
"""Update total load if objects are to be sent and received."""
68+
return rank.get_load() + sum(
69+
o.get_load() for o in o_rcv) - sum(
70+
o.get_load() for o in o_snd)

src/lbaf/Model/lbsWorkModelBase.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,5 +79,10 @@ def factory(work_name, parameters, lgr: Logger):
7979

8080
@abc.abstractmethod
8181
def compute(self, rank):
82-
"""Return value of work for given rank."""
82+
"""Return value of work on given rank."""
83+
# Must be implemented by concrete subclass
84+
85+
@abc.abstractmethod
86+
def update(self, rank, o_snd, o_rcv):
87+
"""Compute updated work on given rank if sending and receiving objects."""
8388
# Must be implemented by concrete subclass

0 commit comments

Comments
 (0)