...
| Section | |||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
Download and unpack
Create a directory called $HOME/ecmwf in which ecCodes will be downloaded and compiled.
If you haven't already obtained ecCodes, get it from the ecCodes Releases page.. We recommend downloading the latest version.
Unpacking ecCodes
To unpack the software:
| Code Block | ||||
|---|---|---|---|---|
| ||||
mkdir -p ecmwf/src cd ecmwf/src tar zxf eccodes-2.9.0-Source.tar.gz |
Configure ecCodes
...
using CMake
ecCodes uses the CMake command for configuration and compilation. CMake is usually installed by default on modern Linux systems but may have to be installed if not.
...
| These lines set the choice of compiler. CMake is often able to determine the available compilers for itself. Note the CMake variables are preferred rather than set environment variables CC and FC. |
CMAKE_INSTALL_PREFIX="../eccodes" | This specifies the location where the 'make install' command will place the eccodes installation. |
ENABLE_NETCDF=ON | Enabling this option ensures the grib_to_netcdf command can be used. Note: a netCDF library must be available on the system. |
ENABLE_JPG=OFFENABLE_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=ON | Some 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 this option to work, ensure that a python installation is available. |
ENABLE_FORTRAN=ON | This enables the Fortran interface to ecCodes and should always be on as OpenIFS uses this. |
BUILD_SHARED_LIBS=BOTH | The ecCodes library can be built with both 'shared' and 'static' libraries for linking, by default only shared libraries are built. Note some IBM users may experience problems if shared libraries are built. |
Available options
| 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. |
Available options
To get additional help on the available options and build configuration run the commandTo get additional help on the available options run the command:
| Code Block |
|---|
cmake -LH eccodes-2.9.0-Source |
...
| Info |
|---|
This command will cause cmake to run its system discovery if this is the first time the command has been used. This may take time to complete. |
Configuring using autotools
Shared and static libraries
grib_api will build both shared and static libraries by default. Shared libraries may need to be built if the python interface is used, depending on your installation.
Some compilers will link to the shared version by default if both are found (e.g. the GNU compiler). Alternately, the option --disable-shared stops the shared libraries from being generated, only the static libraries are built and will be linked. However, this may prevent other grib api tools working and is not generally recommended.
IBM users may find that the grib-api fortran tests will fail unless --disable-shared is used.
Preferred compiler options
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.
Recommended options given below are conservative to ensure stability and bit-reproducibility.
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.
...
| bgColor | lightlightgrey |
|---|---|
| borderStyle | dashed |
Compiler options if using cmake
...
| title | click 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 | ||
|---|---|---|
| ||
cmake .... -DCMAKE_C_COMPILER=gcc -DCMAKE_Fortran_COMPILER=gfortran -DCMAKE_C_FLAGS="-g -O2" -DCMAKE_Fortran_FLAGS="-g -O2" |
| Code Block | ||
|---|---|---|
| ||
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 | ||||
|---|---|---|---|---|
| ||||
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" |
...
| title | IBM compiler: |
|---|
...
Preferred compiler options
By default, cmake 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 to the most appropriate one to use.
Recommended options given below are conservative to ensure stability and bit-reproducibility.
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 | |||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| |||||||||||||||||||||||||||||
Compiler options if using configurecmake
|
Compiling, checks and installing
After configuration the next steps are to compile grib-api ecCodes and install it. To compile grib_api ecCodes do:
| Code Block |
|---|
make | tee make.out |
...
| Info | ||
|---|---|---|
| ||
If your computer has multiple cores as many, use the -j flag to make to build grib_api ecCodes faster. e.g.
|
Next, to verify grib_api ecCodes works correctly run:
| Code Block |
|---|
make check | tee check.out |
Verify that all the grib_api ecCodes tests have passed. If not, go back and check your configure configuration options. In case of difficulty, contact Software.Support@ecmwf.int.
Finally, to install grib_api ecCodes do:
| Code Block |
|---|
make install | tee install.out |
At the end of this step, in the directory $HOME/ecmwf/ that we are using use in this example, you should now have a directory called grib_api eccodes (or some other compiler suffix) which contains the following:
| Code Block |
|---|
% ls grib_apieccodes bin include lib share % ls grib_apieccodes/lib libgrib_api.a libgrib_api.la libgrib_api_f77.a libgrib_api_f77.la libgrib_api_f90.a libgrib_api_f90.la pkgconfig |
After this stage, next steps are to download and install FCM and then download the OpenIFS code and accompanying files.
Possible problems
| Info | ||
|---|---|---|
| ||
OpenIFS support: openifs-support@ecmwf.int. |
Cray
Possible issues with the Cray systems (using cce or gnu compilers) are related to building shared libraries and linking with supporting netcdf and python libraries.
...
LIBRARY_PATH is only used at compile/link time. It may also be necessary to add this directory to the LD_LIBRARY_PATH environment variable which is searched for libraries at runtime.
Intel compiler
We currently recommend not using a higher optimization level than -O1 with the Intel compiler. Failures have been seen with grib_api and the Intel compiler when compiled with -O2.
Some versions of the Intel compiler (v14.0.x) can produce an error "unknown option -soname" when using 'configure. If this occurs try using "--disable-shared" or try the cmake command instead.
IBM compiler
For the IBM xlc compiler we recommend disabling the creation of 'shared libraries' which is known to cause problems with some versions of grib_api.
In this example, note the use of the '_r' form of the IBM compiler to ensure grib_api is compiled 'thread-safe'.
Building on High Performance Computer Systems
Some HPC batch systems have a different hardware architecture for their login (or frontend node) to the batch node, but the frontend compilation system is targeted at the batch nodes. This is known as cross-compilation. If this is the case you may see failures in the 'make check' stage because the checks, although compiled for the backend batch nodes, are being run on the frontend nodes and therefore may not work correctly. If this is the case on your system, we recommend using a batch job to do the 'configure; make; make check; make install' steps.
...
If you have any questions installing grib_api in this type of environment, please contact: openifs-support@ecmwf.int for assistance.
Verify the installation
To verify that the installation was successful, first ensure that the grib_api bin directory is added to your PATH environment variable and then run the grib_info command e.g.
...