From db5a8d78761e59d43db2b463a8f8aaa5e7d2be48 Mon Sep 17 00:00:00 2001 From: Konstantin Pyzhov Date: Fri, 11 Oct 2019 05:46:29 -0400 Subject: FindOpenMP: Add support for HIP clang device pass The HIP clang makes 2 passes when compiling HIP programs: the DEVICE pass and the HOST pass. For openmp, the `-fopenmp` option is only passed to the HOST compilation pass. Therefore, the small test that CMake uses for OpenMP detection fails to compile, and CMake reports failure to detect OpenMP support in the compiler. The suggested solution is to add check for `__HIP_DEVICE_COMPILE__` macro defined by HIP clang for the DEVICE pass to the OpenMP detection test. --- Modules/FindOpenMP.cmake | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Modules/FindOpenMP.cmake b/Modules/FindOpenMP.cmake index def23bb..ab9d73a 100644 --- a/Modules/FindOpenMP.cmake +++ b/Modules/FindOpenMP.cmake @@ -128,6 +128,8 @@ int main(void) { #ifdef _OPENMP omp_get_max_threads(); return 0; +#elif defined(__HIP_DEVICE_COMPILE__) + return 0; #else breaks_on_purpose #endif -- cgit v0.12