-
Notifications
You must be signed in to change notification settings - Fork 32
/
Copy pathstart_cluster.sh
executable file
·66 lines (58 loc) · 1.78 KB
/
start_cluster.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
#!/bin/bash
cluster_type=${1:-gpu}
# configure arguments
if [[ -z ${COMPUTE_REGION} ]]; then
echo "Please export COMPUTE_REGION per README.md"
exit 1
fi
if [[ -z ${GCS_BUCKET} ]]; then
echo "Please export GCS_BUCKET per README.md"
exit 1
fi
BENCHMARK_HOME=${BENCHMARK_HOME:-${GCS_BUCKET}/benchmark}
gpu_args=$(cat <<EOF
--master-accelerator type=nvidia-tesla-t4,count=1
--worker-accelerator type=nvidia-tesla-t4,count=1
--initialization-actions gs://${BENCHMARK_HOME}/spark-rapids.sh,gs://${BENCHMARK_HOME}/init_benchmark.sh
--metadata gpu-driver-provider="NVIDIA"
--metadata rapids-runtime=SPARK
--metadata benchmark-home=${BENCHMARK_HOME}
EOF
)
cpu_args=$(cat <<EOF
--initialization-actions gs://${BENCHMARK_HOME}/init_benchmark.sh
EOF
)
if [[ ${cluster_type} == "gpu" ]]; then
extra_args=${gpu_args}
elif [[ ${cluster_type} == "cpu" ]]; then
extra_args=${cpu_args}
else
echo "unknown cluster type ${cluster_type}"
echo "usage: ./${script_name} cpu|gpu"
exit 1
fi
# start cluster if not already running
cluster_name=${CLUSTER_NAME:-"${USER}-spark-rapids-ml-${cluster_type}"}
gcloud dataproc clusters list | grep "${cluster_name}"
if [[ $? == 0 ]]; then
echo "WARNING: Cluster ${cluster_name} is already started."
else
set -x
gcloud dataproc clusters create ${cluster_name} \
--image-version=2.1-ubuntu \
--region ${COMPUTE_REGION} \
--master-machine-type n1-standard-16 \
--num-workers 2 \
--worker-min-cpu-platform="Intel Skylake" \
--worker-machine-type n1-standard-16 \
--num-worker-local-ssds 4 \
--worker-local-ssd-interface=NVME \
${extra_args} \
--optional-components=JUPYTER \
--bucket ${GCS_BUCKET} \
--enable-component-gateway \
--max-idle "30m" \
--subnet=default \
--no-shielded-secure-boot
fi