Last active
April 5, 2019 16:47
-
-
Save b0noI/d6b7b0147129ca1880729b5b94db6b18 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function execute_notebook_with_gpu() { | |
IMAGE_FAMILY="tf-latest-cu100" # or put any required | |
ZONE="us-west1-b" | |
INSTANCE_NAME="notebookexecutor" | |
INSTANCE_TYPE="n1-standard-8" | |
INPUT_NOTEBOOK=$1 | |
OUTPUT_NOTEBOOK=$2 | |
GPU_TYPE=$3 | |
GPU_COUNT=$4 | |
gcloud compute instances create $INSTANCE_NAME \ | |
--zone=$ZONE \ | |
--image-family=$IMAGE_FAMILY \ | |
--image-project=deeplearning-platform-release \ | |
--maintenance-policy=TERMINATE \ | |
--accelerator="type=nvidia-tesla-${GPU_TYPE},count=${GPU_COUNT}" \ | |
--machine-type=$INSTANCE_TYPE \ | |
--boot-disk-size=200GB \ | |
--scopes=https://www.googleapis.com/auth/cloud-platform \ | |
--metadata="input_notebook=$INPUT_NOTEBOOK,output_notebook=$OUTPUT_NOTEBOOK,startup-script-url=https://raw.githubusercontent.com/gclouduniverse/gcp-notebook-executor/master/notebook_executor.sh" | |
} | |
# usage: execute_notebook_with_gpu "gs://my-bucket/test.ipynb" "gs://my-bucket/" p100 4 | |
function execute_notebook_with_cpu() { | |
IMAGE_FAMILY="tf-latest-cpu" # or put any required | |
ZONE="us-west1-b" | |
INSTANCE_NAME="notebookexecutor" | |
INSTANCE_TYPE="n1-standard-8" | |
INPUT_NOTEBOOK=$1 | |
OUTPUT_NOTEBOOK=$2 | |
gcloud compute instances create $INSTANCE_NAME \ | |
--zone=$ZONE \ | |
--image-family=$IMAGE_FAMILY \ | |
--image-project=deeplearning-platform-release \ | |
--machine-type=$INSTANCE_TYPE \ | |
--boot-disk-size=200GB \ | |
--scopes=https://www.googleapis.com/auth/cloud-platform \ | |
--metadata="input_notebook=$INPUT_NOTEBOOK,output_notebook=$OUTPUT_NOTEBOOK,startup-script-url=https://raw.githubusercontent.com/gclouduniverse/gcp-notebook-executor/master/notebook_executor.sh" | |
} | |
# usage: execute_notebook_with_cpu "gs://my-bucket/test.ipynb" "gs://my-bucket/" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment