Skip to content
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
1 change: 1 addition & 0 deletions src/dstack/_internal/core/backends/base/offers.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
"oci-spot",
"lambda-arm",
"gcp-a4",
"gcp-g4-preview",
]


Expand Down
8 changes: 7 additions & 1 deletion src/dstack/_internal/core/backends/gcp/compute.py
Original file line number Diff line number Diff line change
Expand Up @@ -130,13 +130,19 @@ def get_all_offers_with_availability(self) -> List[InstanceOfferWithAvailability
offer_keys_to_offers = {}
offers_with_availability = []
for offer in offers:
preview = False
if offer.instance.name.startswith("g4-standard-"):
if self.config.preview_features and "g4" in self.config.preview_features:
preview = True
else:
continue
region = offer.region[:-2] # strip zone
key = (_unique_instance_name(offer.instance), region)
if key in offer_keys_to_offers:
offer_keys_to_offers[key].availability_zones.append(offer.region)
continue
availability = InstanceAvailability.NO_QUOTA
if _has_gpu_quota(quotas[region], offer.instance.resources):
if preview or _has_gpu_quota(quotas[region], offer.instance.resources):
availability = InstanceAvailability.UNKNOWN
# todo quotas: cpu, memory, global gpu, tpu
offer_with_availability = InstanceOfferWithAvailability(
Expand Down
7 changes: 7 additions & 0 deletions src/dstack/_internal/core/backends/gcp/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,13 @@ class GCPBackendConfig(CoreModel):
description="The tags (labels) that will be assigned to resources created by `dstack`"
),
] = None
preview_features: Annotated[
Optional[List[Literal["g4"]]],
Field(
description=("The list of preview GCP features to enable. Supported values: `g4`"),
max_items=1,
),
] = None


class GCPBackendConfigWithCreds(GCPBackendConfig):
Expand Down
2 changes: 2 additions & 0 deletions src/dstack/_internal/core/backends/gcp/resources.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
{"accelerator_name": "nvidia-tesla-t4", "gpu_name": "T4", "memory_mb": 1024 * 16},
{"accelerator_name": "nvidia-tesla-v100", "gpu_name": "V100", "memory_mb": 1024 * 16},
{"accelerator_name": "nvidia-tesla-p100", "gpu_name": "P100", "memory_mb": 1024 * 16},
{"accelerator_name": "nvidia-rtx-pro-6000", "gpu_name": "RTXPRO6000", "memory_mb": 1024 * 96},
]


Expand Down Expand Up @@ -499,5 +500,6 @@ def instance_type_supports_persistent_disk(instance_type_name: str) -> bool:
"h3-",
"v6e",
"a4-",
"g4-",
]
)