OpenMPToolsInterface / LLVM-openmp

This is a stale repository and only there for the commit history. All development moved over to the llvm-project repository! Was: LLVM OpenMP runtime with experimental changes for OMPT (Preview of TR7 features in *_tr branches)
Other
16 stars 13 forks source link

CUDA being found can break builds with newer intel compilers #50

Open zbeekman opened 5 years ago

zbeekman commented 5 years ago

There's no obvious way to configure LLVM-openmp (TR6 with tools support for TAU) WITHOUT CUDA support if find_package(CUDA quiet) succeeds in libomptarget/cmake/Modules/LibomptargetGetDependencies.cmake. While it's possible that it is a quirk of the HPC system I'm on, when compiling, if CUDA is found, it includes /usr/local/cuda/include/cuda_runtime.h which then proceeds to complain that my intel compiler is too new:

host_config.h(79): error: #error directive: -- unsupported ICC configuration! Only ICC 15.0 and ICC 16.0 on Linux x86_64 are supported!
  #error -- unsupported ICC configuration! Only ICC 15.0 and ICC 16.0 on Linux x86_64 are supported!

After some frustration trying to build TAU with TR6 OMPT support, we discovered the CMake variable CMAKE_DISABLE_FIND_PACKAGE_CUDA. It would be nice if either:

  1. CMAKE_DISABLE_FIND_PACKAGE_CUDA were documented in the README.rst, or
  2. A CMake cache option was provided to explicitly turn off CUDA support.

I'm happy to submit a PR if you let me know which proposed solution you prefer, which branch to submit the PR against, and any other relevant contributing guidelines.

Cheers!

jprotze commented 5 years ago

Does your building problem affect upstream master (llvm-mirror/openmp)? That is the preferred repository to use ompt. It also exposes the OpenMP 5.0 interface of ompt.

Which branch do you currently use?

You can always turn libomptarget off: OPENMP_ENABLE_LIBOMPTARGET=off

zbeekman commented 5 years ago

Sorry, but I'm not intimately familiar with the internals of OpenMP. What functionality does LIBOMPTARGET provide? I'm building this specifically to use the tools interface for profiling.

As for which branch I'm using, I'm not 100% sure. That TAU folks at U Oregon provide a tarball for TR6 OMPT support in TAU hosted on their servers. It appears to be a snapshot of master, but there's no git information included, so it's hard to tell which commit they took the snapshot at. I can inquire.

jprotze commented 5 years ago

libomptarget is the LLVM specific way to perform offloading of target regions to accelerators. If you compile your OpenMP application with a current Intel compiler, this library will never be used, so there is no need to build this library.

jprotze commented 5 years ago

@hahnjo would it make sense to turn off building libomptarget by default, when icc is used?

hahnjo commented 5 years ago

I guess it would be cleaner to add a CMake check if CMAKE_CXX_COMPILER can really include cuda_runtime.h (there's a function for that, I just don't recall the name). That would fail during config time for the Intel Compiler and should transparently disable the CUDA plugin.

zbeekman commented 5 years ago

Yes, intro-spection is your friend! You'll need to try compiling with it.

https://cmake.org/cmake/help/v3.9/module/CheckIncludeFile.html#module:CheckIncludeFile

jprotze commented 5 years ago

Well, it's not that easy :) icc does not fail to compile when cuda_runtime.h is included.

The failing command in the build uses nvcc with some weird flags and I gave up in making a try-compile command out of that flags. Also just adding some defines for the compilation with icc is not sufficient.