Section | ||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
...
Before compiling the OpenIFS model, the 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 environment variables directly correspond to the names of the FCM configuration files in the oifs/make/fcmcfgcfg/
directory in the OpenIFS source. Please see this directory for the choices provided.
...
- opt - Recommended optimized compile settings for OpenIFS for this compiler. Tested to provide best performance for this platform & compiler.
- noopt - Debugging options. No optimization set for all of the OpenIFS code. Suitable for use with a debugger. OpenMP is disabled.
- nansC - Debugging options with extra checks. Array bound checking enabled and variables initialized to NAN (not-a-number). Use of a variable set to NAN NaN will trigger a floating point exception. This option is useful for debugging purposes but will run the slowest.
e.g.
Code Block |
---|
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 So the FCM build system will expect to find a file:
Code Block |
---|
make/fcmcfgcfg/x86_64-intel-opt.cfg |
Setting:
Code Block |
---|
export OIFS_ARCH=aix_pwr6 export OIFS_COMP=xlf export OIFS_BUILD=noopt |
means FCM will look for expect to find a file:
Code Block |
---|
make/fcmcfgcfg/aix_pwr6-xlf-noopt.cfg |
suitable for building on IBM Power6 architecture using the XLF/XLCC compilers using non-optimized settings.
...
As the environment variables refer to the corresponding filename in the make/fcmcfgcfg
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. Be aware however that the optimization compiler flags in the provided configuration files are the recommended ones. It is impossible to test all combinations of compiler flags so OpenIFS may become unstable or performance may reduce if higher optimizations are tried.
...
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
.
If you do not have LAPACK installed on your system or find it does not work, OpenIFS comes with all the necessary LAPACK code to run. It is disabled by default, contact openifs-support@ecmwf.int for instructions on how to enable it.
e.g.
Code Block |
---|
export OIFS_GRIB_API_DIR=$HOME/ecmwf/grib_api_gcc export OIFS_LAPACK_LIB="-L/usr/local/lib -llapack -lblas" |
Or if you prefer you can either edit the default value in the appropriate FCM configuration file in oifs/make/fcmcfgcfg
or make a copy of the supplied configuration file and use that.
...
Code Block |
---|
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. For more information is available on the available fcm command options.
...
Code Block |
---|
[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/fcmcfgcfg/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 |
...
Code Block |
---|
fcm make -v -j 4 -f fcmcfg/oifs.cfg |
will produce a more detailed report and use 4 processes to analyse and build the model code in parallel.
...
After a successful compilation, the OpenIFS executable, master.exe
, can be found in the 'make/build/gnu-opt/oifs/bin
' subdirectory:
Code Block |
---|
% ls buildcfg fcmcfggnu-opt % ls buildgnu-opt/oifs bin include o % ls buildgnu-opt/oifs/bin master.exe |
The 'build
gnu-opt' subdirectory is generated by FCM using the values of the OIFS_COMP & OIFS_BUILD environment variables. The buildoifs/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 buildoifs/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').
...
If you get the message:
Code Block |
---|
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:
Code Block |
---|
export PATH=$PATH:$HOME/fcm-2-3/bin |
. FCM is supplied with OpenIFS and is in the directory 'fcm'.
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> |
...