...
Alternately grib_api supports installation via a 'configure' script, though this option is deprecated. See instructions below and GRIB API Installation for more details.
CMake compilation must be done is a separate build directory to both the source and the install directory.
Code Block | ||||
---|---|---|---|---|
| ||||
mkdir bld
mkdir grib-api
cd bld
export CC=gcc
export FC=gfortran
cmake ../grib_api-1.14.0-Source \
-DCMAKE_INSTALL_PREFIX="../grib-api" \
-DENABLE_NETCDF=ON \
-DENABLE_JPG=OFF \
-DENABLE_PNG=OFF \
-DENABLE_PYTHON=ON \
-DENABLE_FORTRAN=ON \
-DENABLE_GRIB_THREADS=ON \
-DBUILD_SHARED_LIBS=OFF |
Explanation of lines. Note that all options are prefixed by '-D':
| 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_BUILDINSTALL_TYPEPREFIX=Bit | "Bit" here means 'bit-reproducible'. It instructs CMake to use conservative compiler options that are known to ensure bit-reproducibility in separate runs of OpenIFS. | "../grib_api" | This specifies the location where the 'make install' command will | CMAKE_INSTALL_PREFIX="../grib_api" | This specifies the location where the 'make install' command will place the grib-api installation. |
ENABLE_NETCDF=ON | Enabling 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=ON | Some 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=ON | This enables the Fortran interface to grib_api and should always be on. | ||||
ENABLE_GRIB_THREADS=ON | This 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. |
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. |
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.
BUILD_SHARED_LIBS=OFF | grib_api can be built with both 'shared' and 'static' libraries for linking. Normally static libraries are sufficient. |
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. |
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 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Section | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Info | ||
---|---|---|
| ||
OpenIFS support: openifs-support@ecmwf.int. |
Possible problems
Info | ||
---|---|---|
| ||
OpenIFS support: openifs-support@ecmwf.int. |
Note | ||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| ||||||||||||||
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. 1. If problems occur, first try using the option "--disable-shared" (configure) or "-DBUILD_SHARED_LIBS=OFF") to only build statically linked libraries. 2. If linking problems still occur, try unloading the Cray ATP module which has been known to cause problems.
3. -llibm link error. If the following occurs:
set the environment variable CRAYPE_LINK_TYPE=dynamic (or add the compiler option '-dynamic'). 4. Missing python library If this error occurs when compiling _gribapi_swig.so:
it means the directory path of the python library is not on the linkers list of directories to search. Make sure the python module is loaded. Then check any PYTHON environment variables set by the module and confirm the location of the libpython (or other version) library. Set the environment variable LIBRARY_PATH to the correct directory so that the linker can find it:
| ||||||||||||||
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. |
...