File: README.rst

package info (click to toggle)
swiftlang 6.0.3-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 2,519,992 kB
  • sloc: cpp: 9,107,863; ansic: 2,040,022; asm: 1,135,751; python: 296,500; objc: 82,456; f90: 60,502; lisp: 34,951; pascal: 19,946; sh: 18,133; perl: 7,482; ml: 4,937; javascript: 4,117; makefile: 3,840; awk: 3,535; xml: 914; fortran: 619; cs: 573; ruby: 573
file content (44 lines) | stat: -rw-r--r-- 1,851 bytes parent folder | download | duplicates (12)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
=========================
LLVM OpenMP CMake Modules
=========================

This directory contains CMake modules for OpenMP. These can be included into a
project to include different OpenMP features.

.. contents::
   :local:

Find OpenMP Target Support
==========================

This module will attempt to find OpenMP target offloading support for a given
device. The module will attempt to compile a test program using known compiler
flags for each requested architecture. If successful, the flags required for
offloading will be loaded into the ``OpenMPTarget::OpenMPTarget_<device>``
target or the ``OpenMPTarget_<device>_FLAGS`` variable. Currently supported target
devices are ``NVPTX`` and ``AMDGPU``. This module is still under development so
some features may be missing.

To use this module, simply add the path to CMake's current module path and call
``find_package``. The module will be installed with your OpenMP installation by
default. Including OpenMP offloading support in an application should now only
require a few additions.

.. code-block:: cmake

  cmake_minimum_required(VERSION 3.20.0)
  project(offloadTest VERSION 1.0 LANGUAGES CXX)

  list(APPEND CMAKE_MODULE_PATH "${PATH_TO_OPENMP_INSTALL}/lib/cmake/openmp")

  find_package(OpenMPTarget REQUIRED NVPTX)

  add_executable(offload)
  target_link_libraries(offload PRIVATE OpenMPTarget::OpenMPTarget_NVPTX)
  target_sources(offload PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/src/Main.cpp)

Using this module requires at least CMake version 3.20.0. Supported languages
are C and C++ with Fortran support planned in the future. If your application
requires building for a specific device architecture you can set the
``OpenMPTarget_<device>_ARCH=<flag>`` variable. Compiler support is best for
Clang but this module should work for other compiler vendors such as IBM or GNU.