GRVY-0.38.0
Installation and Linkage

libGRVY uses the GNU autotools suite (autoconf, automake, and libtool) for its development build system. This system is popular among the Linux development community and provides a familiar build environment for end users. The three basic steps of the autotools process are:

These installation steps are discussed in more detail below followed by information on how to link against the library once installed. To initiate the build process starting from a release distribution, you should first untar the distribution and enter the top-level directory:

> tar xvfz grvy-0.38.0.tar.gz
> cd grvy-0.38.0/            

External Software Dependencies:

The minimum software required to build libGRVY is a local copy of the Boost library. Note that you can choose to build libGRVY against a header-only version of Boost or a full library installation. A build using the header-only version will disable some miscellaneous libGRVY functionality which leverages Boost libraries (grvy_copy_dir(), in particular). Additional library functionality can be enabled via linkage to optional HDF and MPI libraries.


Configuration

If Boost is installed and available within your default login environment, then libGRVY should automatically configure against the available installation. If, however, your Boost installation is in a non-standard location, use the "--with-boost" option to specify the location.

Since libGRVY provides a Fortran interface, a valid Fortran90 compiler is also required. To date, libGRVY has been successfully tested with gfortran and the Intel ifort compilers. The configuration step will look for available compilers in the user environment but as with any autoconf based configuration, these can be overridden with command line arguments (by setting CXX, CC, and FC appropriately). For full documentation on available configuration options, run "configure --help". The examples below highlight common configuration examples:

Configure with Boost from default login environment (and request installation in user's ~/bin/grvy directory):

> ./configure --prefix=$HOME/bin/grvy

Or, configure with Boost from a specific directory:

> ./configure --prefix=$HOME/bin/grvy --with-boost=$MY_BOOST_DIR/boost-1.37.0

Or, configure with specific Intel compilers:

> ./configure CXX=icpc CC=icc FC=ifort --prefix=$HOME/bin/grvy

Or, configure for Boost header-only compilation:

> ./configure --prefix=$HOME/bin/grvy --enable-boost-headers-only

Or, enable optional functionality requiring MPI:

> ./configure --prefix=$HOME/bin/grvy --enable-mpi

Or, enable optional functionality requiring HDF5:

> ./configure --prefix=$HOME/bin/grvy --with-hdf5=$MY_HDF5_DIR/bin/hdf5-1.8.4

Build

Once configured, issue a "make" to build the software. If successful, this will build the libGRVY library (static and dynamic versions) along with relevant binaries and several examples.

> make

Verifying the build: To verify that the software is working properly, a test option is provided to run a short suite of functionality tests against the local build. To run, issue a "make check" to initiate the tests. If successful, output similar to the following will be generated (the exact number of tests will vary depending on version and configuration options):

> make check
-------------------------------------------------------
Initializing GRVY Tests
-------------------------------------------------------
PASS: init.sh
PASS: C_input_read_variables
PASS: C_input_nofile_available
PASS: C_input_read_missing_variable
PASS: C_input_register_variables
PASS: C_input_register_read_missing_variable
PASS: C_input_dos_newlines
PASS: C_timer_sum
PASS: C_timer_std_width.sh
PASS: C_timer_expanded_width.sh
PASS: C_timer_stats
PASS: C_timer_baseline
PASS: C_timer_no_init
PASS: C_timer_with_reset
PASS: C_timer_no_finalize.sh
PASS: C_unique_dir
PASS: C_wrapper_scratch_dir.sh
PASS: C_math_isnan
PASS: C_math_isinf
PASS: C_check_file_path
PASS: C_input_fdump
PASS: C_wrapper_log.sh
PASS: C_wrapper_log_printf.sh
PASS: C_version
PASS: C_version_stdout
PASS: C_check_copy_dir
PASS: C_hdf_hist_timing
PASS: F_hdf_hist_timing
PASS: CXX_input
PASS: CXX_input_register_variables
PASS: CXX_input_dump
PASS: CXX_timer_std_width.sh
PASS: CXX_timer_expanded_width.sh
PASS: CXX_timer_no_init
PASS: CXX_hdf_hist_timing
PASS: F_wrapper_unique_dir.sh
PASS: F_wrapper_scratch_dir.sh
PASS: F_math
PASS: F_wrapper_check_file_path.sh
PASS: F_wrapper_log.sh
PASS: F_input_read_variables
PASS: F_input_nofile_available
PASS: F_input_read_missing_variable
PASS: F_input_register_variables
PASS: F_input_read_bigstring
PASS: F_input_dump.sh
PASS: F_timer.sh
PASS: F_timer_std_width.sh
PASS: F_timer_expanded_width.sh
PASS: F_version
PASS: F_get_command_arguments.sh
PASS: F_check_copy_dir
-------------------------------------------------------
Standalone Binaries
-------------------------------------------------------
PASS: version
PASS: hostinfo
PASS: gadd.sh
PASS: gadd_unknown_option.sh
PASS: gadd_with_options.sh
PASS: gdump.sh
PASS: gdump_unknown_options.sh
PASS: gdump_with_options.sh
-------------------------------------------------------
Finalizing GRVY Tests, have a snazzy day
-------------------------------------------------------
PASS: finalize.sh
===================
All 61 tests passed
===================

Installation

After the build is complete, issue a "make install" to install the library. The installation will consist of four top-level directories housing the library, binaries, include files, and example files. An example of the top-level directories after installation is shown below:

> make install

Top-level libGRVY installation directory:

> ls $HOME/bin/grvy/
bin/ examples/ include/ lib/

Library Linkage

To link an external C/C++ or Fortran application with an installed version of the library, the include directory must be added to the compilers include search path in order to access the grvy.h header file (or for Fortran, the lib directory should be added to access the pre-compiled grvy F90 module). The lib directory should also be added to the linker search path along with a request to link against the libGRVY library (and the Fortran interface for F90 applications). Several example link steps are provided below. These examples assume that the libGRVY library has been successfully built and installed previously in the users's ~/bin/grvy directory:

C/C++ Example

> $(CC) -I$HOME/bin/grvy/include app.c -L$HOME/bin/grvy/lib -lgrvy

Fortran Example

> $(FC) -I$HOME/bin/grvy/lib app.f90 -L$HOME/bin/grvy/lib -lgrvy -lgrvyf

To embed the dynamic library search path for the libGRVY library directly into the application executable, use an additional linker option as follows:

C/C++ Example (with embedded rpath)

> $(CC) -I$HOME/bin/grvy/include app.c -L$HOME/bin/grvy/lib \
-Wl,-rpath,$HOME/bin/grvy/lib -lgrvy

Important Note: F90 module file formats are not consistent across multiple compilers. Therefore, a Fortran application and the libGRVY F90 interface must be built with the same Fortran compiler family to ensure compatibility.


Generated on Wed Jul 12 2023 16:53:23 for GRVY-0.38.0 by  doxygen 1.8.17