Differences between revisions 16 and 17
Revision 16 as of 2015-11-16 05:06:39
Size: 7710
Editor: tschwinge
Comment: Update
Revision 17 as of 2015-12-10 16:32:23
Size: 7990
Editor: tschwinge
Comment: Update host_data construct, bind and nohost clauses
Deletions are marked like this. Additions are marked like this.
Line 29: Line 29:
  * Support for the host_data construct.
Line 31: Line 30:
  * Incomplete support for the bind and nohost clauses.   * The nohost clause is supported, but support for the bind clause is incomplete:
    works only in C, and only for non-inlined functions,
    <http://news.gmane.org/find-root.php?message_id=%3C87twns3ebs.fsf%40hertz.schwinge.homeip.net%3E>.
Line 58: Line 59:
/!\ out of date /!\
Line 62: Line 64:
The host_data directive is not yet supported. 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>.

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:

  • Assorted bug fixing.
  • Incomplete support for the device_type clause.
  • The nohost clause is supported, but support for the bind clause is incomplete:
  • Initial support for OpenACC kernels, but still in early stages of development:
    • Code will be offloaded onto multiple gangs, but executes with just one worker, and a vector_length of 1.
      • (Each loop nest in a kernels region can be mapped onto a different parallelism dimension (worker, gang, vector) with a certain (optimal) parallelization factor. At the moment, we just support mapping a non-nested loop onto gang parallelism, with the parallelization factor indicated by a command-line switch. A heuristic to do an appropriate mapping should be done using loop analysis.)
    • The loop directive is supported, but most loop directive clauses are not. The independent clause is supported though.
    • No other directives are currently supported inside kernels constructs.
    • Reductions are supported inside kernels constructs.
      • (Note: using the reduction clause in a kernels region is not supported yet.)
    • A single, bounded loop in a kernels region can be parallelized onto gangs by using: -fopenacc -O2 -ftree-parallelize-loops=[number of gangs].

      • Nested loops are supported.
        • (We can only parallelize one loop in the loop nest though.)
      • Only one loop per kernels region is handled.
        • (It's possible to have two or more subsequent loops, as well as sequential code inbetween loop in a kernels region, but that is not yet supported.)
      • No true vectorization.
        • (A dependent but vectorizable loop can be vectorized (mapped on the vector dimension), but that is currently not supported. At the moment, we just use pass_parallelize_loops, which classifies loops as either dependent or independent.)

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.

/!\ out of date /!\ 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 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.

None: OpenACC (last edited 2017-07-27 18:47:45 by cesar)