pFUnit
Installation

Installing pFUnit

Comentatry for the page.

Prerequisites

The development work for pFUnit has mostly been carried out on a mixture of systems, including high-end computers, Apple Mac OSX, and linux-based systems. A preliminary Windows/CYGWIN port has been contributed by a user. Full use of the system depends on the following being available.

Note: Recent changes have exposed a latent bug in GCC 4.8.2. The fix is available in the GCC 4.9 development branch and will also appear in GCC 4.8.3 when that is released. Users that require older versions of GCC should use pFUnit 2.1.x.

Doxygen is used to generate documentation.

The system routinely undergoes regression testing with GNU, Intel, and NAG fortran compilers and OpenMPI.

Obtaining pFUnit

The best way to obtain pFUnit is to clone pFUnit from the git repository from SourceForge as follows.

# Read Only Access
git clone git://git.code.sf.net/p/pfunit/code pFUnit

This will create the directory pFUnit in the current working directory.

You may also visit the project page at SourceForge and download the source tarfile "pFUnit.tar.gz" there.

http://sourceforge.net/projects/pfunit/ or http://sourceforge.net/projects/pfunit/files/latest/download

Extracting this tarfile via a command like

$ tar zxf ./pFUnit.tar.gz

will place the pFUnit files into the current working directory.

For other ways to acquire the code visit

https://sourceforge.net/p/pfunit/code/ci/master/tree/

or contact the pFUnit team.

Manifest - What's in the directory?

In the top level of the pFUnit distribution you will see the following files.

CMakeLists.txt - Initial support for cmake-based builds.

COPYRIGHT - Contains information pertaining to the use and distribution of pFUnit.

Examples - Contains examples of how to use pFUnit once it is installed.

GNUmakefile - The top level makefile for building and installing pFUnit.

LICENSE - The NASA Open Source Agreement for GSC-15,137-1 F-UNIT, also known as pFUnit.

README-INSTALL - Basic documentation on pFUnit installation and use.

bin - Executables used to construct and perform unit tests.

include - Files to be included into makefiles or source, including use code.

source - Source code and scripts of the pFUnit library and framework.

tests - Source code for unit testing pFUnit itself.

tools - Tools used to help develop, build, and install pFUnit.

VERSION - Contains a string describing the current version of the framework.

Configuration

Little needs to be done to configure pFUnit for the build, however there are several environment variables on which the package depends.

F90_VENDOR - is set to include the correct makefile in /include, i.e. GNU, Intel, NAG, or PGI. Case insensitive file systems may cause some confusion from time-to-time.

F90 - is set to the Fortran compiler being used: e.g. ifort for Intel, gfortran for GNU.

COMPILER - is set according to F90_VENDOR and is automatically set in the top level makefile.

For MPI-based unit testing, your setup may require the following as well.

MPIF90

$ export MPIF90=mpif90

As a convenience for working with multiple MPI configurations, you may also set the following.

MPIRUN

$ export MPIRUN=/some.path/mpirun

PFUNIT_MAX_ARRAY_RANK

PFUNIT_MAX_ARRAY_RANK - controls the maximum size of the arrays asserts are defined over. If PFUNIT_MAX_ARRAY_RANK is not set, the default is 5 and pFUnit's assertions will be able to handle arrays up to rank 5, i.e. A(:,:,:,:,:). PFUNIT_MAX_ARRAY_RANK and MAX_RANK do not refer to MPI ranks (process id within a group). Example:

$ export PFUNIT_MAX_ARRAY_RANK=5

PFUNIT_MAX_RANK is a deprecated way to set maximum rank and is to be removed in version 4.

DOXYGEN - To generate documentation, set DOXYGEN to the desired executable. NOTE: Doxygen Version 1.8.5 does not respect CamelCase names from Fortran source code by currently converting all to lowercase. It does this to get HTML links correct for references in the source code that also do not respect the CamelCase convention. The Fortran standard specifies case insensitivity. Doxygen 1.7.x seems to better respect CamelCase.

$ export DOXYGEN=/opt/local/share/doxygen/doxygen-1.7.6/bin/doxygen

Building pFUnit

Building pFUnit for testing serial codes (Non-MPI)

  1. Change to the directory into which pFUnit has been placed.
  2. Set the environment variables (for example in bash):
    $ export F90=gfortran-mp-4.8
    $ export F90_VENDOR=GNU
  3. To build pFUnit for unit testing of serial codes, execute make. The unit tests for pFUnit itself will run automatically.
    $ make tests
    3.1 Occasionally on the first run through, one will get a spurious (runtime) error, for example in the unix process component.
    Re-execute "make tests" to check again.
  4. At this point the pFUnit object library is in the source directory, along with a large number of Fortran module files.

Building pFUnit for testing parallel codes (MPI)

To build pFUnit for unit testing MPI-based codes, be sure that the environment is properly set up for the MPI implementation you are using. Depending on your local environment, you may need execute the build within a batch or other job queing system, e.g. an interactive batch job under PBS. The steps for building pFUnit start out the same as for the serial case above, but add MPI=YES to the environment to switch on MPI support. The MPI-based unit tests for pFUnit itself will run automatically. Again, occasionally a spurious (runtime) error may appear on the first execution.

  1. Execute make as follows.
    $ make tests MPI=YES
  2. At this point an MPI-enabled pFUnit object library is in the source directory, along with a large number of Fortran module files.

Also, one may get some harmless "no symbols" warnings when the pFUnit library is constructed.

OPENMP

Initial (limited) support for OPENMP has been implemented. At this writing, a basic functionality is available.

The process for building pFUnit for testing OPENMP-based codes is similar to that for other paradigms.

  1. To compile for OPENMP support execute make as follows.
    $ make tests OPENMP=YES
  2. At this point the OPENMP-enabled pFUnit is ready to be installed.

Cleaning

To clean the pFUnit build directory for the space or to rebuild there are two options.

  1. Make clean to remove object files and other intermediate products.
    $ make clean
  2. Make distclean to remove libraries and other more final products.
    $ make distclean
  3. Some directories support a make src_clean to remove intermediate products in subdirectories.

Documentation

A start at documentation for pFUnit is in the documentation directory. Doxygen is our primary documentation tool. To make the documentation, which will be generated in the documentation directory, please invoke the following from the top level of your pFUnit distribution.

$ make documentation

Or to make a reference manual.

$ make documentation/pFUnit2-ReferenceManual.pdf

To select a specific version of Doxygen, please set the DOXYGEN environment variable as in Configuration. You may wish to do this if your code uses CamelCase names as current versions of Doxygen (1.8.5) do not respect this convention for Fortran.

CMAKE

Initial support for CMAKE has been implemented. At this writing, a basic functionality is available.

  1. The process for building pFUnit using cmake is as follows. In the top directory of the distribution make a new directory to support the build, then change to that directory and run cmake (pointing back to the source) to generate the required makefiles.
    $ mkdir build
    $ cd build
    $ # e.g. cmake -DMPI=YES -DOPENMP=NO -DINSTALL_PATH=<A path> <path to source>
    $ cmake -DMPI=NO ..
    $ make tests

One may also set the environment variable PFUNIT instead of setting INSTALL_PATH on the cmake command line as given above.

If your MPI installation does not provide mpirun, you may try to set -DMPI_USE_MPIEXEC=YES to tell CMake to use its FindMPI function to find out how to execute the tests.

  1. If the build is successful, then at this point make install should work.

Installation

Installation - Serial

To install pFUnit for regular use, set INSTALL_DIR to the location in which to place pFUnit. This can be done on the make command line. For example, after compiling pFUnit for serial use (MPI absent or MPI=NO), please try.

$ # In the top of the pFUnit build directory.
$ make install INSTALL_DIR=/opt/pfunit/pfunit-serial

Note: you may need special priveleges to install in some locations, e.g. via sudo.

To test the installation set PFUNIT to INSTALL_DIR, then change the working directory to Examples in pFUnit distribution and execute "make," which will run a number of examples. These include some expected (intentional) failures.

$ # In the top pFUnit build directory...
$ export PFUNIT=/opt/pfunit/pfunit-serial
$ cd Examples
$ make

Installation - MPI

For installing an MPI-enabled pFUnit library, change to the top of the distribution and execute make with MPI=YES. You may need to "make distclean" first. After compilation and pFUnit passes its self-tests, then installation proceeds as for the serial case above.

$ make install INSTALL_DIR=/opt/pfunit/pfunit-parallel

To test, set PFUNIT and go into Examples/MPI_Halo directory.

$ # In the top pFUnit build directory...
$ export PFUNIT=/opt/pfunit/pfunit-parallel
$ # The variable MPIF90 must be set to the appropriate build script.
$ export MPIF90=mpif90
$ cd Examples/MPI_Halo
$ make

This will compile and run a set of parallel examples that includes intentional failures. To run all of the examples try executing "make MPI=YES" in the Examples directory.

Installation - OPENMP

At this time the OPENMP version of pFUnit can be installed in the same way as for the serial or MPI-parallel codes. OPENMP support, tests, and examples are limited as of this writing.

Installation - DEFAULT DIRECTORY

If INSTALL_DIR is not set, "make install" will attempt to install pFUnit into the top build directory. This will create directories such as lib and mod in the top level of the build directory and will overwrite the include/base.mk with include/base-install.mk. If this is not desired, then "make develop" will put back the original base.mk, which is the file to be used for development and building pFUnit. In general, we recommend installing to a directory that is not also the build directory.