Versions Compared

Key

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

...

Section
Column

Introduction

The ECMWF grib_api software library provides a set of functions/subroutines and command line tools for encoding and decoding WMO FM-92 GRIB edition 1 and edition 2 messages. The OpenIFS model uses GRIB for its input and output files.

The grib_api software library must be buildbuilt and installed installed before building OpenIFS. Although there may be a version of grib_api on your system already that would most likely work, it is recommended that you build and install grib-api as described below to ensure the correct configuration is used for OpenIFS. Also, to ensure the same compiler and compiler version is used, as otherwise, error messages about conflicting module versions when compiling OpenIFS can arise.

This page gives additional information about grib-api for OpenIFS. For more information about grib_api, to download and install it please visit the grib_api website.

Column
width50px

 

Column
width280px
Panel
bgColorwhite
titleBGColorlightlightgrey
titleOn this page

Table of Contents
maxLevel2
stylesquare
printablefalse

...

In the walk-through example that follows, a single-user download and install is assumed.

Download and unpack

In this example, create Create a directory called $HOME/ecmwf in which grib-api will be downloaded and compiled.

If you haven't already obtained the grib_api package, get it from the grib-api web site. We recommend downloading the latest version. Some of the instructions for options below may differ with the very latest versions.

...

export CC=gcc
export FC=gfortran

These lines set the choice of compiler. CMake is often able to determine the available compilers for itself.
However, in cases where multiple compilers are available, or where compiler wrappers are used (as on HPC systems), it's preferable to set these explicitly by use of environment variables.
These lines can often be omitted.
CMAKE_INSTALL_PREFIX="../grib_api"

This specifies the location where the 'make install' command will place the grib-api installation.

ENABLE_NETCDF=ONEnabling netcdf ensures the grib_to_netcdf command can be used.
ENABLE_JPG=OFF
ENABLE_PNG=OFF
As OpenIFS does not deal with any image based GRIB data these options can be disabled, unless you have other grib data containing images that you need to work with.
ENABLE_PYTHON=ONSome of the utilities that come with OpenIFS make use of the python interface to grib_api, e.g. the tools to create and manipulate the model data.
For this option to work, ensure that a python installation is available.
ENABLE_FORTRAN=ONThis enables the Fortran interface to grib_api and should always be on.
ENABLE_GRIB_THREADS=ONThis ensures grib_api is compiled to be 'thread-safe'. Although OpenIFS does not currently use multiple threaded calls to grib-api, future versions may do so this option is recommended.
BUILD_SHARED_LIBS=OFFgrib_api can be built with both 'shared' and 'static' libraries for linking. Normally static libraries are sufficient. Note that some IBM users may experience problems if shared libraries are built.

Available options

To get additional help on the available options (similar to the 'configure --help' command) run the command:

...

Choice of compiler and options

it is not usually necessary to override the compiler options chosen by cmake or configure. By default, cmake and configure will use the preferred compiler and set appropriate compiler options accordingly (for cmake, this depends on the build type).

This may not be what you need if you have multiple compilers available and want to direct cmake/configure to the most appropriate one to use. In the above example, we enforce the use of the GNU C and Fortran compilers. If you intend to use other compilers with OpenIFS you will need to set these appropriately.

Recommended options given below are conservative to ensure stability and bit-reproducibility. The cmake and configure commands usually choose a sensible set of optimized compiler flags for the choice of supported compiler for the 'Bit' build type.

Changing compiler options is not normally necessary. However, the following examples show the recommended compiler options and how to set them for the cmake and configure commands.

...