...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
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 | ||
---|---|---|
| ||
|
Column | |||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| |||||||||||||||||
|
Before you start
...
...
...
...
...
Download and unpack
In this example, 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.
Unpacking grib_api
To unpack the software:
Code Block | ||||
---|---|---|---|---|
| ||||
mkdir -p ecmwf/src
cd ecmwf/src
tar zxf grib_api-1.14.0-Source.tar.gz |
or if your version of tar doesn't support the 'z' option, do:
Code Block |
---|
gunzip grib_api_1.14.0.tar.gz
tar xf grib_api-1.14.0.tar |
Configuring using CMake
...
...
...
...
...
...
language | bash |
---|---|
title | Steps to configure grib-api with CMake assuming gnu compilers |
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
Other build types
CMake supports several standard 'build types'. These are:
Release | Release mode - the binary package does not include debug symbols and some of the source code is ignored; this mode is the default for users. |
Debug | Debug mode - the binary package includes debug symbols in the source code are not ignored; this mode is the default for developers and typically uses low or no optimisation. |
RelWithDebInfo | Release mode, but the binary package includes debug symbols this mode is for developers and users and is often the default build type. |
Available options
To get additional help on the available options (similar to the 'configure --help' command) run the command:
Code Block |
---|
cmake -LH grib_api-1.14.0-Source |
Info |
---|
This command will cause cmake to run its system discovery if this is the first time the command has been used. On some systems, this may take time to complete. |
Configuring using configure
Grib_api compilation can also be made using the GNU configure tool.
...
...
cd grib_api_1.14.0-Source
./configure --prefix=$HOME/ecmwf/grib_api --enable-pthread --enable-python --disable-jpeg
A description of what these options are for:
--prefix | This specifies where you want the grib_api files to be installed. In example here, the source code is in $HOME/ecmwf/grib_api_1.14.0-Source and the compiled grib_api libraries will go in directory $HOME/ecmwf/grib_api . You are free to choose any installation directory but it's recommended to keep the installed binaries & libraries in a separate directory to the source code, in case different compiler versions are needed. On a shared high performance computer facility, the install path would most likely be somewhere central. If nothing is specified for --prefix , by default grib_api will install in /usr/local . |
--disable-jpeg | OpenIFS does not need to support JPEG and PNG for data compression. This removes the need to link OpenIFS against the Jasper library (libjasper.a). |
--enable-pthread | This option ensures that grib_api is thread-safe and is a recommended option. |
--enable-python | This enables the python interface and is required as some OpenIFS utilities make use of the grib-api python interface. If the make fails because of a missing numpy header file you should add the --disable-numpy option. |
Other options
--help
option to configure can be used to see what other options are possible, also see the grib_api website for more detailed documentation.
--enable-vector
option should be used on vector based computers (e.g. NEC). Grib_api will then use a more efficient packing/unpacking method suitable for vector hardware. n.b. there is a bug in the 1.9.18 release that if the --disable-vector option is used, this has the reverse effect of enabling the vector code. See grib_api issue GRIB-269 for more details.
--disable-numpy
option should be used if python is enabled but configure can't find the NumPy package.
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.
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 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.
Section | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
Info | ||
---|---|---|
| ||
OpenIFS support: openifs-support@ecmwf.int. |
Note | ||
---|---|---|
| ||
Possible issues with the Cray compiler are related to building shared libraries. If problems occur try using the option "--disable-shared" to only build statically linked libraries. It may be necessary to set the environment variable CRAYPE_LINK_TYPE=dynamic. For assistance, please contact OpenIFS support. |
Note | ||
---|---|---|
| ||
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. |
Note | ||
---|---|---|
| ||
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'. |
Compiling, checks and installing
After configuration the next steps are to compile grib-api and install it. To compile grib_api do:
Code Block |
---|
make | tee make.out |
which will send all the output from the make command to the file 'make.out' as well as the terminal. This is recommended as the output is lengthy.
Info | ||
---|---|---|
| ||
If using cmake, it will normally hide all the output from the compile commands. If you want to see the compile command (to check the compile options), do: make VERBOSE=1 |
Info | ||
---|---|---|
| ||
If your computer has multiple cores as many, use the -j flag to make to build grib_api faster. e.g.
|
Next, to verify grib_api works correctly run:
Code Block |
---|
make check | tee check.out |
Verify that all the grib_api tests have passed. If not, go back and check your configure options. In case of difficulty, contact Software.Support@ecmwf.int.
Info | ||
---|---|---|
| ||
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. In some cases, the batch system cannot be used for compilation at all. In this case, you have to compile on the frontend but without extra flags 'configure' will assume the build is for the frontend. You can make use of the --host option to ensure the build is correct for the architecture of the batch system. Again though, the tests will fail, a small serial batch job is recommended to make sure grib_api is installed correctly. Note if you plan on using the grib_api software in your own software that runs on the frontend nodes you will need to install grib_api twice; one for the batch system and again for the frontend system. If you have any questions installing grib_api in this type of environment, please contact: openifs-support@ecmwf.int for assistance. |
Finally, to install grib_api do:
Code Block |
---|
make install | tee install.out |
At the end of this step, in the directory $HOME/ecmwf/
we are using in this example you should now have a directory called grib_api
(or some other compiler suffix) which contains the following:
Code Block |
---|
% ls grib_api
bin include lib share
% ls grib_api/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.
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.
Code Block |
---|
% export PATH=$PATH:$HOME/ecmwf/grib_api_gcc/bin
% grib_info
grib_api Version 1.14.0
Default definition files path is used: ..../grib_api_gcc/share/definitions
Definition files path can be changed setting GRIB_DEFINITION_PATH environment variable
Default SAMPLES path is used: ..../grib_api_gcc/share/samples
SAMPLES path can be changed setting GRIB_SAMPLES_PATH environment variable |
If the installation was successful, grib_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>
|
...