You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 12 Next »

Prerequisites

You should have completed the installation of grib_api, FCM and downloaded and unpacked the OpenIFS data files and OpenIFS source code.

Reminder: FCM is the name of the build software used to compile OpenIFS.

Build configuration

Before compiling the OpenIFS model, the build configuration must first be set by several environment variables:

OIFS_ARCH  - This sets the architecture of the computer. By default, the FCM build configuration assumes x86_64 (i.e. Linux).

OIFS_COMP - This sets the choice of compiler. The default is 'gnu' which means the gfortran/gcc compilers will be used.

OIFS_BUILD - This sets the type of build. Several choices can be build; fully optimized (opt), debugging/unoptimized (noopt), debugging with array bound checking (nansC) mode.

These environment variables directly correspond to the names of the FCM configuration files in the oifs/make/fcmcfg/ directory in the OpenIFS source. Please see this directory for the possible choices supported.

e.g.

export OIFS_ARCH=x86_64
export OIFS_COMP=intel
export OIFS_BUILD=opt

means using the Intel ifort compiler on a x86_64 computer architecture and the model will be compiled with full optimization compiler settings. Also the FCM build system will expect to find a file:

make/fcmcfg/x86_64-intel-opt.cfg

Setting:

export OIFS_ARCH=aix_pwr6
export OIFS_COMP=xlf
export OIFS_BUILD=noopt

means FCM will look for a file:

make/fcmcfg/aix_pwr6-xlf-noopt.cfg

suitable for building on IBM Power6 architecture using the XLF/XLCC compilers using non-optimized settings.

Building for other systems/environments

As the environment variables refer to the corresponding filename in the make/fcmcfg  directory it is straightforward to create a build configuration for other environments. Take a copy of an existing file and modify it as necessary. It's also possible to alter compile options by the use of additional environment variables (see below). Which approach you use depends on your personal preference.

Setting the location of libraries

OpenIFS requires a number of libraries (see Prerequisites) to compile. As well as the GRIB_API library, the LAPACK & BLAS numerical libraries are required. An MPI library is also required but this is assumed to be provided by compiler wrappers provided by the MPI implementation (e.g. the command mpif90 rather than gfortran).

To set the location of the GRIB_API & LAPACK libraries, two other environment variables need to be defined as the defaults in the FCM configuration files will most likely not be appropriate (or you can choose to edit the FCM configuration files in make/fcmcfg).

OIFS_GRIB_API_DIR - Defines the location of the grib_api library. If you followed the example in 'Installing grib_api for OpenIFS' it will be installed in $HOME/ecmwf/grib_api_gcc.

OIFS_LAPACK_LIB - Defines the location of the directory containing the liblapack.a and libblas.a files. This varies from system to system but typically /usr/local/lib.

e.g.

export OIFS_GRIB_API_DIR=$HOME/ecmwf/grib_api_gcc
export OIFS_LAPACK_LIB=/usr/local/apps/lapack/lib

Compiling OpenIFS

Once the environment variables are set, OpenIFS can be compiled (make sure you have edited your PATH environment variable to add the FCM installation /bin directory). Assuming you are in the directory where the OpenIFS source code was unpacked:

cd make
fcm make -f fcmcfg/oifs.cfg

The command 'fcm make' starts the compilation. The -f option specifies the location of the master configuration file for OpenIFS.

This generates output similar to:

[init] make                # 2012-12-20 19:59:59Z
[init] make config-parse   # 2012-12-20 19:59:59Z
[info] config-file=...../make/fcmcfg/oifs.cfg
[info] config-file= - ...../make/fcmcfg/x86_64-gnu-opt.cfg
[done] make config-parse   # 0.3s
[init] make dest-init      # 2012-12-20 19:59:59Z
[info] mode=new
[done] make dest-init      # 0.3s
[init] make build          # 2012-12-20 20:00:00Z
[info] sources: total=2194, analysed=2194, elapsed-time=11.7s, total-time=32.2s
[info] target-tree-analysis: elapsed-time=9.8s
[info] compile   targets: modified=2073, unchanged=0, total-time=1095.5s
[info] compile+  targets: modified=628, unchanged=0, total-time=1.6s
[info] ext-iface targets: modified=1247, unchanged=0, total-time=21.9s
[info] install   targets: modified=120, unchanged=0, total-time=0.3s
[info] link      targets: modified=1, unchanged=0, total-time=18.3s
[info] TOTAL     targets: modified=4069, unchanged=0, elapsed-time=316.3s
[done] make build          # 329.1s
[done] make                # 329.8s

Successful compilation

After a successful compilation, the OpenIFS executable, master.exe, can be found in the 'make/build' subdirectory:

% ls
build  fcmcfg
% ls build
bin   include   o
% ls build/bin
master.exe

The 'build' subdirectory is generated by FCM. The build/include directory contains all the files referenced in the code by a '#include' statement. This includes the Fortran interface block files which are auto-generated by FCM and end in .intfb.h. The build/o directory contains all the compiled object files. The OpenIFS build does not place any additional files in the src directory (known as building 'out of source').

Compilation problems

If you get the message:

fcm make -f fcmcfg/oifs.cfg
/bin/ksh: fcm: not found [No such file or directory]

you need to add the 'bin' directory of the unpacked FCM installation to your PATH environment variable:

export PATH=$PATH:$HOME/fcm-2-3/bin

 

 

 

  • No labels