Versions Compared

Key

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


Warning
titleEmoslib now builds with ecCodes

With version 4.4.5, Emoslib is being built by default with ecCodes instead of GRIB-API for GRIB handling. To build EMOSLIB with GRIB_API, please set -DENABLE_ECCODES=OFF. See November synchronised release news item for more information. 

Overview

From the 000400 version,  Emoslib will be using CMake for its compilation and installation. This is part of our aim to achieve a set of homogenisation installation procedures for all ECMWF packages. CMake is a cross-platform free software program for managing the build process of software using a compiler-independent method.

As configure, CMake will run some tests on the user's system to find out if required third-party software libraries are available and notes their locations (paths). Based on this information it will produces the Makefiles needed to compile and install Emoslib.

Requirements

 

Compilers
Chttp://gcc.gnu.org/ 
Fortranhttp://gcc.gnu.org/fortran/ 
Utilities

make

http://www.gnu.org/software/make/ 
cmakehttp://www.cmake.org/version 2.8.11 minimum
ECMWF libraries

ecCodes

alternative:

grib-api

 

ecCodes Home

 

GRIB-API Home (Requires > 1.14)

 

for GRIB 1 & 2 support

Third-party libraries
FFTWhttp://www.fftw.org

If you install from Debian / RPM binary packages, please ensure to install development packages!

Please also note that shared libraries are used to link by default. This means they need to be accessible at runtime. If you prefer to use static libraries you need to specific -DFFTW_USE_STATIC_LIBS=ON with your Emoslib cmake call.

If you build your own FFTW, please make sure also to build the single precision version of FFTW! This means you need to build twice and you need to add --enable-single to your configure call with FFTW.

 

Compilation environment

At ECMWF, SLES11 & OpenSuSE 11.3/13.1 Linux systems (64bit) were used for testing.

Generating the Makefiles with CMake

Info
titlePlease note

If you plan to use Emoslib for higher level tools (MAGP, METV, ...) please consider to use the -fPIC option for linking. Also if you use the gfortran compiler please read our blog entry on the quadmath option.

 

After changing into the build Emoslib directory, the user  has to run CMake with his own options. The command gives feedback on what requirements are fulfilled and what software is still required. Table 1 gives an overview of the different options of configure.  The default (without any options) will compile a share library only and install it in /usr/local/.

 

CMAKE_INSTALL_PREFIXwhere you want to install your Emoslib library /usr/local
CMAKE_BUILD_TYPE

to select the type of compilation:

  • Debug
  • RelWithDebInfo
  • Release
  • Production
RelWithDebInfo
ENABLE_ECCODESchoose ecCodes instead of GRIB_API for GRIB decodingON

ECCODES_PATH

GRIB_API_PATH

where to find ecCodes/grib-api ( if non-standard installation  ) 
ENABLE_FFTWOption to link FFTW, REQUIRED for Octahedral Gaussian gridON
ENABLE_SINGLE_PRECISIONenable single precision version of library (Caution for BUFR handling and interpolation!)OFF
ENABLE_FORTRAN90enable tools which need Fortran 90 (only required for FC=pgf77)ON
ENABLE_INSTALL_TABLESenable the installations of BUFR/GRIBex tables and LSMON
LIBEMOS_INSTALL_LIB_DIRsetting directly the name for the library folder in specified prefix; For systems which require
a directory with the name "lib64" instead of "lib" set this variable to "lib64"
 
cmake options
doc
default

 

The C and Fortran compilers are chosen by CMake. (This can be overwritten by setting the variables CC and FC, on the command line before you call cmake, to the preferred compiler). Further the variables CMAKE_C_FLAGS or CMAKE_Fortran_FLAGS can be used to set compiler flags for optimisation or debugging. 

Compiling the code

After the CMake command has run successfully, the user can compile the library by typing make in the build directory.

Testing your build

After compilation you can test the build library by typing make test.

Installing the library

Once the build and tests have been successfully completed, the command make install copies the library into the correct location on the system. Administrator permission might be required, depending on the installation directory.

Quick installation guide

This is a list of commands needed to install Emoslib. It is assumed “>” is the shell prompt. The Emoslib version number may vary.

>tar -xzf libemos-4.0.0-Source.tar.gz

> cd libemos-4.0.0-Source

> mkdir build ; cd build 

> cmake .. -DCMAKE_INSTALL_PREFIX=/path/to/where/you/install/myEmoslib

...

> make

> make test

> make install  


 

The Interpolation library (EMOSLIB) has been tested for different machine architectures that exist in ECMWF:

  • Decalpha - Compaq Fortran 90, C++ compilers
  • Hppa - HP Fortran and C compilers
  • Linux - The Portland Group compilers pgf90 and pgcc
  • Rs6000 - XL Fortran for AIX- C for AIX Compiler, Version 5
  • Sgimips - MIPSpro F77 compiler- MIPS C compiler
  • Sun4 - Forte Developer 7 Fortran 95 compiler- SunOS/BSD Compatibility Package C compiler

It is possible to use other options for the compilation of source code versions than those which are offered. For example: modifying the configuration files; changing the level of optimisation; etc. The make utility can be used repeatedly. It will only cause the re-compilation of routines which have been modified since the previous make.

The number of bits in the representation of real numbers can be chosen between 32bits and 64bits for all compilers apart from the Gnu compilers.

The library is static and its name follows the normal UNIX convention (it starts with lib and ends in .a), so the library can be specified in the compile/link command using the
standard ld convention, for example:

f77 -o program program.f -lemos

Package contains examples for the GRIB, BUFR, CREX decoding and Interpolation.

The environment variable GRIBEX_DEBUG can be set to ON or OFF to switch the debug output from GRIBEX on or off.

The environment variable GRIBEX_CHECK can be set to ON or OFF to switch the checking of headers in GRIBEX on or off.

The environment variable JDCNDBG can be set to 1 in order to get comprehensive output from INTERPOLATION routines.

The following variable can be set to "true" in order to create CREX massege
with check digit.

USE_E=TRUE

IF build_library SCRIPT IS USED TO BUILD THE LIBRARY AND install SCRIPT TO INSTALL THE LIBRARY AND TABLES, IT IS NOT NECESSARY TO SET ENVIRONMENTAL VARIABLES BELOW THAT POINT TO THE TABLES!

The location of GRIB tables, BUFR tables, CREX tables, Local Definition of GRIB templates and land-sea mask could be specified by putting the specification of the environment variables in your startup files (.profile, ...) to ensure you have access to them upon future logins. Thus:

ECMWF_LOCAL_TABLE_PATH ="chosen directory"/gribtables/
export ECMWF_LOCAL_TABLE_PATH

BUFR_TABLES ="chosen directory"/bufrtables/
export BUFR_TABLES

CREX_TABLES ="chosen directory"/crextables/
export CREX_TABLES

MARS_LSM_PATH ="chosen directory"/land_sea_mask/
export MARS_LSM_PATH

LOCAL_DEFINITION_TEMPLATES ="chosen directory"/gribtemplates/
export LOCAL_DEFINITION_TEMPLATES

 

setenv ECMWF_LOCAL_TABLE_PATH "choosen directory"/gribtables/

setenv BUFR_TABLES "chosen directory"/gribtables/

setenv CREX_TABLES "chosen directory"/gribtables/

setenv MARS_LSM_PATH "chosen directory"/gribtables/

setenv LOCAL_DEFINITION_TEMPLATES  "chosen directory"/gribtemplates/

Please note:

...