Skip to content

Commit 1a52617

Browse files
[GCP] Support G4 preview instance type (#3181)
* [GCP] Support G4 preview instance type #3155 * [GCP] Support G4 preview instance type #3155 Review
1 parent 8a5e932 commit 1a52617

File tree

4 files changed

+17
-1
lines changed

4 files changed

+17
-1
lines changed

src/dstack/_internal/core/backends/base/offers.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
"oci-spot",
2424
"lambda-arm",
2525
"gcp-a4",
26+
"gcp-g4-preview",
2627
]
2728

2829

src/dstack/_internal/core/backends/gcp/compute.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -130,13 +130,19 @@ def get_all_offers_with_availability(self) -> List[InstanceOfferWithAvailability
130130
offer_keys_to_offers = {}
131131
offers_with_availability = []
132132
for offer in offers:
133+
preview = False
134+
if offer.instance.name.startswith("g4-standard-"):
135+
if self.config.preview_features and "g4" in self.config.preview_features:
136+
preview = True
137+
else:
138+
continue
133139
region = offer.region[:-2] # strip zone
134140
key = (_unique_instance_name(offer.instance), region)
135141
if key in offer_keys_to_offers:
136142
offer_keys_to_offers[key].availability_zones.append(offer.region)
137143
continue
138144
availability = InstanceAvailability.NO_QUOTA
139-
if _has_gpu_quota(quotas[region], offer.instance.resources):
145+
if preview or _has_gpu_quota(quotas[region], offer.instance.resources):
140146
availability = InstanceAvailability.UNKNOWN
141147
# todo quotas: cpu, memory, global gpu, tpu
142148
offer_with_availability = InstanceOfferWithAvailability(

src/dstack/_internal/core/backends/gcp/models.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,13 @@ class GCPBackendConfig(CoreModel):
8989
description="The tags (labels) that will be assigned to resources created by `dstack`"
9090
),
9191
] = None
92+
preview_features: Annotated[
93+
Optional[List[Literal["g4"]]],
94+
Field(
95+
description=("The list of preview GCP features to enable. Supported values: `g4`"),
96+
max_items=1,
97+
),
98+
] = None
9299

93100

94101
class GCPBackendConfigWithCreds(GCPBackendConfig):

src/dstack/_internal/core/backends/gcp/resources.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
{"accelerator_name": "nvidia-tesla-t4", "gpu_name": "T4", "memory_mb": 1024 * 16},
2727
{"accelerator_name": "nvidia-tesla-v100", "gpu_name": "V100", "memory_mb": 1024 * 16},
2828
{"accelerator_name": "nvidia-tesla-p100", "gpu_name": "P100", "memory_mb": 1024 * 16},
29+
{"accelerator_name": "nvidia-rtx-pro-6000", "gpu_name": "RTXPRO6000", "memory_mb": 1024 * 96},
2930
]
3031

3132

@@ -499,5 +500,6 @@ def instance_type_supports_persistent_disk(instance_type_name: str) -> bool:
499500
"h3-",
500501
"v6e",
501502
"a4-",
503+
"g4-",
502504
]
503505
)

0 commit comments

Comments
 (0)