Code Architecture

June 2, 2026 ยท View on GitHub

title: Overview

Code Architecture

DBCSR code architecture

dbcsr/
-- src/
---- acc/: contains all code related to accelerators
---- base/: base routines needed to abstract away some machine/compiler dependent functionality
---- block/: block level routines
---- core/: core matrix data structure
---- data/: data handling
---- dist/: data distribution and message passing
---- mm/: matrix-matrix multiplication
---- mpi/: wrappers of the MPI routines
---- ops/: high level operations
---- tas/: tall-and-skinny matrices
---- tensors/: block-sparse tensor framework
---- utils/: utilities
---- work/

Distribution Scheme

Assumed square matrix with 20x20 matrix with 5x5 blocks and a 2x2 processor grid

DBCSR distribution over processors

DBCSR block scheme

List of standard compiler flags

  • OpenMP flag to enable multi-threaded parallelization, e.g. -fopenmp for GNU and Intel compilers.
  • Warnings, e.g. -Werror=aliasing -Werror=ampersand -Werror=c-binding-type -Werror=intrinsic-shadow -Werror=intrinsics-std -Werror=line-truncation -Werror=tabs -Werror=target-lifetime -Werror=underflow -Werror=unused-but-set-variable -Werror=unused-variable -Werror=unused-dummy-argument -Werror=conversion -Werror=zerotrip -Werror=uninitialized -Wno-maybe-uninitialized for GNU compiler.
  • Error checkings (only Coverage and Debug builds), e.g. -fcheck=all -ffpe-trap=invalid,zero,overflow -fbacktrace -finit-real=snan -finit-integer=-42 -finit-derived -Werror=realloc-lhs -finline-matmul-limit=0 for GNU compiler.

List of Macros used in the code

MacroExplanationLanguage
__parallelEnable MPI runsFortran
__USE_MPI_F08Enable use of the modern mpi_f08 module instead of the mpi module to reduce interfacing issuesFortran
__NO_MPI_THREAD_SUPPORT_CHECKWorkaround for MPI libraries that do not declare they are thread safe (funneled) but you want to use them with OpenMP code anywaysFortran
__MKLEnable use of optimized Intel MKL functionsFortran
__NO_STATM_ACCESS, __STATM_RESIDENT or __STATM_TOTALToggle memory usage reporting between resident memory and total memory. In particular, macOS users must use -D__NO_STATM_ACCESSFortran
__NO_ABORTAvoid calling abort, but STOP instead (useful for coverage testing, and to avoid core dumps on some systems)Fortran
__LIBXSEnable LIBXS for host-side batched small matrix multiplications on CPUFortran
__LIBXSMMEnable LIBXSMM link for optimized small matrix multiplications on CPU through LIBXSFortran
__ACCELERATEMust be defined on macOS when Apple's Accelerate framework is used for BLAS and LAPACK (this is due to some interface incompatibilities between Accelerate and reference BLAS/LAPACK)Fortran
NDEBUGAssertions are stripped ("compiled out"), NDEBUG is the ANSI-conforming symbol name (not __NDEBUG). Regular release builds may carry assertions for safetyFortran, C, C++
__CRAY_PM_ACCEL_ENERGY or __CRAY_PM_ENERGYSwitch on collectin energy profiling on Cray systemsFortran
__DBCSR_ACCEnable Accelerator compilationFortran, C, C++
__OPENCLEnable OpenCL acceleration through LIBXSTREAM and LIBXSC
__CUDA_PROFILINGTo turn on Nvidia Tools Extensions. It requires to link -lnvToolsExtFortran, C, C++
__CUDAEnable CUDA accelerationC, C++
__HIPEnable HIP accelerationC, C++