On this page, the results of my efforts to port the WRF model to other platforms and/or compilers are reported. This page presumes you already know how to compile and use WRF. The page is current as of released version 2.0.3.1 and was last revised on 3 July 2005. Comments, corrections and suggestions made to Robert Fovell are gratefully received.
You may need to right-click or option-click to download the linked files.
23 June 2005: added some notes for the FreeBSD port below 23 June 2005: added notes on compiling RIP4 and WRF2VIS5D with OSX xlf 3 July 2005: revised code fixing WRF2VIS5D and WRF2GrADS bugs posted The old page for WRF version 2.0.2 is here
Updated notes for WRF version 2.0.3.1
NCAR-provided arch/configure.defaults for Intel x86 now works for me. However, make sure that the -mp flag appears in the FCBASEOPTS line. This flag controls numerical precision, and my tests were wrong without it. Also, remove the -xW flag from the FCOPTIM line. In my tests, this vectorization flag produces wrong results.
The NCAR-provided configure.defaults now includes a section for Mac OS X (Darwin). It does NOT work out-of-the-box for me. I still had to implement the changes listed in the OS X section below.
WRF performance on Macintosh hardware is very good. My dual 1.8 GHz Power Mac G5 handily beats my dual 2.8 GHz P4, even when the faster Intel compiler is used. The chart below tells the story; all are dual CPU runs using mpich-1.2.5. I'm still dealing with some G5 memory allocation issues, however.
WRF performance on Solaris is still hideous for me. How about you?
WRF 2.0.3.1 for Mac OS X
Preamble
Compile and run WRF on a UFS formatted disk, partition or mounted disk image!
The following presumes you have the IBM Fortran compiler xlf.
At this time, I do not have the IBM C compiler xlc, so the code provided uses gcc instead. You should probably use xlc if you have it.
Currently, I have ported the single threaded version and also the distributed memory (MPI) version using "RSL_LITE" and no nesting to OS X. I do not anticipate having difficulty with the nested MPI version, but haven't needed that yet. Thankfully, the MPI version of WRF was far, far easier to port than it was for MM5.
I have not been able to get the OpenMP version ported. I believe I am facing a compiler problem that has not yet been addressed by IBM. If you get the OpenMP version working, of course I'd like to know. The official NCAR WRF release contains an OpenMP section that also doesn't work for me. Based on OpenMP performance on Intel, however, this is not a priority.
I have not ported the WRFSI to Darwin.
Procedure
For both single threaded and MPI:
Add the contents of this file to arch/configure.defaults.
Replace external/esmf_time_f90/Makefile with this file (external_esmftime_Makefile), renaming it Makefile. This adds a necessary call to ranlib. (Not modified from v.2.0.2)
Replace external/io_netcdf/makefile with this file (external_netcdf_makefile_v2031), renaming it makefile. Another ranlib call added. (Modified from v.2.0.2)
Replace external/io_int/makefile with this file (external_ioint_makefile_v2031), renaming it makefile. This redefined ranlib within the makefile. There is probably a better way of handling that, but this works. (Modified from v.2.0.2)
For MPI version without nesting, using RSL_LITE:
First, configure and compile MPICH or alternative. My MPICH notes for OSX can be found on this page. I put the MPICH bin directory in my path so the OS knows where to find mpif90 and mpicc, etc..
Replace external/RSL_LITE/makefile with this file (external_rsllite_makefile), renaming it makefile. (Not modified from v.2.0.2) This file contains these alterations:
A ranlib call was added.
The -DSUN flag was added to the rsl_malloc compile line, to circumvent a compile problem. This should be handled differently, but it works.
Replace external/RSL_LITE/rsl_malloc.c with this file. On OSX, the location of malloc.h appears to be different than on other Unix and Unix-like systems. This should be handled with a compiler flag like -DOSX, but it's working for now. (Not modified from v.2.0.2)
Notes
Remember to ulimit or unlimit, depending on shell, before running WRF.
It seems the WRF code compiles faster with bash than tcsh... is that really true? Compilation takes a long time, in any case.
NetCDF is required; make it with the xlf compiler.
I use the -qfloat=nomaf flag because it permits optimizations without program semantics changes. In my tests, I get identical results from -O3 and -g when I use -qfloat=nomaf, which is fantastic. (I have never been able to get identical results between optimized and non-optimized versions on any other platform or with any other compiler.)
To increase addressable memory, add something like this to LDFLAGS in configure.wrf: LDFLAGS = -Wl,-stack_size,10000000,-stack_addr,0xc0000000. This grabs 1 GB of memory.
WRF supporting programs for Mac OS X
WRF2GrADS:
This file is a revised verison of module_wrf_to_grads_util.F (version of 6/22/05), modified so tdef will accurately report time for data sets that start at times other than the top of the hour (i.e., at 23:15Z, say).
RIP4
Here is my somewhat brain-dead procedure for getting RIP4 to work on OS X with xlf. This is a workaround for problems I was having with ripdp_wrf, probably because of the way I handled netcdf. It is not elegant, but I usually stop working on things like this once they start working, and it only has to be done once. It may not work for you. Indeed, you may only need the updated Makefile, which contains information obtained from E. Salathe and M. Han.
If src/Makefile doesn't point to the correct location for netcdf, change it.
Also add this file, Makefile_part to the top-level directory.
The Makefiles I provide increase addressable memory with LDFLAGS = -Wl,-stack_size,10000000,-stack_addr,0xc0000000. If you have less than 1 GB of RAM, you may want to remove this.
Procedure:
make darwin
make -f Makefile_part prepare
make -f Makefile_part darwin
WRF2VIS5D
This one was very simple. I use these lines in the Makefile:
FC = xlf90 FCFLAGS = -g -C
You may also be interested in my revised module_wrf_to_v5d_util.F file, which addresses a number of issues. Modifications include:
Native Mercator projection is used in place of a faked projection
based on cylindrical equidistant. Later vis5d versions include Mercator. Faked Mercator failed when domain crossed equator; this fixes that.
Fix to projection arguments for Lambert projection. When truelat1=truelat2, the cone variable did a divide by zero. Symptom: Vis5D refused to draw wind vectors, tho
contours of U, V could be drawn. Additionally, projection was distorted, tho that
may be less obvious. I'm not absolutely positive my repair is 100%
correct, but I note that my modified WRF2VIS5D produces slightly better agreement between political boundaries, terrain and skin temperature fields than does the Vis5D files created using RIP.
I added a number of useful 2D fields (U10, V10, T2, Q2, SST, PSFC, HGT) to the list of fields recognized as 2D by WRF2VIS5D.
As of 3 July 2005, a problem with 2D fields when multiple wrfout files are used as input was fixed. Bug was pointed out by hmodzelewski.
WRF 2.0.3.1 for FreeBSD (new as of 23 June 2005)
I have also gotten WRF to run on a FreeBSD (x86) system, using the Intel ifort and GNU gcc compilers. (Intel does provide a version of their compiler for FreeBSD.) This is what I did to get it working, at least at the level I require. All information here pertains to the MPP version.
I had to modify the external/RSL/RSL/rsl_malloc.c file slightly. This is the revised version.
In main/Makefile, delete this line: ../dyn_em/module_si_io_em.o \. This references an old module that appears to no longer exist, and for some reason Intel on FreeBSD does not take failing to find it gracefully.