Versions Compared

Key

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

...

The FCM software uses configuration files identified by the suffix '.cfg'. They can be found in the directory oifs/make/fcmcfgcfg. The master configuration file for OpenIFS is in fcmcfgcfg/oifs.cfg. It sets general configuration options for FCM, lets FCM know where the source code is and reads a single architecture and compiler specific configuration file. No compiler options are contained in the oifs.cfg file - these are always in the architecture specific configuration files.

The naming convention for these architecture specific files is: <architecture>- <compiler>-<build type>.cfg. For example, the file fcmcfgcfg/x86_64-gnu-opt.cfg would be for Linux 64bit with the GNU compilers and the optimized build. The user can copy and rename the files provided or create their own using an existing one as a template.

Info

Older versions of OpenIFS also used an environment variable OIFS_ARCH to indicate the architecture and files would be named <arch>-<compiler>-<build type>.cfg. This was removed in later versions of OpenIFS.

How to change build type.

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

...

build configuration must first be set by several environment variables:

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

...

These variables and their defaults are set in the fcmcfgcfg/oifs.cfg file. e.g.

Code Block
$OIFS_ARCH{?} = x86_64
$OIFS_COMP{?} = gnu
$OIFS_BUILD{?} = noopt

...

changes the build type to the 'optimized' build. This means instead the file 'fcmcfgcfg/x86_64-gnu-opt.cfg' will be included by fcmcfgcfg/oifs.cfg instead of the file fcmcfgcfg/x86_64-gnu-noopt.cfg.

Create your own config files

Suppose we wanted to run the model on MacOS X with the intel compiler and a optimized setting. We could set:

Code Block
export OIFS_ARCH=darwin
export OIFS_COMP=COMP=osx_intel
export OIFS_BUILD=opt

FCM would then read the file fcmcfg/oifs.cfg which would expect to find a file called: darwin-osx_intel-opt.cfg in the make/cfg directory. This file would need to be created by the user, we . We suggest copying one of the existing .cfg files as a template and modifying it to suit your purpose.

Your own .cfg files do not need to be kept in the make/fcmcfg cfg directory. You might like to create a directory, say, make/mycfg and store them in there. Use the -f option for the fcm make command to load the new files:

Code Block
% cd oifs/make
% mkdir mycfg
% ln -s fcmcfgcfg/oifs.cfg mycfg/oifs.cfg                                 #  the oifs.cfg must exist in the same directory as your custom .cfg file.
% cp fcmcfgcfg/x86_64-intel-opt.cfg mycfg/darwin-osx_intel_v13-opt.cfg
(edit darwin-osx_intel_v13-opt.cfg)
% export OIFS_ARCH=darwin
% export OIFS_COMP=COMP=osx_intel_v13
% export OIFS_BUILD=opt
% fcm make -f mycfg/oifs.cfg

...

All the compiler flags and options are contained in the build specific files (e.g. x86_64- intel-opt.cfg). As above, a number of environment variables can be defined to override the default options set in these files. As a general rule, any variable with a {?} can be overriden by setting an environment variable.

...

  1. Set minimum required options.
    The only two compilation variables that need to be changed before building OpenIFS are the location of the grib_api installation and the location of the LAPACK and BLAS libraries.

    Code Block
    titlee.g.

    code
    export OIFS_GRIB_API_DIR=/home/me/ecmwf/grib_api
    export OIFS_LAPACK_LIB="/opt/apps/lapack/current/LP64 -llapack -lblas"
    fcm make -f fcmcfgcfg/oifs.cfg


    Would override the values of these variables in the FCM config files. In this example, FCM would use the x86_64- gnu-noopt.cfg build as this is the default specified in the oifs.cfg file (in the oifs/make/fcmcfg cfg directory).

  2. Changing compiler and compiler options.
    In this example, the build type is changed and the choice of underlying fortran compiler is altered along with some compiler options:

    Code Block
    export OIFS_COMP=gnu
    export OIFS_BUILD=opt
    export OIFS_GRIB_DIR=/opt/local/ecmwf/grib_api_xe6
    export OIFS_LAPACK_LIB="-L/opt/apps/scal/lib -llapack -lblas"
    export OIFS_FC="mpif90 --fc=crayftn"
    export OIFS_FFLAGS="-g -O1 -m64 -convert big-endian"


    In this example, the compiler has been changed although FCM will still use the x86_64- gnu-opt.cfg configuration file. This might be because a user wants to temporarily try a different compiler. However, it's recommended that each compiler has its own set of .cfg files rather than alter it this way.

    Another example is where an optimized build is required but the optimization level is dropped to -O1 instead of -O2.

...

and then compile using this new file:

Code Block
fcm make -f fcmcfgcfg/oifs_copy.cfg
Info

As this is a new .cfg file for FCM it will do a full build of the code from scratch. Any subsequent builds will be incremental - only compiling changed files.

...

Code Block
titleEdit oifs.cfg and add this line
include = $HERE/debug.cfg

and then create the file fcmcfgcfg/debug.cfg with the 'build.prop' lines you need.

...

The compilation of OpenIFS can be changed is several ways:

  1. Setting the OIFS_ARCH, OIFS_COMP and OIFS_BUILD environment variables.
    This changes the compilation to use one of the supplied FCM configuration files: <arch>- <comp>-<build>.cfg.

  2. Set additional environment variables to override the settings in the supplied configuration files.
    e.g. changing OIFS_FFLAGS to alter the optimization level.

  3. Creating new .cfg files and set OIFS_ARCH, OIFS_COMP & OIFS_BUILD accordingly. Often best when testing is finished and different compiler options have been chosen.

...

Once testing is finished and permanent changes are required, or if unsupported compilers are required, then copy an existing .cfg file and create your own. Any names can be used. For instance, if you wanted to have 2 configurations for the Intel compiler, one with the Intel MPI, the other with OpenMPI, then create files: x86_64- intel_impi-opt.cfg and x86_64- intel_ompi-opt.cfg and use the environment variable OIFS_COMP to switch between them. e.g. OIFS_COMP=intel_ompi (it's up to the user whether they want to create .cfg files for each build type; 'opt', 'noopt', 'nansC').

...