Skip to content

Commit

Permalink
[FluidStack] Add Nvlink Accelerator Mappings (#3467)
Browse files Browse the repository at this point in the history
* Add A100-80GB and H100 Nvlink accelerator mappings

* Remove custom/configurable plans
  • Loading branch information
mjibril authored Apr 24, 2024
1 parent e7b812c commit f3be773
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 50 deletions.
41 changes: 3 additions & 38 deletions sky/clouds/service_catalog/data_fetchers/fetch_fluidstack.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
python fetch_fluidstack_cloud.py
"""

import copy
import csv
import json
import os
Expand All @@ -19,6 +18,8 @@

GPU_MAP = {
'H100_PCIE_80GB': 'H100',
'H100_NVLINK_80GB': 'H100',
'A100_NVLINK_80GB': 'A100-80GB',
'A100_SXM4_80GB': 'A100-80GB',
'A100_PCIE_80GB': 'A100-80GB',
'A100_SXM4_40GB': 'A100',
Expand All @@ -40,13 +41,6 @@
'RTX_3080_10GB': 'RTX3080',
}

CUSTOM_PLANS_CONFIG = [
dict(gpu_count=1, cpu_count=8, nvme_storage=750, ram=64),
dict(gpu_count=2, cpu_count=16, nvme_storage=1024, ram=128),
#dict(gpu_count=4, cpu_count=32, nvme_storage=1200, ram=160),
#dict(gpu_count=8, cpu_count=64, nvme_storage=1500, ram=200)
]


def get_regions(plans: List) -> dict:
"""Return a list of regions where the plan is available."""
Expand All @@ -57,45 +51,16 @@ def get_regions(plans: List) -> dict:
return regions


def plans_from_custom_plan(plan: dict) -> List[dict]:
prices = dict(cpu=plan['price']['cpu']['hourly'],
ram=plan['price']['ram']['hourly'],
storage=plan['price']['storage']['hourly'],
gpu=plan['price']['gpu']['hourly'])
new_plans = []
for i, config in enumerate(CUSTOM_PLANS_CONFIG):
new_plan = copy.deepcopy(plan)
price = (prices['cpu'] *
config['cpu_count']) + (prices['ram'] * config['ram']) + (
prices['storage'] * config['nvme_storage']) + (
prices['gpu'] * config['gpu_count'])
new_plan['price']['hourly'] = price / config['gpu_count']
new_plan['configuration']['core_count'] = config['cpu_count']
new_plan['configuration']['ram'] = config['ram']
new_plan['configuration']['gpu_count'] = config['gpu_count']
new_plan['configuration']['nvme_storage'] = config['nvme_storage']
new_plan['plan_id'] = f'custom:{i}:{plan["plan_id"]}'
new_plans.append(new_plan)
return new_plans


def create_catalog(output_dir: str) -> None:
response = requests.get(ENDPOINT)
plans = response.json()
custom_plans = [
plan for plan in plans if plan['minimum_commitment'] == 'hourly' and
plan['type'] in ['custom'] and plan['gpu_type'] != 'NO GPU'
]
#plans = [plan for plan in plans if len(plan['regions']) > 0]
plans = [
plan for plan in plans if plan['minimum_commitment'] == 'hourly' and
plan['type'] in ['preconfigured'] and
plan['gpu_type'] not in ['NO GPU', 'RTX_3080_10GB', 'RTX_3090_24GB']
]

plans = plans + [
plan for plan in custom_plans for plan in plans_from_custom_plan(plan)
]
with open(os.path.join(output_dir, 'vms.csv'), mode='w',
encoding='utf-8') as f:
writer = csv.writer(f, delimiter=',', quotechar='"')
Expand All @@ -114,7 +79,7 @@ def create_catalog(output_dir: str) -> None:
try:
gpu = GPU_MAP[plan['gpu_type']]
except KeyError:
print(f'Could not map {plan["gpu_type"]}')
#print(f'Could not map {plan["gpu_type"]}')
continue
gpu_memory = int(
str(plan['configuration']['gpu_memory']).replace('GB',
Expand Down
13 changes: 1 addition & 12 deletions sky/provision/fluidstack/fluidstack_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,6 @@

import requests

from sky.clouds.service_catalog.data_fetchers import fetch_fluidstack


def get_key_suffix():
return str(uuid.uuid4()).replace('-', '')[:8]
Expand Down Expand Up @@ -119,17 +117,8 @@ def create_instance(
) -> List[str]:
"""Launch new instances."""

config = {}
config: Dict[str, Any] = {}
plans = self.get_plans()
if 'custom' in instance_type:
values = instance_type.split(':')
index = values[1]
instance_type = values[2]
config = fetch_fluidstack.CUSTOM_PLANS_CONFIG[int(index)]
plan = [plan for plan in plans if plan['plan_id'] == instance_type
][0]
config['gpu_model'] = plan['gpu_type']

regions = self.list_regions()
plans = [
plan for plan in plans if plan['plan_id'] == instance_type and
Expand Down

0 comments on commit f3be773

Please sign in to comment.