Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Section
Column
Info
titlePrerequisites

You should have completed: the install grib_api and downloaded and unpacked the OpenIFS data files and OpenIFS source code.

Column
width30px

 

Column
width250px
Panel
bgColorwhite
titleBGColorlightlightgrey
titleOn this page

Table of Contents
maxLevel3

Set your environment

OpenIFS uses software called 'FCM' to handle the compilation of the code. FCM is distributed in the tarball downloaded from the ftp site.

...

Code Block
titlee.g. assuming OpenIFS is unpacked in $HOME/ecmwf/oifs
export PATH=$PATH:$HOME/ecmwf/oifs/fcm/bin

 

Build configuration

This is a brief introduction on compiling the OpenIFS model. For a more detailed description of the build system for OpenIFS and the different ways to configure it, see HowTo customize the OpenIFS build.

Before compiling the OpenIFS model, the build configuration must first be set by several environment variables:

...

These environment variables directly correspond to the names of the FCM configuration files in the oifs/make/cfg/ directory in the OpenIFS source. Please see this directory for the choices provided.

...

  • opt - Recommended optimized compile settings for OpenIFS for this compiler. Tested to provide best performance for this platform & compiler.
  • noopt - Debugging options. No optimization set for all of the OpenIFS code. Suitable for use with a debugger. OpenMP is disabled.
  • nansC - Debugging options with extra checks. Array bound checking enabled and variables initialized to NAN (not-a-number). Use of a variable set to NaN will trigger a floating point exception. This option is useful for debugging purposes but will run the slowest.

...

suitable for building on IBM Power6 architecture using the XLF/XLCC compilers using non-optimized settings.

Building for other systems/environments

As the environment variables refer to the corresponding filename in the make/cfg  directory it is straightforward to create a build configuration for other environments. Take a copy of an existing file and modify it as necessary. It's also possible to alter compile options by the use of additional environment variables (see below). Which approach you use depends on your personal preference. Be aware however that the optimization compiler flags in the provided configuration files are the recommended ones. It is impossible to test all combinations of compiler flags so OpenIFS the model may become unstable or performance may reduce if higher optimizations are tried.

Setting the location of libraries

OpenIFS The model requires a number of libraries (see Prerequisites) to compile. As well as the GRIB_API library, the LAPACK & BLAS numerical libraries are required. An MPI library is also required but this is assumed to be provided by compiler wrappers provided by the MPI implementation (e.g. the command mpif90 rather than gfortran).

...

Or if you prefer you can either edit the default value in the appropriate FCM configuration file in oifs/make/cfg directory or make a copy of the supplied configuration file (.cfg) and use that.

Compiling OpenIFS

Once the environment variables are set, OpenIFS can be compiled (make sure you have edited your PATH environment variable to add the FCM installation /bin directory). Assuming you are in the directory where the OpenIFS source code was unpacked:

...

Code Block
[init] make                # 2012-12-20 19:59:59Z
[init] make config-parse   # 2012-12-20 19:59:59Z
[info] config-file=...../make/oifs.cfg
[info] config-file= - ...../make/cfg/gnu-opt.cfg
[done] make config-parse   # 0.3s
[init] make dest-init      # 2012-12-20 19:59:59Z
[info] mode=new
[done] make dest-init      # 0.3s
[init] make build          # 2012-12-20 20:00:00Z
[info] sources: total=2194, analysed=2194, elapsed-time=11.7s, total-time=32.2s
[info] target-tree-analysis: elapsed-time=9.8s
[info] compile   targets: modified=2073, unchanged=0, total-time=1095.5s
[info] compile+  targets: modified=628, unchanged=0, total-time=1.6s
[info] ext-iface targets: modified=1247, unchanged=0, total-time=21.9s
[info] install   targets: modified=120, unchanged=0, total-time=0.3s
[info] link      targets: modified=1, unchanged=0, total-time=18.3s
[info] TOTAL     targets: modified=4069, unchanged=0, elapsed-time=316.3s
[done] make build          # 329.1s
[done] make                # 329.8s

Verbose compilation

The default output of FCM is quite terse. To get more verbose output use the '-v' option. Also if you have a multicore machine you can use the -j option to specify additional processes to build in parallel.

...

will produce a more detailed report and use 4 processes to analyse and build the model code in parallel.

Successful compilation

After a successful compilation, the OpenIFS executable, master.exe, can be found in the 'make/gnu-opt/oifs/bin' subdirectory:

...

The 'gnu-opt' subdirectory is generated by FCM using the values of the OIFS_COMP & OIFS_BUILD environment variables. The oifs/include directory contains all the files referenced in the code by a '#include' statement. This includes the Fortran interface block files which are auto-generated by FCM and end in .intfb.h. The oifs/o directory contains all the compiled object files. The OpenIFS build does not place any additional files in the src directory (known as building 'out of source').

Compilation problems

If you get the message:

Code Block
fcm make -f oifs.cfg
/bin/ksh: fcm: not found [No such file or directory]

...