Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Account for multiple nodes in optimizer cost #277

Merged
merged 5 commits into from
Feb 11, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 6 additions & 3 deletions prototype/sky/optimizer.py
Original file line number Diff line number Diff line change
Expand Up @@ -231,7 +231,8 @@ def _optimize_cost(
logger.debug(f'resources: {resources}')

if minimize_cost:
estimated_cost = resources.get_cost(estimated_runtime)
cost_per_node = resources.get_cost(estimated_runtime)
estimated_cost = cost_per_node * node.num_nodes
else:
# Minimize run time; overload the term 'cost'.
estimated_cost = estimated_runtime
Expand All @@ -244,6 +245,7 @@ def _optimize_cost(
' estimated_cost (not incl. egress): ${:.1f}'.
format(estimated_cost))

# FIXME: Account for egress costs for multi-node clusters
sum_parent_cost_and_egress = 0
for parent in parents:
min_pred_cost_plus_egress = np.inf
Expand Down Expand Up @@ -320,8 +322,9 @@ def _walk(node, best_hardware, best_cost):
overall_best / 3600))
# Do not print Source or Sink.
message_data = [
t for t in message_data
if t[0].name not in (_DUMMY_SOURCE_NAME, _DUMMY_SINK_NAME)
(t, f'{t.num_nodes}x {repr(r)}' if t.num_nodes > 1 else repr(r))
for (t, r) in message_data
if t.name not in (_DUMMY_SOURCE_NAME, _DUMMY_SINK_NAME)
]
message = tabulate.tabulate(reversed(message_data),
headers=['TASK', 'BEST_RESOURCE'],
Expand Down
2 changes: 2 additions & 0 deletions prototype/sky/task.py
Original file line number Diff line number Diff line change
Expand Up @@ -486,6 +486,8 @@ def __repr__(self):
s += f'\n inputs: {self.inputs}'
if self.outputs is not None:
s += f'\n outputs: {self.outputs}'
if self.num_nodes > 1:
s += f'\n nodes: {self.num_nodes}'
if len(self.resources) > 1 or not list(self.resources)[0].is_empty():
s += f'\n resources: {self.resources}'
else:
Expand Down