[Openmp-commits] [PATCH] D104474: [OpenMP] Update FAQ with additional instructions for enabling cuda offloading

Asher Mancinelli via Phabricator via Openmp-commits openmp-commits at lists.llvm.org
Thu Jun 17 10:20:51 PDT 2021


ashermancinelli created this revision.
ashermancinelli added a reviewer: jhuber6.
ashermancinelli added a project: OpenMP.
Herald added subscribers: guansong, yaxunl.
ashermancinelli requested review of this revision.
Herald added a reviewer: jdoerfert.
Herald added subscribers: openmp-commits, sstefan1.

Add an FAQ entry and add a few lines to another one. Document the use of `CCC_OVERRIDE_OPTIONS` for injecting GCC toolchain path.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D104474

Files:
  openmp/docs/SupportAndFAQ.rst


Index: openmp/docs/SupportAndFAQ.rst
===================================================================
--- openmp/docs/SupportAndFAQ.rst
+++ openmp/docs/SupportAndFAQ.rst
@@ -56,6 +56,9 @@
 information about building LLVM is available `here <https://llvm.org/docs/GettingStarted.html>`__.).
 Make sure all backends that are targeted by OpenMP to be enabled. By default,
 Clang will be built with all backends enabled.
+Also ensure that the OpenMP LLVM project is *disabled* (eg don't add openmp
+to the `LLVM_ENABLE_PROJECTS` cmake variable) since enabling the OpenMP
+runtime will build the project anyways.
 
 For Nvidia offload, please see :ref:`_build_nvidia_offload_capable_compiler`.
 For AMDGPU offload, please see :ref:`_build_amdgpu_offload_capable_compiler`.
@@ -206,3 +209,34 @@
 Dynamically linked libraries can be only used if there is no device code split
 between the library and application. Anything declared on the device inside the
 shared library will not be visible to the application when it's linked.
+
+Q: How to build an OpenMP offload capable compiler with an outdated host compiler?
+^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+Enabling the OpenMP runtime will perfor a two-stage build for you.
+If your host compiler is different from your system-wide compiler, you may need
+to set some environment variables such that clang will be able to find the
+correct GCC toolchain in the second stage of the build.
+
+For example, if your system-wide GCC installation is too old to build LLVM and
+you would like to use an external GCC 9.1.0 build, your cmake invokation
+might look like this:
+
+.. code-block:: console
+
+   $ export gcc_toolchain_install_dir=/some/path
+   $ export CCC_OVERRIDE_OPTIONS=^--gcc-toolchain=$gcc_toolchain_install_dir
+
+   $ cmake $llvm_project_source_dir/llvm \
+       -DLLVM_ENABLE_PROJECTS='clang;compiler-rt' \
+       -DLLVM_ENABLE_RUNTIMES=openmp \
+       -DCMAKE_INSTALL_PREFIX=$install_dir \
+       -DCMAKE_C_COMPILER=$gcc_toolchain_install_dir/bin/gcc \
+       -DCMAKE_CXX_COMPILER=$gcc_toolchain_install_dir/bin/g++
+
+The `CCC_OVERRIDE_OPTIONS` environment variable injects the GCC toolchain path
+into the clang invokations in the second stage of the build.
+This issue may manifest itself in compilation errors with the C++ standard being used (eg
+`error: no template named 'enable_if_t' in namespace 'std';`) when you know your
+host compiler is new enough to build LLVM.
+


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D104474.352780.patch
Type: text/x-patch
Size: 2492 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/openmp-commits/attachments/20210617/034a0559/attachment-0001.bin>


More information about the Openmp-commits mailing list