Add -g option
This commit is contained in:
parent
ec3e62dd58
commit
6ffe205447
18
net/gce.sh
18
net/gce.sh
|
@ -9,11 +9,11 @@ source "$here"/common.sh
|
||||||
prefix=testnet-dev-$(whoami | sed -e s/[^a-z0-9].*//)
|
prefix=testnet-dev-$(whoami | sed -e s/[^a-z0-9].*//)
|
||||||
validatorNodeCount=5
|
validatorNodeCount=5
|
||||||
clientNodeCount=1
|
clientNodeCount=1
|
||||||
leaderMachineType=n1-standard-1
|
leaderMachineType=n1-standard-16
|
||||||
leaderAccelerator= # "count=4,type=nvidia-tesla-k80"
|
leaderAccelerator=
|
||||||
validatorMachineType=$leaderMachineType
|
validatorMachineType=n1-standard-4
|
||||||
validatorAccelerator=
|
validatorAccelerator=
|
||||||
clientMachineType=$leaderMachineType
|
clientMachineType=n1-standard-16
|
||||||
clientAccelerator=
|
clientAccelerator=
|
||||||
|
|
||||||
imageName="ubuntu-16-04-cuda-9-2-new"
|
imageName="ubuntu-16-04-cuda-9-2-new"
|
||||||
|
@ -36,8 +36,8 @@ Configure a GCE-based testnet
|
||||||
delete - delete the testnet
|
delete - delete the testnet
|
||||||
|
|
||||||
common options:
|
common options:
|
||||||
-p prefix - Optional common prefix for instance names to avoid collisions
|
-p prefix - Optional common prefix for instance names to avoid collisions
|
||||||
(default: $prefix)
|
(default: $prefix)
|
||||||
|
|
||||||
create-specific options:
|
create-specific options:
|
||||||
-n number - Number of validator nodes (default: $validatorNodeCount)
|
-n number - Number of validator nodes (default: $validatorNodeCount)
|
||||||
|
@ -45,6 +45,7 @@ Configure a GCE-based testnet
|
||||||
-P - Use GCE internal/private network (default: $internalNetwork)
|
-P - Use GCE internal/private network (default: $internalNetwork)
|
||||||
-z - GCP Zone for the nodes (default: $zone)
|
-z - GCP Zone for the nodes (default: $zone)
|
||||||
-i imageName - Existing image on GCE (default: $imageName)
|
-i imageName - Existing image on GCE (default: $imageName)
|
||||||
|
-g - Enable GPU
|
||||||
|
|
||||||
config-specific options:
|
config-specific options:
|
||||||
none
|
none
|
||||||
|
@ -62,7 +63,7 @@ command=$1
|
||||||
shift
|
shift
|
||||||
[[ $command = create || $command = config || $command = delete ]] || usage "Invalid command: $command"
|
[[ $command = create || $command = config || $command = delete ]] || usage "Invalid command: $command"
|
||||||
|
|
||||||
while getopts "h?p:Pi:n:c:z:" opt; do
|
while getopts "h?p:Pi:n:c:z:g" opt; do
|
||||||
case $opt in
|
case $opt in
|
||||||
h | \?)
|
h | \?)
|
||||||
usage
|
usage
|
||||||
|
@ -85,6 +86,9 @@ while getopts "h?p:Pi:n:c:z:" opt; do
|
||||||
z)
|
z)
|
||||||
zone=$OPTARG
|
zone=$OPTARG
|
||||||
;;
|
;;
|
||||||
|
g)
|
||||||
|
leaderAccelerator="count=4,type=nvidia-tesla-k80"
|
||||||
|
;;
|
||||||
*)
|
*)
|
||||||
usage "Error: unhandled option: $opt"
|
usage "Error: unhandled option: $opt"
|
||||||
;;
|
;;
|
||||||
|
|
|
@ -112,12 +112,16 @@ gcloud_CreateInstances() {
|
||||||
"--machine-type=$machineType"
|
"--machine-type=$machineType"
|
||||||
)
|
)
|
||||||
if [[ -n $optionalAccelerator ]]; then
|
if [[ -n $optionalAccelerator ]]; then
|
||||||
args+=("--accelerator=$optionalAccelerator")
|
args+=(
|
||||||
|
"--accelerator=$optionalAccelerator"
|
||||||
|
--maintenance-policy TERMINATE
|
||||||
|
--restart-on-failure
|
||||||
|
)
|
||||||
fi
|
fi
|
||||||
|
|
||||||
(
|
(
|
||||||
set -x
|
set -x
|
||||||
gcloud beta compute instances create "${nodes[@]}" "${args[@]}" \
|
gcloud beta compute instances create "${nodes[@]}" "${args[@]}"
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue