Skip to content

Installation

Because the GUERNICA repository is private, you must first be added as a collaborator before you can access the code.

Clone GUERNICA

Once you have access, clone the repository with:

bash git clone <guernica-repository-url> cd GUERNICA

Clone MFEM

GUERNICA uses MFEM as a subdirectory under external/, so MFEM must also be cloned there:

bash mkdir -p external cd external git clone <mfem-repository-url> mfem cd ..

This should give a directory structure like:

text GUERNICA/ ├── external/ │ └── mfem/ ├── src/ ├── include/ ├── configs/ ├── mesh/ └── Makefile

Build GUERNICA

GUERNICA is built with make. If MFEM has not already been built, running make will build both MFEM and GUERNICA automatically.

The general build command is:

bash make [options]

The main command line options are:

  • DEVICE=<cpu|omp|cuda>: selects the build backend
  • CUDA_HOME=<path>: sets the CUDA installation path
  • CUDA_ARCH=<arch>: sets the CUDA architecture
  • PROFILE=<0|1>: enables or disables profiling-friendly build flags
  • NVTX=<auto|1|0>: controls NVTX marker support for profiling builds

Make options

DEVICE

Selects the target backend.

bash make DEVICE=cpu make DEVICE=omp make DEVICE=cuda

Options are:

  • DEVICE=cpu: CPU-only build
  • DEVICE=omp: OpenMP build
  • DEVICE=cuda: CUDA build

Default:

bash DEVICE=cuda

CUDA_HOME

Sets the location of the CUDA installation. This is only relevant for CUDA builds.

Example:

bash make DEVICE=cuda CUDA_HOME=/usr/local/cuda

Default:

bash CUDA_HOME=/usr/local/cuda

CUDA_ARCH

Sets the CUDA compute architecture used in the build. This is only relevant for CUDA builds.

Example:

bash make DEVICE=cuda CUDA_ARCH=80

Default:

bash CUDA_ARCH=75

PROFILE

Controls whether profiling-friendly flags are enabled.

  • PROFILE=0: normal optimized build
  • PROFILE=1: adds profiling/debug-friendly flags

Example:

bash make DEVICE=cuda PROFILE=1

Default:

bash PROFILE=0

When PROFILE=1 is used with DEVICE=cuda, GUERNICA is built with line information and additional profiling flags. When PROFILE=1 is used with non-CUDA builds, host debug/profiling flags are added.

NVTX

Controls NVTX marker support in profiling builds.

  • NVTX=auto: automatically enable NVTX if the library is found
  • NVTX=1: force NVTX on
  • NVTX=0: force NVTX off

Example:

bash make DEVICE=cuda PROFILE=1 NVTX=1

Default:

bash NVTX=auto

Note that NVTX is only used in profiling-oriented CUDA builds.

Inspect build settings

To print the active build configuration:

bash make print-config

This prints the selected backend, compiler, CUDA path, CUDA architecture, profiling settings, flags, and output locations.

Cleaning

Remove object files, the executable, and the saved git diff:

bash make clean

Remove all of the above and also remove the MFEM build directory:

bash make distclean

Notes

  • The executable produced by the build is named guernica.
  • MFEM is rebuilt as needed for the selected DEVICE.
  • CUDA builds require a working CUDA installation.
  • For CUDA builds, MFEM is configured with CUDA enabled and OpenMP enabled.
  • For OpenMP builds, MFEM is configured with OpenMP enabled and CUDA disabled.
  • For CPU builds, MFEM is configured with both OpenMP and CUDA disabled.