Versions Compared

Key

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

...


 

Section


Column

Introduction

The ECMWF ecCodes software library provides a set of functions/subroutines and command line tools for working with WMO FM-92 GRIB edition 1 and edition 2 messages. The OpenIFS models use GRIB for their input and output files.

The ecCodes software library must be built and installed before compiling any OpenIFS model that needs it.

To download the software please visit the ecCodes website.

If you have a version of ecCodes or the older (no longer supported) ECMWF grib_api library on your system that would most likely work, though check the minimum grib-api version required for each model.  It is recommended that you build and install ecCodes as described below to ensure the correct configuration is used. We also recommend compiling your own to ensure the same compiler and compiler version is used for the model, as otherwise, error messages about conflicting module versions when compiling can arise.

Info

The older ECMWF grib_api library can be used with OpenIFS, but as it's no longer developed by ECMWF, ecCodes is recommended. Versions of OpenIFS before 40r1v2 may need a small code change to work with ecCodes.

Before you start

Decide where you will put the ecCodes software.

For a single user, ecCodes might be installed in your home directory. For a multi-user environment, say a cluster or High Performance Computing Facility (HPCF), installing ecCodes centrally once only is probably best, then point your build configuration to this location.

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

Info

OpenIFS does not need the 'JPEG' ir 'PNG' libraries in ecCodes as the model does not use any image based data. They can be disabled to avoid linking against them (see below).



 
Column
width50px



Column
width280px


Panel
bgColorwhite
titleBGColorlightlightgrey
titleOn this page

Table of Contents
maxLevel2
printablefalse



...

Code Block
languagebash
titleSteps to configure grib-api with CMake assuming gnu compilers
mkdir bld
mkdir eccodes
cd bld
cmake ../eccodes-2.9.0-Source   \
      -DCMAKE_C_COMPILER=gcc      \
      -DCMAKE_Fortran_COMPILER=gfortran \
      -DCMAKE_INSTALL_PREFIX="$HOME/ecmwf/eccodes"   \
      -DENABLE_NETCDF=ON              \
      -DENABLE_JPG=OFF                \
      -DENABLE_PNG=OFF                \
      -DENABLE_PYTHON=ONOFF              \
      -DENABLE_FORTRAN=ON             \
      -DBUILD_SHARED_LIBS=BOTH

...

CMAKE_C_COMPILER=gcc
CMAKE_Fortran_COMPILER=gfortran

This sets 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.

Note the CMake variables are preferred rather than set environment variables CC and FC.

CMAKE_INSTALL_PREFIX="$HOME/ecmwf/eccodes"

This specifies the location where the 'make install' command will place the eccodes installation.

ENABLE_NETCDF=ONEnabling this option ensures the grib_to_netcdf command can be used. Note: a netCDF library must be available on the system.
ENABLE_JPG=OFF
ENABLE_PNG=OFF

As OpenIFS models do 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.

Setting this removes the need for the Jasper or OpenJPG libraries.

ENABLE_PYTHON=ONOFFSome of the utilities that come with the OpenIFS model make use of the python interface to ecCodes e.g. the tools to create and manipulate the model data.
For If this option to work, ensure that a python installation is availableis enabled it compiles the Python2 interface which is now deprecated. Users are recommended to turn this option off and use the Python3 interface to eccodes that can be installed from PyPI after eccodes is installed.
ENABLE_FORTRAN=ONThis enables the Fortran interface to ecCodes and should always be on as OpenIFS uses this.
BUILD_SHARED_LIBS=BOTHThe ecCodes library can be built with both 'shared' and 'static' libraries for linking, by default only shared libraries are built. Shared libraries may be needed for the python interface depending on your installation. Some compilers will link to the shared version by default if both shared and static are found (e.g. the GNU compiler). Disabling shared libraries from being generated is not recommended as it may prevents the ecCodes command line tools from working. Note some IBM users may experience problems if shared libraries are built.

...

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


Panel
bgColorlightlightgrey
borderStyledashed

Compiler options if using cmake

Expand
titleclick here to expand...

With cmake, it is better to use the cmake variables to define the compilers rather than rely on environment variables FC and CC.

Code Block
titlegcc/gfortran compilers
cmake .... -DCMAKE_C_COMPILER=gcc -DCMAKE_Fortran_COMPILER=gfortran -DCMAKE_C_FLAGS="-g -O2" -DCMAKE_Fortran_FLAGS="-g -O2"


Code Block
titleIntel compiler:
cmake ... -DCMAKE_C_COMPILER=icc -DCMAKE_Fortran_COMPILER=ifort -DCMAKE_C_FLAGS="-g -O1 -fp-model precise"   \
          -DCMAKE_Fortran_FLAGS="-g -O1 -fp-model precise"


Code Block
languagebash
titleCray compiler (cce)
cmake ... -DCMAKE_C_COMPILER=cc -DCMAKE_Fortran_COMPILER=ftn -DCMAKE_C_FLAGS="-O1 -G2 -hflex_mp=conservative -hadd_paren -hfp1"  \
          -DCMAKE_Fortran_FLAGS="-O1 -G2 -hflex_mp=conservative -hadd_paren -hfp1"


Code Block
titleIBM compiler:
cmake ... -DCMAKE_C_COMPILER=xlc_r -DCMAKE_Fortran_COMPILER=xlf90_r -DCMAKE_C_FLAGS="-g -O2 -qstrict -qarch=auto -qtune=auto"  \
          -DCMAKE_Fortran_FLAGS="-g -O2 -qstrict -qarch=auto -qtune=auto"



...

If the installation was successful, codes_info will report the installation directories. Any problems, please contact openifs-support@ecmwf.int.

 


HTML
<script type="text/javascript" src="https://software.ecmwf.int/issues/s/en_UKet2vtj/787/12/1.2.5/_/download/batch/com.atlassian.jira.collector.plugin.jira-issue-collector-plugin:issuecollector/com.atlassian.jira.collector.plugin.jira-issue-collector-plugin:issuecollector.js?collectorId=047f74ec"></script>

Excerpt Include
Credits
Credits
nopaneltrue