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

[Optimizer] List GPU Instances When a Large Number of CPUs are Requested #3975

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
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: 8 additions & 1 deletion sky/clouds/service_catalog/aws_catalog.py
Original file line number Diff line number Diff line change
Expand Up @@ -238,7 +238,14 @@ def get_default_instance_type(
instance_type_prefix = tuple(
f'{family}.' for family in _DEFAULT_INSTANCE_FAMILY)
df = _get_df()
df = df[df['InstanceType'].str.startswith(instance_type_prefix)]

default_instance_type_df = df[df['InstanceType'].str.startswith(
instance_type_prefix)]
default_instance_type = common.get_instance_type_for_cpus_mem_impl(
default_instance_type_df, cpus, memory_gb_or_ratio)
if default_instance_type is not None:
return default_instance_type

return common.get_instance_type_for_cpus_mem_impl(df, cpus,
memory_gb_or_ratio)

Expand Down
12 changes: 9 additions & 3 deletions sky/clouds/service_catalog/azure_catalog.py
Original file line number Diff line number Diff line change
Expand Up @@ -106,14 +106,20 @@ def get_default_instance_type(
memory_gb_or_ratio = f'{_DEFAULT_MEMORY_CPU_RATIO}x'
else:
memory_gb_or_ratio = memory
df = _df[_df['InstanceType'].apply(_get_instance_family).isin(
_DEFAULT_INSTANCE_FAMILY)]

def _filter_disk_type(instance_type: str) -> bool:
valid, _ = Azure.check_disk_tier(instance_type, disk_tier)
return valid

df = df.loc[df['InstanceType'].apply(_filter_disk_type)]
df = _df.loc[_df['InstanceType'].apply(_filter_disk_type)]

default_instance_type_df = _df[_df['InstanceType'].apply(
_get_instance_family).isin(_DEFAULT_INSTANCE_FAMILY)]
default_instance_type = common.get_instance_type_for_cpus_mem_impl(
default_instance_type_df, cpus, memory_gb_or_ratio)
if default_instance_type is not None:
return default_instance_type

return common.get_instance_type_for_cpus_mem_impl(df, cpus,
memory_gb_or_ratio)

Expand Down
9 changes: 8 additions & 1 deletion sky/clouds/service_catalog/gcp_catalog.py
Original file line number Diff line number Diff line change
Expand Up @@ -253,13 +253,20 @@ def get_default_instance_type(
instance_type_prefix = tuple(
f'{family}-' for family in _DEFAULT_INSTANCE_FAMILY)
df = _df[_df['InstanceType'].notna()]
df = df[df['InstanceType'].str.startswith(instance_type_prefix)]

def _filter_disk_type(instance_type: str) -> bool:
valid, _ = GCP.check_disk_tier(instance_type, disk_tier)
return valid

df = df.loc[df['InstanceType'].apply(_filter_disk_type)]

default_instance_type_df = df[df['InstanceType'].str.startswith(
instance_type_prefix)]
default_instance_type = common.get_instance_type_for_cpus_mem_impl(
default_instance_type_df, cpus, memory_gb_or_ratio)
if default_instance_type is not None:
return default_instance_type

return common.get_instance_type_for_cpus_mem_impl(df, cpus,
memory_gb_or_ratio)

Expand Down
11 changes: 9 additions & 2 deletions sky/clouds/service_catalog/ibm_catalog.py
Original file line number Diff line number Diff line change
Expand Up @@ -105,8 +105,15 @@ def get_default_instance_type(
else:
memory_gb_or_ratio = memory
instance_type_prefix = f'{_DEFAULT_INSTANCE_FAMILY}-'
df = _df[_df['InstanceType'].str.startswith(instance_type_prefix)]
return common.get_instance_type_for_cpus_mem_impl(df, cpus,

default_instance_type_df = _df[_df['InstanceType'].str.startswith(
instance_type_prefix)]
default_instance_type = common.get_instance_type_for_cpus_mem_impl(
default_instance_type_df, cpus, memory_gb_or_ratio)
if default_instance_type is not None:
return default_instance_type

return common.get_instance_type_for_cpus_mem_impl(_df, cpus,
memory_gb_or_ratio)


Expand Down
Loading