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

GCC 5

GCC 5 includes a preliminary implementation of the OpenACC 2.0a specification.

The execution model currently only 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 yet supported with the parallel construct.

The kernels construct so far 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 currently supported inside kernels constructs. Reductions are not yet supported inside kernels constructs.

The atomic, cache, declare, host_data, and routine directives are not yet supported. The default(none), device_type, firstprivate, and private clauses are not yet 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 currently supported for loop constructs, and there is incomplete support for the reduction clause.

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

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.

Work in Progress

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

The implementation status is the same as with GCC 5, with the following changes:

OpenACC Kernels

Initial support for OpenACC kernels, but still in early stages of development:

Issue Tracking

Open OpenACC bugs

Known issues with offloading.

Documentation

ACC_DEVICE_TYPE

For ACC_DEVICE_TYPE, there are three options: nvidia, host_nonshm, host. The last one, host, means single-threaded host-fallback execution, in a shared-memory mode. In contrast, host_nonshm means execution on the host, still single-threaded, but with an emulated non-shared memory. The idea is that even if no accelerator is currently available, you can still use that one to test your data directives.

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.