Skip to content

About FUNDAL ​

FUNDAL (Fortran UNified Device Acceleration Library) is a pure Fortran library that manages device (GPU) memory through one API over two offloading backends, OpenACC and OpenMP. A program allocates device arrays, copies data between host and device, frees them and selects devices with the same dev_* calls whatever the backend; the backend is chosen when the code is compiled, by a preprocessor macro.

Both OpenACC and OpenMP have runtime routines for device memory, but with different names, different arguments and C pointers instead of Fortran arrays. FUNDAL wraps them into generic Fortran procedures (six kinds, ranks 1 to 7) that return Fortran pointers with the bounds you choose, so device arrays are indexed like any other array inside kernels.

Backends ​

BuildMacrosDevice memoryCompilers
OpenACC-DDEV_OAC with -DCOMPILER_NVF or -DCOMPILER_GNUacc_malloc, acc_free, acc_memcpy_*nvfortran, gfortran
OpenMP offload-DDEV_OMP (AMD: also -DDEV_HIP)omp_target_alloc, omp_target_free, omp_target_memcpyIntel ifx, AMD amdflang
Compile-time CPU modenonemalloc, free, assignmentany

The concepts page explains the two memory models and how the backends differ; the macros page lists what fundal.H defines for each build.

Reading order ​

This documentation reads in order, and each page links to the next one:

  1. Installation: build FUNDAL and use it in your project.
  2. Concepts: the two memory models, the backends, the host fallback.
  3. The tutorial: seven chapters that grow one program, a 1-D heat solver, from a first device array to MPI and production checks.
  4. The cookbook: short recipes, one for each "how do I ...?".
  5. The reference: every procedure with its exact signature, every macro, error code and global variable.

The API pages are generated from the sources. Upgrading from an older release? See Upgrading: some releases changed a behaviour.

Every code sample of this documentation is part of a program in docs/examples/src that is compiled and run to produce the output shown, by scripts/docs_examples.sh; a workflow fails when the committed outputs differ from the regenerated ones. The programs are built with gfortran and the OpenACC backend and run on the host (no GPU is needed), so they print only values that do not depend on the machine.

Authors ​

Contributions are welcome: see Contributing.

Copyrights ​

FUNDAL is distributed under a multi-licensing system:

Use caseLicense
FOSS projectsGPL v3
Closed source / commercialBSD 2-Clause
Closed source / commercialBSD 3-Clause
Closed source / commercialMIT