...
If you are familiar with compiling and installing software on linux systems, you will be used to the following steps. Grib_api uses the GNU configure tool to ease building and compilation. It is tested on different platforms and compilers and should not cause any problems. If however, you do have a problem installing grib_api, please email: Software.Support@ecmwf openifs-support@ecmwf.int.
The configure command is contained in the grib_api directory you have just unpacked. We will use the command with a few options to suit OpenIFS and assume we'll use the gcc & gfortran compilers. If you use different compilers, see below.
Code Block | ||
---|---|---|
| ||
cd grib_api_1.9.18
CC=gcc FC=gfortran \
CCFLAGS="-g -O2 -m64 -march=native" FCFLAGS="-g -O2 -m64 -march=native" \
./configure --prefix=$HOME/ecmwf/grib_api_gcc --enable-pthread --disable-jpeg |
...
Warning | ||
---|---|---|
| ||
There is a known bug with 1.9.18 grib_api that when some of the --disable-<feature> (e.g. --disable-vector) or --enable-<feature> options are used, it has the reverse effect and actually enables the option. In most cases the default option is the preferred one. The options used above are known to be safe to use. Any issues or questions can be sent to openifs-suppport@ecmwf.int. | ||
Info | title |
Other options
The --help
option to configure can be used to see what other options are possible, also see the grib_api website for more detailed documentation.
The --enable-python option enables the python interface and is optional but might be useful if you intend to use/write software to access the GRIB output files. If the make fails because of a missing numpy header file you should add the --disable-numpy option.
The --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.
...
Shared and static libraries
grib_api will build both shared and static libraries by default. Shared libraries need to be built if the python interface is used.
Some compilers will link to the shared version by default if both are found (e.g. the GNU compiler). To ensure the correct version of grib_api is found (in case several are available on your system), OpenIFS explicitly lists the static library in the FCM configuration files. Alternately, if you prefer to use the shared library, you must ensure that your LD_LIBRARY_PATH variable is set so that 1.9.18 version compiled here is found first. 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
...
The configure script usually chooses a sensible set of optimized compiler flags for the choice of supported compiler. If you need to override the compiler flags you can do so as shown in the following example. Note also the use of '\' to extend the command over multiple lines.
Code Block | ||
---|---|---|
| ||
CC=gcc FC=gfortran \ CCFLAGS="-g -O2 -m64 FCFLAGS="-g -O2 -m64" \ ./configure --prefix=$HOME/ecmwf/grib_api_gcc --enable-pthread --disable-jpeg |
Code Block | ||
---|---|---|
| ||
CC=icc FC=ifort \ CFLAGS="-g -O1 -m64 -fp-model precise" FCFLAGS="-g -O1 -fp-model precise" \ ./configure --prefix=$HOME/ecmwf/grib_api_icc --enable-pthread --disable-jpeg |
...