BLT (Build, Link, and Test), developed at LLNL, is a CMake-based build system foundation that relies on a combination of macros and widely used open-source tools to simplify and streamline HPC software development.

Users can run BLT on Windows, OSX, and Linux platforms. The software contains “sanity checks” like unit tests, benchmarking, and static and runtime code health checks. By unifying many CMake calls into a single macro—creating an executable target, setting the output directory, and handling dependencies—BLT greatly simplifies the build process.

BLT workflow diagram showing download, configure, build, test, and install steps
Figure: BLT has built-in support for HPC basics, unit testing, and more. (Click to enlarge.)

Batteries Included

BLT’s core macros allow users to create executables and libraries. These macros create targets, associate the sources and headers appropriately, and link libraries into executables.

For code that is portable across different architectures and compilers, BLT provides a macro for managing compiler flags. For instance, the user can set a flag to treat warnings as errors. Compiler flags can also be added to a target.

BLT supports external dependencies for MPI, CUDA, OpenMP, and ROCm approaches to parallel programming. Everything required to use a dependency—includes, libraries, compile flags, link flags, defines, and more—can be added into the executable macro under a single name for that dependency.

Accordingly, as with all BLT macros, a single BLT command contains multiple steps in the CMake process. For example, the following macro compiles hello.cpp as a CUDA file using nvcc (the NVIDIA CUDA compiler).

blt_add_executable(
 NAME hello_world.exe
 SOURCES hello.cpp
 DEPENDS_ON cuda)

NAME is the executable’s name, SOURCES refers to the source file, and the DEPENDS_ON parameter links the previously defined library into the executable. No additional CMake function calls are necessary.

BLT also contains built-in support for benchmarking and unit testing via Gbenchmark (Google benchmarking framework), Gtest (Google Test framework for C/C++), and FRUIT (Fortran Unit Test framework). Each file containing multiple tests is compiled into its own executable, which is then registered as a test. Default configuration options (on/off) for individual unit test libraries are available.

Creating documentation is simpler with BLT’s built-in target() macros. Sphinx and Doxygen are supported for Python and C++ programming, respectively, via paths in the user’s host-config file. The BLT tutorial, linked below, provides examples of text files generated with both documentation systems.

Road Tested

BLT emerged from LLNL’s Axom project, which develops and shares core computer science infrastructure in support of multiphysics simulations. Axom developers also help establish software development processes for other projects in LLNL’s Weapon Simulation and Computing (WSC) program—an effort that initially aimed to simplify the use of CMake while integrating a basic set of tools to simply the software development process. We found broader interest within WSC for this new build system, and subsequently realized an opportunity to share the development and testing of this infrastructure across several initiatives. LLNL projects now using BLT include ALE3D, CHAI, Conduit, RAJA, SAMRAI, and Umpire.

BLT was released as open source in March 2017.