OpenACC & OpenMP
Unified API covering both OpenACC and OpenMP backends. The backend is selected at compile time — no conditional code required in user programs.
A pure Fortran library providing a unified API for GPU/device memory management over OpenACC and OpenMP backends — one interface, any accelerator.
A minimal FUNDAL program: allocate device memory, copy data to the GPU, run a kernel, copy back.
program fundal_taste
use, intrinsic :: iso_fortran_env, only : I4P=>int32, R8P=>real64
use :: fundal
implicit none
real(R8P), pointer :: a_dev(:,:,:)=>null() ! device memory
real(R8P), pointer :: b_hos(:,:,:)=>null() ! host memory
integer(I4P) :: ierr
integer(I4P) :: i, j, k
! initialise environment global variables
myhos = dev_get_host_num()
devtype = dev_get_device_type()
call dev_set_device_num(0)
mydev = dev_get_device_num()
! allocate device memory
call dev_alloc(fptr_dev=a_dev, lbounds=[-1,-2,-3], ubounds=[1,2,3], ierr=ierr, dev_id=mydev)
! allocate and set host memory
allocate(b_hos(-1:1,-2:2,-3:3))
b_hos = -3._R8P
! copy to device, work on device, copy back
call dev_memcpy_to_device(dst=a_dev, src=b_hos)
!$acc parallel loop independent deviceptr(a_dev) collapse(3)
!$omp target teams distribute parallel do collapse(3) has_device_addr(a_dev)
do k=-3,3; do j=-2,2; do i=-1,1
a_dev(i,j,k) = a_dev(i,j,k) / 2._R8P
enddo; enddo; enddo
call dev_memcpy_from_device(dst=b_hos, src=a_dev)
print*, b_hos
endprogram fundal_tasteDevice memory is declared as pointer; host memory can be pointer or allocatable. OpenACC and OpenMP pragmas coexist safely — unrecognised directives are ignored by the compiler.
FUNDAL is distributed under a multi-licensing system:
| Use case | License |
|---|---|
| FOSS projects | GPL v3 |
| Closed source / commercial | BSD 2-Clause |
| Closed source / commercial | BSD 3-Clause |
| Closed source / commercial | MIT |
Anyone interested in using, developing, or contributing to FUNDAL is welcome — pick the license that best fits your needs.