Skip to content
Merged
396 changes: 0 additions & 396 deletions openmp/README.rst

This file was deleted.

404 changes: 404 additions & 0 deletions openmp/docs/Building.md

Large diffs are not rendered by default.

73 changes: 0 additions & 73 deletions openmp/docs/SupportAndFAQ.rst
Original file line number Diff line number Diff line change
Expand Up @@ -47,79 +47,6 @@ All patches go through the regular `LLVM review process
<https://llvm.org/docs/Contributing.html#how-to-submit-a-patch>`_.


.. _build_offload_capable_compiler:

Q: How to build an OpenMP GPU offload capable compiler?
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

The easiest way to create an offload capable compiler is to use the provided
CMake cache file. This will enable the projects and runtimes necessary for
offloading as well as some extra options.

.. code-block:: sh

$> cd llvm-project # The llvm-project checkout
$> mkdir build
$> cd build
$> cmake ../llvm -G Ninja \
-C ../offload/cmake/caches/Offload.cmake \ # The preset cache file
-DCMAKE_BUILD_TYPE=<Debug|Release> \ # Select build type
-DCMAKE_INSTALL_PREFIX=<PATH> \ # Where the libraries will live
$> ninja install

To manually build an *effective* OpenMP offload capable compiler, only one extra CMake
option, ``LLVM_ENABLE_RUNTIMES="openmp;offload"``, is needed when building LLVM (Generic
information about building LLVM is available `here
<https://llvm.org/docs/GettingStarted.html>`__.). Make sure all backends that
are targeted by OpenMP are enabled. That can be done by adjusting the CMake
option ``LLVM_TARGETS_TO_BUILD``. The corresponding targets for offloading to AMD
and Nvidia GPUs are ``"AMDGPU"`` and ``"NVPTX"``, respectively. By default,
Clang will be built with all backends enabled. When building with
``LLVM_ENABLE_RUNTIMES="openmp"`` OpenMP should not be enabled in
``LLVM_ENABLE_PROJECTS`` because it is enabled by default.

Support for the device library comes from a separate build of the OpenMP library
that targets the GPU architecture. Building it requires enabling the runtime
targets, or setting the target manually when doing a standalone build. This is
done with the ``LLVM_RUNTIME_TARGETS`` option and then enabling the OpenMP
runtime for the GPU target via ``RUNTIMES_<triple>_LLVM_ENABLE_RUNTIMES``.
It's possible to set different flags for each device library by using
``RUNTIMES_<triple>_CMAKE_CXX_FLAGS``. Refer to the cache file for the specific
invocation.

For Nvidia offload, please see :ref:`build_nvidia_offload_capable_compiler`.
For AMDGPU offload, please see :ref:`build_amdgpu_offload_capable_compiler`.

.. note::
The compiler that generates the offload code should be the same (version) as
the compiler that builds the OpenMP device runtimes. The OpenMP host runtime
can be built by a different compiler.

.. _advanced_builds: https://llvm.org//docs/AdvancedBuilds.html

.. _build_nvidia_offload_capable_compiler:

Q: How to build an OpenMP Nvidia offload capable compiler?
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
The CUDA SDK is required on the machine that will build and execute the
offloading application. Normally this is only required at runtime by dynamically
opening the CUDA driver API. This can be disabled in the build by omitting
``cuda`` from the ``LIBOMPTARGET_DLOPEN_PLUGINS`` list which is present by
default. With this setting we will instead find the CUDA library at LLVM build
time and link against it directly.

.. _build_amdgpu_offload_capable_compiler:

Q: How to build an OpenMP AMDGPU offload capable compiler?
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

The OpenMP AMDGPU offloading support depends on the ROCm math libraries and the
HSA ROCr / ROCt runtimes. These are normally provided by a standard ROCm
installation, but can be built and used independently if desired. Building the
libraries does not depend on these libraries by default by dynamically loading
the HSA runtime at program execution. As in the CUDA case, this can be change by
omitting ``amdgpu`` from the ``LIBOMPTARGET_DLOPEN_PLUGINS`` list.

Q: What are the known limitations of OpenMP AMDGPU offload?
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

Expand Down
45 changes: 44 additions & 1 deletion openmp/docs/_themes/llvm-openmp-theme/static/agogo.css_t
Original file line number Diff line number Diff line change
Expand Up @@ -76,15 +76,27 @@ h1, h2, h3, h4 {
margin-bottom: .8em;
}

h1 {
h1, h1 a {
color: {{ theme_headercolor1 }};
text-decoration: none!important;
}

h2 {
padding-bottom: .5em;
border-bottom: 1px solid #3465a4;
text-decoration: none!important;
}

h2 {
padding-bottom: .5em;
border-bottom: 1px solid {{ theme_headercolor2 }};
}

h2 a, h3 a, h4 a {
color: {{ theme_headercolor2 }};
text-decoration: none!important;
}

a.headerlink {
visibility: hidden;
color: #dddddd;
Expand Down Expand Up @@ -536,3 +548,34 @@ div.body div.math p {
span.eqno {
float: right;
}

/* -- definition list -------------------------------------------------------- */

dl.simple dt {
text-align: left
}

/* -- topics ---------------------------------------------------------------- */

nav.contents,
aside.topic,
div.topic {
border: 1px solid #ccc;
padding: 7px;
margin: 10px 0 10px 0;
}

.document nav p {
margin-bottom: 0;
}

.document nav ul {
margin-top: 0;
margin-bottom: 0;
}

p.topic-title {
font-size: 1.1em;
font-weight: bold;
margin-top: 10px;
}
19 changes: 17 additions & 2 deletions openmp/docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,13 +26,28 @@

# Add any Sphinx extension module names here, as strings. They can be extensions
# coming with Sphinx (named 'sphinx.ext.*') or your custom ones.
extensions = ["sphinx.ext.todo", "sphinx.ext.mathjax", "sphinx.ext.intersphinx"]
extensions = [
"sphinx.ext.todo",
"sphinx.ext.mathjax",
"sphinx.ext.intersphinx",
"myst_parser",
]

# Add path for llvm_slug module.
sys.path.insert(0, os.path.abspath(os.path.join("..", "..", "llvm", "docs")))


myst_enable_extensions = ["substitution", "colon_fence", "deflist"]

# Automatic anchors for markdown titles
myst_heading_anchors = 6
myst_heading_slug_func = "llvm_slug.make_slug"

# Add any paths that contain templates here, relative to this directory.
templates_path = ["_templates"]

# The suffix of source filenames.
source_suffix = ".rst"
source_suffix = [".rst", ".md"]

# The encoding of source files.
# source_encoding = 'utf-8-sig'
Expand Down
34 changes: 18 additions & 16 deletions openmp/docs/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -11,25 +11,27 @@
:maxdepth: 1

LLVM/OpenMP Documentation <self>
Building


Building LLVM/OpenMP Offloading
===============================

Building LLVM/OpenMP with offloading support is fully documented in the
:doc:`Support and FAQ <SupportAndFAQ>` page. For a quick start, we recommend
the following template.

.. code-block:: sh
Getting Started
===============

$> cd llvm-project # The llvm-project checkout
$> mkdir build
$> cd build
$> cmake ../llvm -G Ninja \
-C ../offload/cmake/caches/Offload.cmake \ # The preset cache file
-DCMAKE_BUILD_TYPE=<Debug|Release> \ # Select build type
-DCMAKE_INSTALL_PREFIX=<PATH> \ # Where the libraries will live
$> ninja install
Building LLVM/OpenMP is fully documented on the
:doc:`Building` page. For a quick start, we recommend the following template
for building OpenMP with offloading support.

.. code-block:: console

$ git clone https://github.com/llvm/llvm-project.git
$ cd llvm-project
$ mkdir build
$ cd build
$ cmake ../llvm -G Ninja \
-C ../offload/cmake/caches/Offload.cmake \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_INSTALL_PREFIX=<PATH>
$ ninja install # Builds all files and installs files to <PATH>/bin, <PATH>/lib, etc

LLVM/OpenMP Design & Overview
=============================
Expand Down
18 changes: 1 addition & 17 deletions openmp/runtime/README.txt
Original file line number Diff line number Diff line change
Expand Up @@ -23,25 +23,9 @@ www.doxygen.org.

How to Build the LLVM* OpenMP* Runtime Library
==============================================
In-tree build:

$ cd where-you-want-to-live
Check out openmp into llvm/projects
$ cd where-you-want-to-build
$ mkdir build && cd build
$ cmake path/to/llvm -DCMAKE_C_COMPILER=<C compiler> -DCMAKE_CXX_COMPILER=<C++ compiler>
$ make omp
For build instructions, please see https://openmp.llvm.org/Building.html.

Out-of-tree build:

$ cd where-you-want-to-live
Check out openmp
$ cd where-you-want-to-live/openmp/runtime
$ mkdir build && cd build
$ cmake path/to/openmp -DCMAKE_C_COMPILER=<C compiler> -DCMAKE_CXX_COMPILER=<C++ compiler>
$ make

For details about building, please look at README.rst in the parent directory.

Architectures Supported
=======================
Expand Down
25 changes: 2 additions & 23 deletions openmp/runtime/doc/doxygen/libomp_interface.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,30 +26,9 @@ The aim here is to explain the interface from the compiler to the runtime.
The overall design is described, and each function in the interface
has its own description. (At least, that's the ambition, we may not be there yet).

@section sec_building Quickly Building the Runtime
For the impatient, we cover building the runtime as the first topic here.
@section sec_building Building the Runtime

CMake is used to build the OpenMP runtime. For details and a full list of options for the CMake build system,
see <tt>README.rst</tt> in the source code repository. These instructions will provide the most typical build.

In-LLVM-tree build:.
@code
$ cd where-you-want-to-live
Check out openmp into llvm/projects
$ cd where-you-want-to-build
$ mkdir build && cd build
$ cmake path/to/llvm -DCMAKE_C_COMPILER=<C compiler> -DCMAKE_CXX_COMPILER=<C++ compiler>
$ make omp
@endcode
Out-of-LLVM-tree build:
@code
$ cd where-you-want-to-live
Check out openmp
$ cd where-you-want-to-live/openmp
$ mkdir build && cd build
$ cmake path/to/openmp -DCMAKE_C_COMPILER=<C compiler> -DCMAKE_CXX_COMPILER=<C++ compiler>
$ make
@endcode
For build instructions, please see https://openmp.llvm.org/Building.html.

@section sec_supported Supported RTL Build Configurations

Expand Down
Loading