Overview Compiling
Overview Compiling
COMPILING PROCESS
Kelly Werner / Dave Gill
NCAR/MMM
February 2019
INTRODUCTION TO WRF
• What is WRF?
• Weather Research and Forecasting Model
• Used for both research and operational forecasting
• Supported community model
• Free & shared resource with distributed development and centralized support
• What is WPS?
• WRF Preprocessing System
• Prepares input to WRF for real-data simulations
• Geogrid
• Defines simulation domain area
• Produces terrain, landuse, soil type, etc. on the domain
• Ungrib
• De-gribs GRIB-formatted meteorological input data files
• Converts to intermediate format (expected by metgrid)
• Metgrid
• Horizontally interpolates meteorological to WRF model grid
WPS/WRF FLOWCHART
External Data
Sources WRF Preprocessing System WRF Model
Static
Geographical
geogrid
Data
Gridded
Meteorological ungrib
Data
COMPILING WRF/WPS
INSTALLING STEPS
• UNIX Commands
ar awk head sed hostname sleep
cat ls sort tar cd cp
make touch mkdir tr expr mv
wc uname grep rm file printf
nm which
INSTALLING STEPS
• VERY IMPORTANT!
• Make sure these libraries are installed using the same compilers
as will be used to install WRF and WPS
• Test 1
• Fortran + C + netCDF
• Test 2
• Fortran + C + netCDF + MPI
INSTALLING STEPS
2 Download Methods:
- Clone from Github
- Download archived
tar file from GitHub
DOWNLOAD WRF & WPS CODE
• Cloning WRF from GitHub repository:
Click Here
DOWNLOAD STATIC GEOGRAPHICAL DATA
geog_high_res_mandatory.tar.gz
~ 29 GB when
uncompressed
• Run
• Single domain
• Small domain (75x70), 30km resolution
• 12 hours
• 8 processors
STEP 1: CONFIGURE FOR WRF
• Inside the WRF/ directory, type: ./configure
CONFIGURE OPTIONS FOR WRF
DEBUGGING OPTIONS OLDER VERSIONS
• ./configure –d • Large-file support
• No optimization • For output files > 2GB
• Extra debugging • Default since V3.9
• Before configuring, set (csh e.g.)
setenv WRFIO_NCD_LARGE_FILE_SUPPORT 1
• ./configure –D
• No optimization
• Checks uninitialized variables, floating
point traps, etc.
• Hybrid coordinate
• Default since V4.0
• Version 3.9 – v3.9.1.1 needs:
• ./configure –r8 • ./configure -hyb
• Double-precision
• Works for GNU, Intel, & PGI compilers
PARALLEL COMPILE OPTION FOR WRF
• To build WRF with multiple compilers, set (csh e.g.):
setenv J “-j2”
1 17.25 Mins
2 9.95 Mins
3 8.05 Mins
4 6.82 Mins
5 6.32 Mins
6 6.12 Mins
Ideal case:
wrf.exe – model executable
ideal.exe – ideal case initialization
*Note: Each ideal case compile creates a different executable,
but with the same name
• Before recompiling:
• issue a ‘clean –a’
• Reconfigure: If you need to make changes to the configure.wrf file, do
this after issuing ./configure, and then save the edited file.
• Recompile
37
INSTALLING STEPS
41
UNSUCCESSFUL WPS COMPILATION
No geogrid.exe or metgrid.exe
• Check that you used the same compiler (and version) as you used
to compile WRF
• Check that you are using the same netCDF that you used to build
WRF
42
UNSUCCESSFUL WPS COMPILATION
No ungrib.exe
• Make sure you have installed your jasper, zlib, and libpng libraries
correctly.
• Make sure that you are using the correct path and format for the
following lines in the configure.wps file
COMPRESSION_LIBS = -L/${DIR}/UNGRIB_LIBRARIES/lib –ljasper –lpng –lz
COMPRESSION_INC = -I/${DIR}/UNGRIB_LIBRARIES/include
43
THE CLEAN COMMAND
• If you make any changes to any subroutines within the code, you will
need to recompile your code, but you do NOT need to issue the
‘./clean –a’ command, nor do you need to reconfigure. You will
simply just recompile. This compilation should take a lot less time
than a clean compile.
44
INSTALLING STEPS
47
DOWNLOAD DATASETS (CONT’D)
48
DOWNLOAD DATASETS (CONT’D)
49
STEPS TO RUN WRF
• Run WPS processes from the WPS/ directory
• cd to WRF/run or WRF/test/em_real
51