Skip to content

Building and running the unit tests (gnitest)

Sung-Eun Choi edited this page Mar 13, 2017 · 18 revisions

We have a set of unit tests in prov/gni/test written for the Criterion framework (https://github.com/Snaipe/Criterion). As of fcfcfed, we are using version 2.2.0. Prior to that we used version 1.2.2. To build the tests, configure with --with-criterion=/path/to/criterion. The unit tests are run from a single program called gnitest.

Building Criterion

Assume INSTALL_DIR is pointing to the directory in which you install Criterion.

Version 2.2.0

Depending on your system, you may need to download and install PCRE. To configure and install PCRE:

% ./configure LDFLAGS=-Wl,-rpath=$INSTALL_DIR/lib --prefix=$INSTALL_DIR

% make install

To configure and install Criterion:

# Might need to load a newer version of cmake depending on your system
% module load cmake

% mkdir build

% cd build

# Might need to specify paths to gcc/g++ depending on your system
% cmake -DCMAKE_VERBOSE_MAKEFILE=ON -DCMAKE_INSTALL_PREFIX=$INSTALL_DIR -DPCRE_INCLUDE_DIR=$INSTALL_DIR/include -DPCRE_LIBRARY=$INSTALL_DIR/lib/libpcre.so -DCMAKE_ASM_COMPILER=/opt/gcc/default/bin/gcc  -DCMAKE_CXX_COMPILER=/opt/gcc/default/bin/g++ -DCMAKE_C_COMPILER=/opt/gcc/default/bin/gcc  ..

% cmake --build .

% make install

All unit tests run on a single node; data transfer operations happen between different endpoints on the same node (in the same process). In the same directory, there is a simple script called run_gnitest that launches the job on a node of a Cray XC with the recommended arguments for aprun or srun.

Note that as of version 2.2.0, by default criterions runs tests in parallel across the cores of your machine. Our unit tests were not designed to do that (e.g., because they may consume all the NIC resources on a node), so the tests must be run with concurrency 1. The run_gnitest script does this for you, but if you run gnitest by hand, you need to pass the -j1. Alternatively, you can set the environment variable CRITERION_JOBS=1 in your shell.

A successful run of gnitest is required for all pull requests.

Building the gnitest on NERSC edison/cori systems

There is a criterion v2.2.0 + patches installed on edison/cori. Use the following configure option to pick up the Criterion version installed on Cori/Edison:--with-criterion=/global/homes/h/hpp/criterion_install.

Note that owing to the way SLURM is configured at NERSC, as well as other Cray customer sites using SLURM, the following srun args option needs to be changed in the run_gnitest script:

args="-N1 --exclusive --cpu_bind=none -t00:20:00 --ntasks=1 --cpus-per-task=8"

to avoid hangs and errors due to resource allocation failures.

For those using ALPS on a system with MAPN enabled

Don't forget if you are using a Cray XC system running ALPS with MAPN enabled, you will need to add --network to the aprun command line.

For those getting "Warning: Unable to initialize DLA..."

Don't forget to export UGNI_FMA_SHARED=0.