User's Guide for the NMM Core of the

Weather Research and Forecast (WRF)

Modeling System Version 2.2

 

Chapter 2: Software Installation

 

Table of Contents

·       Introduction

·       Required Compilers and Scripting Languauges

o      WRF System Software Requirements

o      WPS and WRF Postprocessor Software Requirements

·       Required/Optional Libraries to Download

·       UNIX Environment Settings

·       Building the WRF System for the NMM Core

o      Obtaining and Opening the WRFV2 Package

o      How to Configure the WRFV2

o      How to Compile the WRFV2 for the NMM Core

·       Building the WRF Preprocessing System

o      How to Install the WPS

·       Building the WRF Postprocessing Code

o      How to Install the WRF Postprocessor

Introduction

The WRF modeling system software installation is fairly straightforward on multiple platforms. The package is mostly self-contained, meaning that WRF requires no external libraries (such as for FFTs or various linear algebra solvers).

The WRF code has been successfully ported to a number of Unix-based machines. WRF developers do not have access to all of them and must rely on outside users and vendors to supply the required configuration information for the compiler and loader options. Below is a list of the supported combinations of hardware and software for WRF.

 

Vendor

Hardware

O.S.

Compiler

Cray

X1

UniCOS

vendor

HP/Compaq

Alpha

Tru64

vendor

HP/Compaq

IA64 (Intel)

Linux

vendor

HP/Compaq

IA64

HPUX

vendor

IBM

Power Series

AIX

vendor

SGI

IA64

Linux

Intel

SGI

MIPS

Irix

vendor

Sun

UltraSPARC

SunOS

vendor

COTS*

IA32/AMD32

Linux

Intel/PGI

COTS*

IA64/Opteron

Linux

Intel/PGI

* Commercial off the shelf systems.

The WRF-NMM code runs on single processor machines (if number of processors for “mpirun” is set to 1), distributed memory machines (with the appropriate MPI libraries), and on distributed clusters (utilizing both OpenMP and MPI).

The WRF Preprocessing System (WPS) code also runs on most of the systems listed above.  Sun and Intel compilers are not yet supported.

Required Compilers and Scripting Languages

WRF System Software Requirements

The WRF model is written in FORTRAN (what many refer to as FORTRAN 90). The software layers, RSL and now RSL-LITE, – which sit between WRF and the MPI interface- are written in C. Ancillary programs that perform file parsing and file construction, both of which are required for default building of the WRF modeling code, are written in C.  Thus, FORTRAN 90 or 95 and C compilers are required. Additionally, the WRF build mechanism uses several scripting languages: including perl (to handle various tasks such as the code browser designed by Brian Fiedler; needs to version 5.04 or higher), C-shell and Bourne shell. The traditional UNIX text/file processing utilities are used: make, M4, sed, and awk.  If OpenMP compilation is desired, OpenMP libraries are required.  The WRF I/O API also supports netCDF, PHD5 and GriB-1 formats, hence one of these libraries needs to be available on the computer used to compile and run WRF.

See Chapter 6: WRF Software (Required Software) for a more detailed listing of the necessary pieces for the WRF build.

 

WPS and WRF Postprocessor Software Requirements

The WRF Preprocessing System (WPS) requires the same Fortran and C compilers used to build the WRF model. In addition to the netCDF library, the WRF I/O API libraries which are included with the WRF model tar file are also required. In order to run the WRF Domain Wizard to easily create domains Java 1.4, Java 1.5 or later version is recommended.

Just as for the WPS, the WRF Postprocessor also requires the same Fortran and C compilers used to build the WRF model, along with the netCDF library and the WRF I/O API libraries.  The WRF Postprocessor has some visualization scripts included to create graphics using either GrADS or GEMPAK, in which case one of these packages would need to be installed. 

 

Required/Optional Libraries to Download

The netCDF package is required and can be downloaded from Unidata: http://my.unidata.ucar.edu/content/software/netcdf/index.html.

 

The netCDF libraries should be installed either in the directory included in the user’s path to netCDF libraries or in /usr/local and its include/ directory is defined by the environmental variable NETCDF.  For example,

 

            setenv NETCDF /path-to-netcdf-library

 

To execute netCDF commands, such as ncdump and ncgen, /path-to-netcdf/bin may also need to be added to the user’s path.

 

Hint:  On one of the NCAR’s IBM comuter’s (bluevista), the netCDF library is installed for both 32-bit and 64-bit memory usage.  The default would be the 32-bit version.  If you  would like to use the 64-bit version, set the following environment variable before you start compilation:

            setenv OBJECT_MODE 64

 

Hint: When compiling WRF codes on a Linux system using the PGI compiler, make sure the netCDF library has been installed using the same PGI compiler. The netCDF library compiled with PGI is usually located in /usr/local/netcdf-pgi

 

A version of MPI is required prior to building the WRF-NMM. A version of mpich for LINUX-PCs can be downloaded from:

http://www-unix.mcs.anl.gov/mpi/mpich

 

The user may want their system administrator to install the code. To determine whether MPI is available on your computer system, try:

               which mpif90

               which mpicc

               which mpirun

 

If all of these executables are defined, MPI is probably already available. The MPI lib/, include/, and bin/ need to be included in the user’s path.

 

Three libraries are required by the ungrib program for GRIB Edition 2 compression support. Users are encouraged to engage their system administrators support for the installation of these packages so that traditional library paths and include paths are maintained. Paths to user-installed compression libraries are handled in the configure.wps file.

  1. JasPer (an implementation of the JPEG2000 standard for "lossy" compression) http://www.ece.uvic.ca/~mdadams/jasper/

Go down to “JasPer software”, one of the "click here" parts is the source.

 ./configure

 make

 make install

  1. zlib (another compression library, which is used by the PNG library) http://www.zlib.net/

Go to "The current release is publicly available here" section and download.

                        ./configure

 make

 make install

  1. PNG (compression library for "lossless" compression) http://www.libpng.org/pub/png/libpng.html

Scroll down to "Source code" and choose a mirror site.

                        ./configure

make check

make install

To get around portability issues, the NCEP GRIB libraries, w3 and g2, have been included in the WPS distribution. The original versions of these libraries are available for download from NCEP at http://www.nco.ncep.noaa.gov/pmb/codes/GRIB2/. The specific tar files to download are g2lib and w3lib. Because the ungrib program requires modules from these files, they are not suitable for usage with a traditional library option during the link stage of the build.

 

UNIX Environment Settings

Path names for the compilers and libraries listed above should be defined in the shell configuration files (such as “.cshrc” and “.login”).  For example:

 

set path = (     /usr/pgi/bin /usr/pgi/lib /usr/local/ncarg/bin \

                        /usr/local/mpich-pgi /usr/local/mpich-pgi/bin \

                        /usr/local/netcdf-pgi/bin /usr/local/netcdf-pgi/include)

setenv PGI /usr/pgi

setenv NETCDF /usr/local/netcdf-pgi

setenv NCARG_ROOT /usr/local/ncarg

setenv LM_LICENSE_FILE $PGI/license.dat

setenv LD_LIBRARY_PATH /usr/lib:/usr/local/lib:/usr/pgi/linux86/lib:/usr/local/

netcdf-pgi/lib

 

In addition, there are a few WRF-related environmental settings.  Most of these settings are not required, but the user may want to try some of these settings if difficulties are encountered during the build process. The only environment setting required when building the WRF-NMM core is WRF_NMM_CORE.  If nesting will be used, also set WRF_NMM_NEST (see below).  In C-shell syntax:

 

·      setenv WRF_NMM_CORE 1 (explicitly turns on WRF-NMM core to build)

·      setenv WRF_NMM_NEST 1 (nesting is desired using the WRF-NMM core)

·      unset limits (especially if you are on a small system)

·      setenv MP_STACK_SIZE 64000000 (OpenMP blows through the stack size, set it large)

·      setenv MPICH_F90 f90 (or whatever your FORTRAN compiler may be called. WRF needs the bin, lib, and include directories)

·      setenv OMP_NUM_THREADS n (where n is the number of processors to use. In systems with OpenMP installed, this is how the number of threads is specified.)

 

Note:  A single domain can still be specifed even if WRF_NMM_NEST is set to 1.

 

Building the WRF System for the NMM Core

Obtaining and Opening the WRFV2 Package

The WRF-NMM source code tar file may be downloaded from:

http://www.dtcenter.org/wrf-nmm/users/downloads/

 

Note:  Always obtain the latest version of the code if you are not trying to continue a pre-existing project.  WRFV2.2 is just used as an example here.

 

Once the tar file is obtained, gunzip and untar the file.

 

tar –zxvf WRFV2.2.TAR.gz

 

The end product will be a WRFV2/ directory that contains:

 

Makefile

Top-level makefile

README

General information about WRF code

README.NMM

NMM specific information

README_test_cases

Explanation of the test cases for WRF-ARW

Registry/

Directory for WRF Registry file

arch/

Directory where compile options are gathered

clean

Script to clean created files and executables

compile

Script for compiling WRF code

configure

Script to configure the configure.wrf file for compile

dyn_em

Directory for WRF-ARW dynamic modules

dyn_exp/

Directory for a 'toy' dynamic core

dyn_nmm/

Directory for WRF-NMM dynamic modules

external/

Directory that contains external packages, such as those for IO, time keeping and MPI

frame/

Directory that contains modules for WRF framework

inc/

Directory that contains include files

main/

Directory for main routines, such as wrf.F, and all executables

phys/

Directory for all physics modules

run/

Directory where one may run WRF

share/

Directory that contains mostly modules for WRF mediation layer and WRF I/O

test/

Directory containing sub-directories where one may run specific configurations of WRF. Only nmm_real is relevant to WRF-NMM

tools/

Directory that contains tools

 

How to Configure the WRFV2

The WRF code has a fairly sophisticated build mechanism. The package tries to determine the architecture on which the code is being built, and then presents the user with options to allow the user to select the preferred build method. For example, on a Linux machine, the build mechanism determines whether the machine is 32 or 64 bit, and then prompts the user for the desired usage of processors (such as serial, shared memory, or distributed memory).

 

A helpful guide to building WRFV2 using PGI 6.1 compilers on a 32-bit or 64-bit LINUX system can be found at:

http://www.pgroup.com/resources/wrf/wrfv2_pgi61.htm.

 

To configure WRF, go to the WRFV2 (top) directory (cd WRFV2) and type:

 

./configure

 

You will be given a list of choices for your computer. These choices range from compiling for a single processor job, to using OpenMP shared-memory (SM) or distributed-memory (DM) parallelization options for multiple processors. Some options support nesting, others do not. 

 

Note: When configuring the WRF-NMM core, only options which are distributed memory and include MPI or MPICH can be selected.  If nesting is desired, the option must also include RSL_LITE.

 

Choices for IBM machines are as follows:

 

  1. AIX                                   (single-threaded, no nesting)

  2. AIX SM                             (OpenMP, no nesting)

  3. AIX DM-Parallel              (RSL_LITE, IBM-MPI, allows nesting)

  4. AIX DM-Parallel              (RSL, IBM-MPI, allows nesting)

  5. AIX DM-Parallel              (RSL, IBM-MPI, allows nesting) (PARALLEL HDF5)

  6. AIX DM-Parallel              (RSL_LITE, IBM-MPI, allows nesting) (PARALLEL HDF5)

  7. AIX DM-Parallel/SM-Parallel (not recommended)

                                                (RSL, IBM-MPI, OpenMP, allows nesting)

  8. AIX DM-Parallel              (RSL, IBM-MPI, MCEL) May 2003, EXPERIMENTAL

  9. AIX DM-Parallel ESMF   (RSL, IBM-MPI, ESMF coupling, no nesting, experimental)

10. AIX                                   (Single-threaded, nesting using RSL without MPI)

11. AIX                                   (OpenMP, nesting using RSL without MPI)

 

For WRF-NMM V2 on IBM systems, option 3 is recommended.

 

Choices for 32-bit LINUX operating systems are as follows:

 

  1. PC Linux i486 i586 i686, PGI compiler (Single-threaded, no nesting)

  2. PC Linux i486 i586 i686, PGI compiler

     (Single threaded, allows nesting using RSL without MPI)

  3. PC Linux i486 i586 i686, PGI compiler  SM-Parallel (OpenMP, no nesting)

  4. PC Linux i486 i586 i686, PGI compiler  SM-Parallel

     (OpenMP, allows nesting using RSL without MPI)

  5. PC Linux i486 i586 i686, PGI compiler  DM-Parallel (RSL, MPICH, allows nesting)

  6. PC Linux i486 i586 i686, PGI compiler  DM-Parallel

      (RSL_LITE, MPICH, allows nesting)

  7. AMD x86_64 Intel xeon i686 ia32 Xeon Linux, ifort compiler (Single-threaded, no nesting)

  8. AMD x86_64 Intel xeon i686 ia32 Xeon Linux, ifort compiler

      (Single threaded, allows nesting using RSL without MPI)

  9. AMD x86_64 Intel xeon i686 ia32 Xeon Linux, ifort compiler (OpenMP)

10. AMD x86_64 Intel xeon i686 ia32 Xeon Linux, ifort compiler SM-Parallel

      (OpenMP, allows nesting using RSL without MPI)

11. AMD x86_64 Intel xeon i686 ia32 Xeon Linux, ifort+icc compiler DM-Parallel

      (RSL, MPICH, allows nesting)

12. AMD x86_64 Intel xeon i686 ia32 Xeon Linux, ifort+gcc compiler DM-Parallel

     (RSL, MPICH, allows nesting)

13. PC Linux i486 i586 i686, g95 compiler (Single-threaded, no nesting)

14.  PC Linux i486 i586 i686, g95 compiler, DM-Parallel

     (RSL_LITE, MPICH, Allows nesting)

 

For WRF-NMM V2 on LINUX operating systems, option 6 is recommended.

 

Check the configure.wrf file created and edit for compile options/paths, if necessary.

How to Compile the WRFV2 for the NMM core

 

To compile WRFV2 for the NMM dynamic core, the following environment variable must be set:

           

setenv WRF_NMM_CORE 1

 

If compiling for nested runs, also set: