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