Name Date Size #Lines LOC

..--

CMakeLists.txtH A D22-Jun-2021595 1613

FindOpenMPTarget.cmakeH A D13-Jun-202414.8 KiB339287

README.rstH A D24-May-20231.8 KiB4533

README.rst

1=========================
2LLVM OpenMP CMake Modules
3=========================
4
5This directory contains CMake modules for OpenMP. These can be included into a
6project to include different OpenMP features.
7
8.. contents::
9   :local:
10
11Find OpenMP Target Support
12==========================
13
14This module will attempt to find OpenMP target offloading support for a given
15device. The module will attempt to compile a test program using known compiler
16flags for each requested architecture. If successful, the flags required for
17offloading will be loaded into the ``OpenMPTarget::OpenMPTarget_<device>``
18target or the ``OpenMPTarget_<device>_FLAGS`` variable. Currently supported target
19devices are ``NVPTX`` and ``AMDGPU``. This module is still under development so
20some features may be missing.
21
22To use this module, simply add the path to CMake's current module path and call
23``find_package``. The module will be installed with your OpenMP installation by
24default. Including OpenMP offloading support in an application should now only
25require a few additions.
26
27.. code-block:: cmake
28
29  cmake_minimum_required(VERSION 3.20.0)
30  project(offloadTest VERSION 1.0 LANGUAGES CXX)
31
32  list(APPEND CMAKE_MODULE_PATH "${PATH_TO_OPENMP_INSTALL}/lib/cmake/openmp")
33
34  find_package(OpenMPTarget REQUIRED NVPTX)
35
36  add_executable(offload)
37  target_link_libraries(offload PRIVATE OpenMPTarget::OpenMPTarget_NVPTX)
38  target_sources(offload PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/src/Main.cpp)
39
40Using this module requires at least CMake version 3.20.0. Supported languages
41are C and C++ with Fortran support planned in the future. If your application
42requires building for a specific device architecture you can set the
43``OpenMPTarget_<device>_ARCH=<flag>`` variable. Compiler support is best for
44Clang but this module should work for other compiler vendors such as IBM or GNU.
45