OpenACC is an application programming interface (API) that supports offloading of code to accelerator devices. It consists of a set of compiler directives, library routines, and environment variables that influence run-time behavior.
GNU Fortran strives to be compatible to the OpenACC Application Programming Interface v2.0.
To enable the processing of the OpenACC directive !$acc
in
free-form source code; the c$acc
, *$acc
and !$acc
directives in fixed form; the !$
conditional compilation
sentinels in free form; and the c$
, *$
and !$
sentinels in fixed form, gfortran needs to be invoked with
the -fopenacc. This also arranges for automatic linking of
the GNU Offloading and Multi Processing Runtime Library
libgomp.
The OpenACC Fortran runtime library routines are provided both in a
form of a Fortran 90 module named openacc
and in a form of a
Fortran include
file named openacc_lib.h.
Note that this is an experimental feature, incomplete, and subject to change in future versions of GCC. See https://gcc.gnu.org/wiki/OpenACC for more information.