Enter your e-mail address.
Enter the password that accompanies your e-mail.

Building MM5

MM5 stands for Mesoscale Model 5.

The PSU/NCAR mesoscale model (known as MM5) is a limited-area, nonhydrostatic, terrain-following sigma-coordinate model designed to simulate or predict mesoscale atmospheric circulation. The model is supported by several pre- and post-processing programs, which are referred to collectively as the MM5 modeling system. The MM5 modeling system software is mostly written in Fortran, and has been developed at Penn State and NCAR as a community mesoscale model with contributions from users worldwide.

More information is available on the MM5 website.
Steps to building
To build MM5, you will need to download the source, and then build it as either a serial application or a parallel application. These steps, and any known limitations, are described in the sections below.
Overview
You can build MM5 either as a serial or a parallel (OpenMP or MPI) application. To build and run MM5 as an MPI application (MM5-MPP), you will need to have an MPI library installed. The instructions assume that MPICH is installed. There is also a PathScale page for building MPICH.

We have tested version 3.7.3, 3.7.2, 3.7.0, and 3.6.3 using the EKOPath Compiler Suite. Version 3.7.3 works without modification. Please see the Patches to MM5(MPI version) section if you are using a version prior to 3.7.2 or if you encounter problems.
Downloading MM5
You can download MM5 from the MM5 website. Note that you should download MPP.TAR.GZ as well as MM5.TAR.GZ if you want to run parallel applications.The most recent version of MM5 that we have tested was released on November 21, 2005 - Release 3.7.3.
Building MM5 as a serial application
To build MM5, use this edited version of the configure.user file. Put it into the top level of your MM5 directory.

Use the make command at the top level of your MM5 directory to build the code.
make clean
make
Note: Do a make clean to remove any earlier versions of MM5 that might be on your machine.
Building MM5 as an OpenMP application
To build MM5, use this edited version of the configure.user file and follow the build instructions in Building MM5 as a serial application.
Building MM5 as an MPI application
To build MM5, use this edited version of the configure.user file. PathScale also provides an edited Makefile and makefile.linux file. Put the Makefile and configure.user.omp files into the top level MM5 directory, and put the makefile.linux file into the MPP/RSL/RSL/ directory.

With these files correctly installed, you can build MM5 using make:
make mpclean
rm MPP/mpp_install
make mpp
Patches to MM5 (MPI version)
In the past we have seen some problems with MM5, addressed by the first two patches, but we have not seen these problems recently. If you have problems with segmentation faults or while using PADIT code with MM5, please use Patch 1 and Patch 2.

Patch 3 is for a timing loop that causes a problem when the C code is compiled at high levels of optimization. This is worked around in the configure.user file by lowering the optimization level for the C source files. (MM5 does not use C for performance-critical code, so this should not cause any limitations.) Serial MM5 users can use the configure.user.serial file.

MM5 version 3.6.3 requires Patch 4. The problem has been fixed in later versions of MM5.

Patch 1
In MPP/RSL/RSL/rsl_mm_io.c there is a problem that may cause a segmentation fault. When ioffset or joffset has a positive value, some of the array references in RSL_MM_BDY_IN and RSL_MM_DIST_BDY can exceed the bounds of the array. There is code to catch negative offsets walking off the bottom of an array dimension, but nothing for positive offsets at the other end.

To fix this, make these changes to rsl_mm_io.c:
353c353
< if ( i+ioffset >= 0 )
> if ( i+ioffset >= 0 && i+ioffset  < ix_l )
368c368
< if ( j+joffset >= 0 )
> if ( j+joffset >= 0 && j+joffset < jx_l ) 
529c529
< if ( i+ioffset >= 0 )
> if ( i+ioffset >= 0 && i+ioffset < ix_l ) 
545c545
< if ( i+ioffset >= 0 ) 
> if ( i+ioffset >= 0 && i+ioffset < ix_l ) 
561c561
< if ( j+joffset >= 0 )
> if ( j+joffset >= 0 && j+joffset < jx_l ) 
577c577
< if ( j+joffset >= 0 )
> if ( j+joffset >= 0 && j+joffset < jx_l ) 
Patch 2
When using the PADIT code in MPP/RSL/RSL/rsl_malloc.c, there is a problem in MPP/RSL/RSL/process_refs.c where calls to RSL_MALLOC are paired up with calls to the C standard library "free" instead of RSL_FREE. This is usually OK but it causes obvious problems if PADIT is defined.

To fix this problem, make the following change in process_refs.c:
7c7                     
< static int destroy_packrec( p ) packrec_t * p ; 
< {             
< free( p ) ;   
< return(0) ;   
< }             
> static int destroy_packrec( p ) packrec_t * p ;  
> { 
> RSL_FREE( p ) ;  
> return(0) ;    
> }     
Patch 3
Lastly, there is code in MPP/mhz.c that attempts to estimate CPU MHz using the McVoy algorithm from lmbench that requires the following patch:
164,165c164          
< volatile int use_p_counter = 0;      
< void use_p(int **p) { use_p_counter += (p != NULL); } 
> void use_p(int **p) {} 
Note: At high optimization levels, the compiler (correctly) optimizes away this empty loop without the patch. This is worked around in the configure.user file by lowering the optimization level for the C source files. MM5 does not use C for performance critical code, so this should not cause any limitations.

Patch 4
If you are using the MM5 3.6.3 source code, you will need to fix an errno problem in ./MPP/RSL/RSL/rsl_malloc.c and ./MPP/RSL/RSL/rsl_nx_compat.c before you build.

Make this change:
< extern int errno;
> #include <errno.h>
All these changes have been submitted to the MM5-MPP maintainers, so hopefully these fixes will be integrated into a future MM5 release.
Known limitations
Other than the patches mentioned in the previous section, there are no known limitations.

We recommend you record what steps you took, along with their output, in case of problems. You can include this in your email to support. Here is an example of changing a make command to record the output in a text file:
make foo 2>&1 | tee make-foo-log.txt
If you have any comments or suggestions about additions to these pages, please contact support@pathscale.com.
Live help