Skip to content

Commit e4dbaf1

Browse files
Merge pull request GoogleCloudPlatform#4740 from rachit-google/h4dblueprint_refactoring
H4d blueprint refactored
2 parents 35e73d1 + d2e7227 commit e4dbaf1

5 files changed

Lines changed: 95 additions & 4 deletions

File tree

examples/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1049,7 +1049,7 @@ that have local ssd drives deployed.
10491049
Creates a basic auto-scaling Slurm cluster with mostly default settings. The
10501050
blueprint also creates two new VPC networks, one configured for RDMA networking and the other for non-RDMA networking, along with two filestore instances mounted to `/home` and `/apps`. There is an `h4d` partition that uses compute-optimized `h4d-highmem-192-lssd` machine type.
10511051

1052-
[hpc-slurm-h4d.yaml]: ../examples/hpc-slurm-h4d.yaml
1052+
[hpc-slurm-h4d.yaml]: ../examples/hpc-slurm-h4d/hpc-slurm-h4d.yaml
10531053

10541054
### [hpc-slinky.yaml] ![community-badge] ![experimental-badge]
10551055

examples/hpc-slurm-h4d/README.md

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
# Slurm H4d Blueprints
2+
3+
## Slurm clusters
4+
For further information on deploying an H4d cluster with Slurm, please
5+
see:
6+
7+
[Create an RDMA-enabled HPC Slurm cluster with H4D instances](https://cloud.google.com/compute/docs/hpc/create-a-slurm-cluster-h4d)
8+
9+
## Configuration
10+
11+
Before deploying, you need to edit the `hpc-slurm-h4d/hpc-slurm-h4d-deployment.yaml` file to match your Google Cloud environment and requirements.
12+
13+
Key variables to update in `vars`:
14+
15+
* `bucket`: Inside `terraform_backend_defaults.configuration`, replace `BUCKET_NAME` with the name of your GCS bucket for Terraform state.
16+
* `project_id`: Your Google Cloud Project ID.
17+
* `deployment_name`: A unique name for this deployment (e.g., `slurm-h4d-test`).
18+
* `region`: The Google Cloud region for deployment (e.g., `us-central1`).
19+
* `zone`: The Google Cloud zone for deployment (e.g., `us-central1-a`).
20+
* `h4d_cluster_size`:The number of static nodes in the cluster.
21+
* `h4d_reservation_name`: Reservation name if using reserved instances
22+
23+
### Additional ways to provision
24+
Cluster toolkit also supports DWS Flex-Start, Spot VMs, as well as reservations as ways to provision instances.
25+
26+
[For more information on DWS Flex-Start in Slurm](https://github.com/GoogleCloudPlatform/cluster-toolkit/blob/main/docs/slurm-dws-flex.md)
27+
[For more information on Spot VMs](https://cloud.google.com/compute/docs/instances/spot)
28+
29+
We provide ways to enable the alternative provisioning models in the
30+
`hpc-slurm-h4d-deployment.yaml` file.
31+
32+
To make use of these other models, replace `h4d_reservation_name:` in the
33+
deployment file with the variable of choice below.
34+
35+
`h4d_enable_spot_vm: true` for spot or `h4d_dws_flex_enabled: true` for DWS Flex-Start.
36+
37+
## Deployment Steps
38+
39+
1. Navigate to the root directory of your Cluster Toolkit checkout or the directory containing the `hpc-slurm-h4d` folder.
40+
2. Run the `./gcluster deploy` command, providing the `hpc-slurm-h4d-deployment.yaml` as the deployment file. The `gcluster` tool will use this file to resolve variables in the `hpc-slurm-h4d.yaml` located in the same directory.
41+
42+
```bash
43+
./gcluster deploy -d examples/hpc-slurm-h4d/hpc-slurm-h4d-deployment.yaml examples/hpc-slurm-h4d/hpc-slurm-h4d.yaml -w --auto-approve
44+
```
45+
46+
* `-w`: Use this flag to force an overwrite of any existing deployment artifacts and configurations from a previous run *with the same deployment name*. (e.g., `slurm-h4d`).
47+
* `--auto-approve`: Automatically approves the Terraform apply step. Omit this if you want to review the plan first.
48+
49+
The tool will create a deployment folder (e.g., `slurm-h4d`), generate Terraform files, and then apply them to create the resources in your GCP project.
50+
51+
## Clean Up
52+
53+
```bash
54+
#!/bin/bash
55+
./gcluster destroy [DEPLOYMENT_FOLDER] --auto-approve
56+
```
57+
58+
Replace [DEPLOYMENT_FOLDER] with the appropriate value.
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
# Copyright 2025 Google LLC
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# http://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
---
15+
terraform_backend_defaults:
16+
type: gcs
17+
configuration:
18+
# The GCS bucket used for storing terraform state
19+
bucket: # Bucket Name
20+
21+
vars:
22+
# --- Required Variables ---
23+
project_id: # GCP Project ID
24+
deployment_name: # Unique name for the deployment
25+
region: # GCP region for the deployment
26+
zone: # GCP zone for the deployment
27+
h4d_cluster_size: # Number of Nodes in the Cluster
28+
h4d_reservation_name: # Specify a reservation name if using reserved instances
29+
30+
# Additional provisioning models (pick only one), can be used to substitute `h4d_reservation_name`:
31+
# h4d_dws_flex_enabled: false # Set to true to use Dynamic Workload Scheduler (DWS) Flex-Start, for more info visit: https://github.com/GoogleCloudPlatform/cluster-toolkit/blob/main/docs/slurm-dws-flex.md
32+
# h4d_enable_spot_vm: false # Set to true to use Spot VMs for H4D nodes, for more info visit: https://cloud.google.com/compute/docs/instances/spot
Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,10 +22,11 @@ vars:
2222
instance_image:
2323
family: slurm-gcp-6-11-hpc-rocky-linux-8
2424
project: schedmd-slurm-public
25+
h4d_cluster_size: 2
2526

2627
#Provisioning model, select one, lack of selection will rely on on-demand capacity
27-
h4d_dws_flex_enabled: false
2828
h4d_reservation_name: ""
29+
h4d_dws_flex_enabled: false
2930
h4d_enable_spot_vm: false
3031

3132
# Documentation for each of the modules used below can be found at
@@ -83,7 +84,7 @@ deployment_groups:
8384
allow_automatic_updates: false
8485
bandwidth_tier: gvnic_enabled
8586
machine_type: h4d-highmem-192-lssd
86-
node_count_static: 2
87+
node_count_static: $(vars.h4d_cluster_size)
8788
node_count_dynamic_max: 0
8889
enable_placement: false
8990
enable_spot_vm: $(vars.h4d_enable_spot_vm)

tools/validate_configs/validate_configs.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ check_background() {
120120
fi
121121
}
122122

123-
CONFIGS=$(find examples/ community/examples/ tools/validate_configs/test_configs/ docs/tutorials/ docs/videos/build-your-own-blueprint/ -name "*.yaml" -type f -not -path 'examples/machine-learning/a3-megagpu-8g/*' -not -path 'examples/machine-learning/a3-ultragpu-8g/*' -not -path 'examples/machine-learning/build-service-images/*' -not -path 'examples/gke-a3-ultragpu/*' -not -path 'examples/hypercompute_clusters/*' -not -path 'examples/gke-consumption-options/*' -not -path 'examples/gke-a4/*' -not -path 'examples/gke-a3-megagpu/*' -not -path 'examples/machine-learning/a4-highgpu-8g/*' -not -path 'examples/machine-learning/a4x-highgpu-4g/*' -not -path 'community/examples/gke-tpu-v6/*' -not -path 'community/examples/xpk-n2-filestore/*' -not -path 'examples/gke-a4x/*' -not -path 'examples/science/af3-slurm/*' -not -path 'examples/gke-h4d/*' -not -path 'community/examples/hpc-slinky/*' -not -path 'examples/gke-g4/*' -not -path 'community/examples/slurm-gke/*')
123+
CONFIGS=$(find examples/ community/examples/ tools/validate_configs/test_configs/ docs/tutorials/ docs/videos/build-your-own-blueprint/ -name "*.yaml" -type f -not -path 'examples/machine-learning/a3-megagpu-8g/*' -not -path 'examples/machine-learning/a3-ultragpu-8g/*' -not -path 'examples/machine-learning/build-service-images/*' -not -path 'examples/gke-a3-ultragpu/*' -not -path 'examples/hypercompute_clusters/*' -not -path 'examples/gke-consumption-options/*' -not -path 'examples/gke-a4/*' -not -path 'examples/gke-a3-megagpu/*' -not -path 'examples/machine-learning/a4-highgpu-8g/*' -not -path 'examples/machine-learning/a4x-highgpu-4g/*' -not -path 'community/examples/gke-tpu-v6/*' -not -path 'community/examples/xpk-n2-filestore/*' -not -path 'examples/gke-a4x/*' -not -path 'examples/science/af3-slurm/*' -not -path 'examples/gke-h4d/*' -not -path 'community/examples/hpc-slinky/*' -not -path 'examples/gke-g4/*' -not -path 'community/examples/slurm-gke/*' -not -path 'examples/hpc-slurm-h4d/*')
124124
# Exclude blueprints that use v5 modules.
125125
declare -A EXCLUDE_EXAMPLE
126126
EXCLUDE_EXAMPLE["tools/validate_configs/test_configs/two-clusters-sql.yaml"]=

0 commit comments

Comments
 (0)