ticket_216_TicketSummary - ACCESS-NRI/accessdev-Trac-archive GitHub Wiki

Building ODB API version 0.10.3

Source code, OdbAPI-0.10.3-Source

The source code, "OdbAPI-0.10.3-Source" was downloaded from the following ECMWF website,

https://software.ecmwf.int/wiki/display/ODB/Releases

The source used is,

https://access-svn.nci.org.au/svn/odb/branches/dev/jtl548/odb_api/r69_OdbAPI-0.10.3-Source_nci

Compile-time environment

Before doing the build it's important to start in a clean module environment. So following minimalist module environment was used,

module purge
module load subversion

Compile-time environment for building OdbAPI-0.10.3 is in configure_nci_static.sh and configure_nci_shared.sh.

Note that the ODB API build does not require MPI compiler wrappers such as "mpicc" and "mpif90" (or "mpifort") since none of the C, C++ or Fortran routines makes MPI calls. However if the Fortran90 application which interfaces to the ODB API library makes use of MPI then you will need to compile/link the Fortran90 application using the MPI compiler wrappers (???? check ????).

ToDo When ODB-1.0.0 is installed under ~access and modulefile is created use "module load odb/1.0.0" to set up ODB environment

Modifying ECMWF provided configuration script

1. To build static library

This builds header files, libraries and some tools for using ODB2.

Starting from a sample script provided by ECMWF ("configure_example.sh") I created a new script, "configure_nci_shared.sh". Reading the instrctions in "INSTALL" very carefully following changes were needed to come up with a config script that builds ODB for Raijin:

Modification Reason for modification Additional remark
module loads were put in to set up compile-time environment on Raijin we use modulefiles
CMAKE_PREFIX_PATH ????
CMAKE_C_COMPILER our Intel C compiler is icc
CMAKE_CXX_COMPILER our Intel C++ compiler is icpc
CMAKE_Fortran_COMPILER our Intel Fortran compiler is ifort
CMAKE_INSTALL_PREFIX our installation directory is different
CMAKE_VERBOSE_MAKEFILE:BOOL=YES this creates verbose Makefile which in turn will give verbose output during make

The config script was executed from build/production directory (N.B. '../..' as a commandline argument to config.nci_static.sh):

raijin2:/home/548/jtl548/source/odb_api/r69_OdbAPI-0.10.3-Source_nci/build/production> ../../configure_nci_static.sh ../.. > \
out.configure_nci_static.sh.txt 2>err.configure_nci_static.sh.txt

I checked err.* and out.* that there weren't any problems. I then double-checked using ccmake (see #215 for ccmake usage) to check that all the required libraries were found.

Before running "make" the same compile-time environment as that used in the CMake config was set up (see configure_nci_static.sh and configure_nci_shared.sh). I then ran "make" (N.B. use of the switch, j causes make to fail):

make > out.make.txt 2>err.make.txt  # compile and link using Makefile produced by CMake

Finally I ran "make install" from the subdirectory, "../build/production" to install the software to "/home/548/jtl548/apps/odb_api/0.10.3"

2. To build shared library and ODB migrator

Modification Reason for modification Additional remark
CMAKE_SKIP_RPATH ????
BUILD_SHARED_LIBS to build shared libraries
ENABLE_MIGRATOR, ENABLE_FORTRAN, ENABLE_PYTHON

I have hit a problem. It looks like CMake files for setting libraries are not available for Intel Fortran compilers.

Mark Curtis offered a solution. Create a CMake file "cmake/FindIntelFortran.cmake" modelled on "cmake/FindPGIFortran.cmake" (for example) and update "cmake/ecbuild_find_fortranlibs.cmake".

Note 1. Intel Fortran compiler should be called CMAKE_Fortran_COMPILER=intel

Dependence of ODB API on ODB build

ODB API needs to be built afresh if a new build of ODB is done. See #215.

Useful information

CMake

For a brief introduction to CMake and its use in building ODB see ticket/215/TicketSummary

Additional sample Cmake configuration files

For some additional CMake configuration files see here. Note that these are not version controlled as these did not come with ODB API tarball.

ToDo

  • After a successful 'make' and 'make install' the 2 files, '_pyodbapi.so' and 'pyodbapi.py' end up under, $install_dir/lib/python/site-packages

    and not under

    $install_dir/lib/python2.7.6/site-packages/odb

    Where should the 2 files be installed?

  • In configure_nci_shared.sh is the CMake option, CMAKE_PREFIX_PATH used?

  • Once Tan has installed the new ODB 1.0.0 package in raijin:/projects/access/apps/odb/linux/1.0.0 and a modulefile is written modify config script so that the script does proper 'module load odb/1.0.0'

  • put compile-time environment in a separate file which gets sourced by CMake config file and which can be sourced prior to make