Difference between revisions of "How to compile WRF-SFIRE"

From openwfm
Jump to navigation Jump to search
 
(4 intermediate revisions by the same user not shown)
Line 1: Line 1:
Compiling the WRF-Fire software is generally supported on most any *NIX based
+
Compiling the WRF-SFIRE software is generally supported on most any *NIX based
 
operating system including Mac OSX.  The source code is a mix of C and fortran 90
 
operating system including Mac OSX.  The source code is a mix of C and fortran 90
 
along with a series of preprocessing directives (utilizing cpp, m4, and other custom
 
along with a series of preprocessing directives (utilizing cpp, m4, and other custom
Line 5: Line 5:
 
ifort, pgf90, gfortran, g95, and xlf90.  In addition, the WRF software infrastructure
 
ifort, pgf90, gfortran, g95, and xlf90.  In addition, the WRF software infrastructure
 
supports parallel execution using a combination of [http://www.mmm.ucar.edu/wrf/users/docs/user_guide_V3.1/users_guide_chap2.htm MPI] and [http://openmp.org/wp/ OpenMP].
 
supports parallel execution using a combination of [http://www.mmm.ucar.edu/wrf/users/docs/user_guide_V3.1/users_guide_chap2.htm MPI] and [http://openmp.org/wp/ OpenMP].
The WRF-Fire software distribution uses the same build system as released with WRF,
+
The WRF-SFIRE software distribution uses the same build system as released with WRF,
 
for which detailed information can be found in the  
 
for which detailed information can be found in the  
 
[http://www.mmm.ucar.edu/wrf/users/docs/user_guide_V3.1/users_guide_chap2.htm WRF User's Guide].
 
[http://www.mmm.ucar.edu/wrf/users/docs/user_guide_V3.1/users_guide_chap2.htm WRF User's Guide].
  
 
While various compiler and platform combinations are known to work, often one must tweak the
 
While various compiler and platform combinations are known to work, often one must tweak the
configuration files in order to build the software successfully.  We will outline here general tips for configuration and compilation of WRF-Fire as well as specific fixes for various platforms.
+
configuration files in order to build the software successfully.  We will outline here general tips for configuration and compilation of WRF-SFIRE as well as specific fixes for various platforms.
  
=Prerequisites=
+
==Prerequisites==
  
 
Prerequisite libraries must be compiled using the same combination of C and fortran 90 compilers that you
 
Prerequisite libraries must be compiled using the same combination of C and fortran 90 compilers that you
plan to build WRF-Fire with.  Failure to do so will likely result in linking errors, or worse, random bugs
+
plan to build WRF-SFIRE with.  Failure to do so will likely result in linking errors, or worse, random bugs
 
at run time.  All libraries (required and optional) use a standard GNU autotools configuration script.   
 
at run time.  All libraries (required and optional) use a standard GNU autotools configuration script.   
 
The build process for each is as follows:
 
The build process for each is as follows:
Line 39: Line 39:
  
  
=Compiling WRF-SFIRE=
+
==Step by step directions==
 +
 
 +
* [[How to get WRF-SFIRE|Get WRF-SFIRE]] from the repository or a mirror.
 +
* '''cd WRF-SFIRE'''
 +
* '''./clean -a'''  to delete the remains of any previous build and ensure start from a known state
 +
* '''./configure''', choose nesting 1=basic.
 +
* '''./compile em_fire >& compile_em_fire.log'''
 +
* Search for '''Err''' in '''compile_em_fire.log'''. If not found, all is well.
 +
** If you see error like '''mpif90: -f90=something option not recognized''', run '''./clean -a'''; rerun '''./configure''', edit the file '''configure.wrf''' and change the line '''DM_FC          =      mpif90 -f90=$(SFC)''' to read just '''DM_FC          =      mpif90'''  Unfortunately, some versions of MPI crash with the '''-f90''' flag, and some crash without. You will need to repeat this every time after you run '''./configure'''.
 +
* '''./compile em_real >& compile_em_real.log'''
 +
* Search for '''Err''' in '''compile_em_real.log'''. If not found, all is well.
 +
** If you see error like '''mpif90: -f90=something option not recognized''', run '''./clean -a'''; rerun '''./configure''', edit the file '''configure.wrf''' and change the line '''DM_FC          =      mpif90 -f90=$(SFC)''' to read just '''DM_FC          =      mpif90'''  Unfortunately, some versions of MPI crash with the '''-f90''' flag, and some crash without. You will need to repeat this every time after you run '''./configure'''.

Latest revision as of 15:44, 2 July 2020

Compiling the WRF-SFIRE software is generally supported on most any *NIX based operating system including Mac OSX. The source code is a mix of C and fortran 90 along with a series of preprocessing directives (utilizing cpp, m4, and other custom scripts). The code is known to compile with a wide variety of compilers including ifort, pgf90, gfortran, g95, and xlf90. In addition, the WRF software infrastructure supports parallel execution using a combination of MPI and OpenMP. The WRF-SFIRE software distribution uses the same build system as released with WRF, for which detailed information can be found in the WRF User's Guide.

While various compiler and platform combinations are known to work, often one must tweak the configuration files in order to build the software successfully. We will outline here general tips for configuration and compilation of WRF-SFIRE as well as specific fixes for various platforms.

Prerequisites

Prerequisite libraries must be compiled using the same combination of C and fortran 90 compilers that you plan to build WRF-SFIRE with. Failure to do so will likely result in linking errors, or worse, random bugs at run time. All libraries (required and optional) use a standard GNU autotools configuration script. The build process for each is as follows:

  1. Choose a prefix directory where you want to install (i.e. PREFIX=/opt).
  2. Set environment variables dictating your choice of compilers (CC,CXX,FC,F77,F90).
  3. See specific help for each software package by running ./configure --help.
  4. Run the configure script with the argument --prefix=$PREFIX indicating the installation location.
  5. make
  6. make install

For example, if you are installing a gcc/g95 build into /opt/gcc-g95, you would issue the following series of commands.

CC=gcc CXX=g++ FC=g95 F77=g95 F90=g95 ./configure --prefix=/opt/gcc-g95
make
make install

Note, depending on your choice of prefix, you may need to be root to run the final command.

Required:

NetCDF
After installation set the environment variable NETCDF to the prefix directory. For example in bash, export NETCDF=$PREFIX.

Optional:

MPICH
Make sure the directory, $PREFIX/bin, is in your search path. For example in bash, export PATH="$PATH:$PREFIX/bin".


Step by step directions

  • Get WRF-SFIRE from the repository or a mirror.
  • cd WRF-SFIRE
  • ./clean -a to delete the remains of any previous build and ensure start from a known state
  • ./configure, choose nesting 1=basic.
  • ./compile em_fire >& compile_em_fire.log
  • Search for Err in compile_em_fire.log. If not found, all is well.
    • If you see error like mpif90: -f90=something option not recognized, run ./clean -a; rerun ./configure, edit the file configure.wrf and change the line DM_FC = mpif90 -f90=$(SFC) to read just DM_FC = mpif90 Unfortunately, some versions of MPI crash with the -f90 flag, and some crash without. You will need to repeat this every time after you run ./configure.
  • ./compile em_real >& compile_em_real.log
  • Search for Err in compile_em_real.log. If not found, all is well.
    • If you see error like mpif90: -f90=something option not recognized, run ./clean -a; rerun ./configure, edit the file configure.wrf and change the line DM_FC = mpif90 -f90=$(SFC) to read just DM_FC = mpif90 Unfortunately, some versions of MPI crash with the -f90 flag, and some crash without. You will need to repeat this every time after you run ./configure.