OpenACC

This page contains information on GCC's implementation of the OpenACC specification and related functionality. OpenACC is intended for programming accelerator devices such as GPUs, including code offloading to these devices.

OpenACC is an experimental feature of GCC 5.1 and may not meet the needs of general application development. Support for OpenACC 2.0a in GCC will be available in upcoming releases.

For discussing this project, please use the standard GCC resources (mailing lists, Bugzilla, and so on). It's helpful to put a [OpenACC] tag into your email's Subject line, and set the openacc keyword in any Bugzilla issues filed.

Implementation Status

Listing first the most current work in progress, followed by the GCC release series from most current to older.

Work in Progress (gomp-4_0-branch)

Current development continues on gomp-4_0-branch. Please add a [gomp4] tag to any patches posted for inclusion in that branch.

Work is ongoing to merge gomp-4_0-branch code into trunk, for the next GCC release series.

The implementation status on gomp-4_0-branch is basically the same as with the GCC 6 release series (see below), with the following changes:

GCC 6 Release Series (not yet released)

Compared to GCC 5, the GCC 6 release series will include a much improved implementation of the OpenACC 2.0a specification.

In addition to single-threaded host-fallback execution, offloading is supported for nvptx on x86_64 and PowerPC 64-bit little-endian GNU/Linux host systems. For nvptx offloading, with the OpenACC parallel construct, the execution model allows for an arbitrary number of gangs, up to 32 workers, and 32 vectors.

Initial support for OpenACC kernels:

The host_data directive is not yet supported in Fortran, <http://news.gmane.org/find-root.php?message_id=%3C87r3j4lcrd.fsf%40kepler.schwinge.homeip.net%3E>. The device_type clause is not yet supported. The bind and nohost clauses are not yet supported.

Nested parallelism (cf. CUDA dynamic parallelism) is not yet supported.

Usage of OpenACC constructs inside multithreaded contexts (such as created by OpenMP, or pthread programming) is not yet supported.

If the acc_on_device routine has a compile-time constant argument, it evaluates at compile time to a constant only for C and C++ but not for Fortran.

GCC 5 Release Series (GCC 5.1 released on 2015-04-22)

The GCC 5 release series includes a preliminary implementation of the OpenACC 2.0a specification. No further OpenACC development work is planned for this release series.

In addition to single-threaded host-fallback execution, offloading is supported for nvptx on x86_64 GNU/Linux host systems. For nvptx offloading, with the OpenACC parallel construct, the execution model allows for one gang, one worker, and a number of vectors. These vectors will all execute in "vector-redundant" mode. This means that inside a parallel construct, offloaded code outside of any loop construct will be executed by all vectors, not just a single vector. The reduction clause is not supported with the parallel construct.

The kernels construct is supported only in a simplistic way: the code will be offloaded, but execute with just one gang, one worker, one vector. No directives are supported inside kernels constructs. Reductions are not supported inside kernels constructs.

The atomic, cache, declare, host_data, and routine directives are not supported. The default(none), device_type, firstprivate, and private clauses are not supported. A parallel construct's implicit data attributes for scalar data types will be treated as present_or_copy instead of firstprivate. Only the collapse clause is supported for loop constructs, and there is incomplete support for the reduction clause.

Combined directives (kernels loop, parallel loop) are not supported; use kernels alone, or parallel followed by loop, instead.

Nested parallelism (cf. CUDA dynamic parallelism) is not supported.

Usage of OpenACC constructs inside multithreaded contexts (such as created by OpenMP, or pthread programming) is not supported.

If the acc_on_device routine has a compile-time constant argument, it evaluates at compile time to a constant only for C but not for C++ and Fortran.

Issue Tracking

/!\ Incomplete.

Open OpenACC bugs

Known issues with offloading.

Documentation

/!\ Incomplete.

ACC_DEVICE_TYPE

For ACC_DEVICE_TYPE, there are two options: nvidia, host. The last one, host, means single-threaded host-fallback execution, in a shared-memory mode.

GOMP_DEBUG

GOMP_DEBUG=1 can be set in the environment to enable some debugging output during execution. This is planned to be improved, to be better consumed by users. Currently it logs data management and kernel launches, and if a nvptx device type is active, also includes a dump of the offloaded PTX code.