Skip to content

Commit f83822b

Browse files
authored
Add GCS updates to GKE A4X (GoogleCloudPlatform#4864)
2 parents 06db73a + cca26b8 commit f83822b

2 files changed

Lines changed: 145 additions & 0 deletions

File tree

examples/gke-a4x/gke-a4x.yaml

Lines changed: 142 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -178,6 +178,24 @@ deployment_groups:
178178
- storage.objectAdmin
179179
- artifactregistry.reader
180180

181+
- id: training_bucket
182+
source: community/modules/file-system/cloud-storage-bucket
183+
settings:
184+
local_mount: /training-data
185+
name_prefix: training
186+
random_suffix: true
187+
force_destroy: false
188+
enable_hierarchical_namespace: true
189+
190+
- id: checkpoint_bucket
191+
source: community/modules/file-system/cloud-storage-bucket
192+
settings:
193+
local_mount: /checkpoint-data
194+
name_prefix: checkpoint
195+
random_suffix: true
196+
force_destroy: false
197+
enable_hierarchical_namespace: true
198+
181199
- id: a4x-cluster
182200
source: modules/scheduler/gke-cluster
183201
use: [gke-a4x-net-0, workload_service_account]
@@ -364,3 +382,127 @@ deployment_groups:
364382
value: arm64
365383
effect: NoSchedule
366384
outputs: [instructions]
385+
386+
# Create a remote mount of training_bucket using
387+
# mount options optimized for reading training data.
388+
# Based on Source of truth https://github.com/GoogleCloudPlatform/gcsfuse/blob/d1373b665b7f60e98856d2181f1193396ef16427/samples/gke-csi-yaml/gpu/checkpointing-pv.yaml#L15
389+
# Some of the options might be available only on latest GKE version, please check the cluster version to meet the required version https://cloud.google.com/kubernetes-engine/docs/how-to/cloud-storage-fuse-csi-driver-perf
390+
- id: gcs-training
391+
source: modules/file-system/pre-existing-network-storage
392+
settings:
393+
remote_mount: $(training_bucket.gcs_bucket_name)
394+
local_mount: /training-data
395+
fs_type: gcsfuse
396+
mount_options: "implicit-dirs,metadata-cache:ttl-secs:-1,metadata-cache:stat-cache-max-size-mb:-1,metadata-cache:type-cache-max-size-mb:-1,file-cache:max-size-mb:-1,file-cache:cache-file-for-range-read:true"
397+
398+
# Create a remote mount of checkpoint_bucket using mount
399+
# options optimized for writing and reading checkpoint data.
400+
# Based on Source of truth https://github.com/GoogleCloudPlatform/gcsfuse/blob/d1373b665b7f60e98856d2181f1193396ef16427/samples/gke-csi-yaml/gpu/checkpointing-pv.yaml#L15
401+
# Some of the options might be available only on latest GKE version, please check the cluster version to meet the required version https://cloud.google.com/kubernetes-engine/docs/how-to/cloud-storage-fuse-csi-driver-perf
402+
- id: gcs-checkpointing
403+
source: modules/file-system/pre-existing-network-storage
404+
settings:
405+
remote_mount: $(checkpoint_bucket.gcs_bucket_name)
406+
local_mount: /checkpoint-data
407+
fs_type: gcsfuse
408+
mount_options: "implicit-dirs,metadata-cache:ttl-secs:-1,metadata-cache:stat-cache-max-size-mb:-1,metadata-cache:type-cache-max-size-mb:-1,file-cache:max-size-mb:-1,file-cache:cache-file-for-range-read:true,file-cache:enable-parallel-downloads:true,rename-dir-limit=200000"
409+
410+
# Persistent Volume for training data
411+
- id: training-pv
412+
source: modules/file-system/gke-persistent-volume
413+
use: [gcs-training, a4x-cluster]
414+
settings:
415+
gcs_bucket_name: $(training_bucket.gcs_bucket_name)
416+
capacity_gib: 1000000
417+
418+
# Persistent Volume for checkpoint data
419+
- id: checkpointing-pv
420+
source: modules/file-system/gke-persistent-volume
421+
use: [gcs-checkpointing, a4x-cluster]
422+
settings:
423+
gcs_bucket_name: $(checkpoint_bucket.gcs_bucket_name)
424+
capacity_gib: 1000000
425+
426+
# This is an example job that will install and run an `fio`
427+
# benchmark against the training and checkpointing buckets.
428+
- id: fio-bench-job-template
429+
source: modules/compute/gke-job-template
430+
use: [checkpointing-pv, training-pv, a4x-pool]
431+
settings:
432+
security_context: # to make sure the job have enough access to install the fio packages
433+
- key: runAsUser
434+
value: 0
435+
- key: runAsGroup
436+
value: 100
437+
- key: fsGroup
438+
value: 100
439+
# By adding an ephemeral volume, this will ensure that the job adds:
440+
# nodeSelector:
441+
# cloud.google.com/gke-ephemeral-storage-local-ssd: "true"
442+
# which is the best practice for using local-ssd for ephemeral storage.
443+
ephemeral_volumes:
444+
- type: local-ssd
445+
mount_path: /scratch-data
446+
size_gb: 1000 # Use 1 out of 12 TB for local scratch
447+
448+
k8s_service_account_name: workload-identity-k8s-sa
449+
image: ubuntu:22.04
450+
tolerations:
451+
- key: kubernetes.io/arch
452+
operator: Equal
453+
value: arm64
454+
effect: NoSchedule
455+
456+
command:
457+
- bash
458+
- -c
459+
- |
460+
461+
set -eux
462+
export DEBIAN_FRONTEND=noninteractive
463+
464+
# Install fio
465+
apt update -y && apt install -y fio
466+
467+
# Use a tag to create a unique path for tests
468+
TAG=`date +%s`
469+
470+
# Verify mountpoints
471+
df -h
472+
mountpoint /scratch-data
473+
mountpoint /checkpoint-data
474+
mountpoint /training-data
475+
476+
# Create temporary directory for fio benchmarks
477+
mkdir -p /{scratch,training,checkpoint}-data/fio-benchmarks-${TAG}
478+
479+
# The following will take roughly 10 minutes to complete
480+
481+
# Perform scratch data write performance test
482+
fio --ioengine=libaio --filesize=10G --ramp_time=2s --runtime=1m \
483+
--numjobs=32 --create_serialize=0 --direct=1 --verify=0 \
484+
--randrepeat=0 --group_reporting --directory=/scratch-data/fio-benchmarks-${TAG} \
485+
--name=scratch --blocksize=100m --iodepth=64 --readwrite=write
486+
487+
# Perform training data reading performance test
488+
fio --ioengine=libaio --filesize=1G --ramp_time=2s --runtime=1m \
489+
--numjobs=32 --create_serialize=0 --direct=1 --verify=0 \
490+
--randrepeat=0 --group_reporting --directory=/training-data/fio-benchmarks-${TAG} \
491+
--name=training --blocksize=1m --iodepth=64 --readwrite=randread
492+
493+
# Perform checkpoint data writing performance test
494+
fio --ioengine=libaio --filesize=10G --ramp_time=2s --runtime=1m \
495+
--numjobs=32 --create_serialize=0 --direct=1 --verify=0 \
496+
--randrepeat=0 --group_reporting --directory=/checkpoint-data/fio-benchmarks-${TAG} \
497+
--name=checkpoint --blocksize=100m --iodepth=64 --readwrite=write
498+
499+
# Perform checkpoint data reading performance test
500+
fio --ioengine=libaio --filesize=10G --ramp_time=2s --runtime=1m \
501+
--numjobs=32 --create_serialize=0 --direct=1 --verify=0 \
502+
--randrepeat=0 --group_reporting --directory=/checkpoint-data/fio-benchmarks-${TAG} \
503+
--name=checkpoint --blocksize=100m --iodepth=64 --readwrite=read
504+
505+
# Clean up temporary directories for fio benchmarks
506+
rm -rf /{scratch,training,checkpoint}-data/fio-benchmarks-${TAG}
507+
508+
outputs: [instructions]

tools/cloud-build/daily-tests/builds/gke-a4x.yaml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,9 @@ tags:
2323
- m.kubectl-apply
2424
- m.gke-job-template
2525
- gke
26+
- m.cloud-storage-bucket
27+
- m.gke-persistent-volume
28+
- m.pre-existing-network-storage
2629

2730
timeout: 7200s
2831

0 commit comments

Comments
 (0)