Build and Deploy WRF
Bake the VM Image
When deploying resources on Google Cloud to run research computing applications, there are many options for installing and deploying your application. In this case, you will create a virtual machine image that builds on top of the RCC-CentOS (FOSS) VM image. During the installation process, this will install all of WRF’s dependencies and WRF while leveraging a compiler pre-installed on the RCC-CentOS (FOSS) VM image.
The WRF Cloud Build pipeline on the RCC Apps repository encapsulates the necessary instructions for installing WRF. Under the hood, the installation process uses Packer to deploy an imaging VM that verifies Spack is installed which in turn installs WRF@4.2 and any necessary dependencies with optimizations for Intel® Cascadelake architecture (c2 instances).
Open your Cloud Shell on GCP by going to https://shell.cloud.google.com?show=terminal
Clone the FluidNumerics/rcc-apps repository
git clone https://github.com/FluidNumerics/rcc-apps.git ~/rcc-apps
Build the image using Google Cloud Build. You can check the status of your build process at the Google Cloud Build dashboard
cd ~/rcc-apps
gcloud builds submit . --config=wrf/cloudbuild.yaml --project=<YOUR_PROJECT> --async
Once the build process is finished, you will have a VM image in your Google Cloud project, defined by the image selfLink of projects/<YOUR_PROJECT>/global/images/wrf-gcp-foss-latest. You can then use this image to deploy a RCC cluster that has WRF pre-installed.
Deploy the compute resources
To deploy the RCC cluster using the image you just created, you can use the example Terraform infrastructure-as-code scripts included under the wrf/tf/ directory in the RCC-Apps repository.
From your cloud shell, navigate to
rcc-apps/wrf/tfdirectory
cd ~/rcc-apps/wrf/tf
Set the following environment variables to customize your deployment
WRF_NAME(default : “wrf-demo”) - The name of your deployment. This name prefixes your controller and login node instances for your cluster.WRF_PROJECT- The GCP project ID you want to deploy your cluster to. This environment variable must be set.WRF_ZONE(default : “us-west1-b”) - The GCP Zone to deploy the cluster toWRF_MACHINE_TYPE(default : “c2-standard-8”) - The GCE Instance type you want to use for compute nodes that will run WRFWRF_MAX_NODE(default : 3) - The maximum number of GCE instances available in your slurm partition for running WRF.WRF_IMAGE- The VM image to use to run WRF. Set this toprojects/<YOUR_PROJECT>/global/images/wrf-gcp-foss-latest
As an example
export WRF_IMAGE = projects/research-computing-cloud/global/images/wrf-gcp-foss-latest
export WRF_NAME = rcc-wrf
export WRF_MACHINE_TYPE = c2-standard-60
export WRF_MAX_NODE = 20
Make the terraform plan. We’ve provided a Makefile that will concretize a Terraform tfvars file for this deployment based on the environment variables above and then create a Terraform plan. This makes the plan creation as simple as running
make plan. Once you’ve created the plan, you should review the list of resources that will be created before proceeding.
make plan
Deploy the solution
make apply
Once your cluster has been deployed, you can SSH into it and run WRF simulations.