FindOpenACC

在 3.10 版被加入.

Finds and detects the OpenACC support in a compiler:

find_package(OpenACC [<version>] [...])

If the compiler supports OpenACC, the flags required to compile with OpenACC support are returned in variables for the different languages. Currently, only NVHPC, PGI, GNU and Cray compilers are supported.

Imported Targets

This module provides the following Imported Targets:

OpenACC::OpenACC_<lang>

在 3.16 版被加入.

Target encapsulating the usage requirements for using OpenACC from <lang>. This target is available only if OpenACC support is found. <lang> is one of C, CXX, or Fortran.

結果變數

該模組定義了以下變數:

OpenACC_FOUND

在 3.25 版被加入.

Boolean indicating that OpenACC flags for at least one language were found.

This module will set the following variables per language in the project, where <lang> is one of C, CXX, or Fortran:

OpenACC_<lang>_FOUND

Boolean indicating whether OpenACC support for language <lang> was detected.

OpenACC_<lang>_FLAGS

OpenACC compiler flags for <lang>, separated by spaces.

OpenACC_<lang>_OPTIONS

在 3.16 版被加入.

OpenACC compiler flags for <lang>, as a list. Suitable for usage with target_compile_options or target_link_options.

The module will also try to provide the OpenACC version variables:

OpenACC_<lang>_SPEC_DATE

Date of the OpenACC specification implemented by the <lang> compiler.

OpenACC_<lang>_VERSION_MAJOR

Major version of OpenACC implemented by the <lang> compiler.

OpenACC_<lang>_VERSION_MINOR

Minor version of OpenACC implemented by the <lang> compiler.

OpenACC_<lang>_VERSION

OpenACC version implemented by the <lang> compiler.

The specification date is formatted as given in the OpenACC standard: yyyymm where yyyy and mm represents the year and month of the OpenACC specification implemented by the <lang> compiler.

輸入變數

該模組接受以下變數:

OpenACC_ACCEL_TARGET=<target>

If set, the correct target accelerator flag set to the <target> will be returned with the OpenACC_<lang>_FLAGS variable.

範例

Finding OpenACC support and linking the imported target to a project target:

find_package(OpenACC)
target_link_libraries(example PRIVATE OpenACC::OpenACC_C)