Cray: Fix OpenMP linking issue
Add the `CrayClang` compiler ID to the list of OpenMP flag candidates and ensure the flags are propagated to the link step to trigger the Cray OpenMP offload linker (`cce_omp_offload_linker`) wrapper. Fixes: #24402, #24962
This commit is contained in:
parent
e8e48ebabd
commit
3b18fa9e8b
@ -152,6 +152,7 @@ function(_OPENMP_FLAG_CANDIDATES LANG)
|
|||||||
set(OMP_FLAG_XL "-qsmp=omp")
|
set(OMP_FLAG_XL "-qsmp=omp")
|
||||||
# Cray compiler activate OpenMP with -h omp, which is enabled by default.
|
# Cray compiler activate OpenMP with -h omp, which is enabled by default.
|
||||||
set(OMP_FLAG_Cray " " "-h omp")
|
set(OMP_FLAG_Cray " " "-h omp")
|
||||||
|
set(OMP_FLAG_CrayClang "-fopenmp")
|
||||||
set(OMP_FLAG_Fujitsu "-Kopenmp" "-KOMP")
|
set(OMP_FLAG_Fujitsu "-Kopenmp" "-KOMP")
|
||||||
set(OMP_FLAG_FujitsuClang "-fopenmp" "-Kopenmp")
|
set(OMP_FLAG_FujitsuClang "-fopenmp" "-Kopenmp")
|
||||||
|
|
||||||
@ -677,7 +678,8 @@ foreach(LANG IN LISTS OpenMP_FINDLIST)
|
|||||||
set_property(TARGET OpenMP::OpenMP_${LANG} PROPERTY
|
set_property(TARGET OpenMP::OpenMP_${LANG} PROPERTY
|
||||||
INTERFACE_COMPILE_OPTIONS "$<$<COMPILE_LANGUAGE:${LANG}>:SHELL:${OpenMP_${LANG}_FLAGS}>")
|
INTERFACE_COMPILE_OPTIONS "$<$<COMPILE_LANGUAGE:${LANG}>:SHELL:${OpenMP_${LANG}_FLAGS}>")
|
||||||
if(CMAKE_${LANG}_COMPILER_ID STREQUAL "Fujitsu"
|
if(CMAKE_${LANG}_COMPILER_ID STREQUAL "Fujitsu"
|
||||||
OR ${CMAKE_${LANG}_COMPILER_ID} STREQUAL "IntelLLVM")
|
OR ${CMAKE_${LANG}_COMPILER_ID} STREQUAL "IntelLLVM"
|
||||||
|
OR CMAKE_${LANG}_COMPILER_ID MATCHES "^(Cray|CrayClang)$")
|
||||||
set_property(TARGET OpenMP::OpenMP_${LANG} PROPERTY
|
set_property(TARGET OpenMP::OpenMP_${LANG} PROPERTY
|
||||||
INTERFACE_LINK_OPTIONS "SHELL:${OpenMP_${LANG}_FLAGS}")
|
INTERFACE_LINK_OPTIONS "SHELL:${OpenMP_${LANG}_FLAGS}")
|
||||||
endif()
|
endif()
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
cmake_minimum_required(VERSION 3.30)
|
cmake_minimum_required(VERSION 4.0)
|
||||||
project(TestFindOpenMP NONE)
|
project(TestFindOpenMP NONE)
|
||||||
include(CTest)
|
include(CTest)
|
||||||
|
|
||||||
@ -44,6 +44,19 @@ if(test_msvc_runtime)
|
|||||||
endif()
|
endif()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
# FIXME(#26701) Needed to check target offload conditions
|
||||||
|
foreach(c C CXX Fortran)
|
||||||
|
if(NOT "${OpenMP_TEST_${c}}")
|
||||||
|
continue()
|
||||||
|
endif()
|
||||||
|
if(CMAKE_${c}_COMPILER_ID MATCHES "^(Cray|CrayClang)$")
|
||||||
|
get_target_property(link_options OpenMP::OpenMP_${c} INTERFACE_LINK_OPTIONS)
|
||||||
|
if(NOT link_options)
|
||||||
|
message(FATAL_ERROR "OpenMP_${c} Interface Link Options not set for Cray Compiler")
|
||||||
|
endif()
|
||||||
|
endif()
|
||||||
|
endforeach()
|
||||||
|
|
||||||
foreach(c C CXX CUDA Fortran)
|
foreach(c C CXX CUDA Fortran)
|
||||||
if(NOT "${OpenMP_TEST_${c}}")
|
if(NOT "${OpenMP_TEST_${c}}")
|
||||||
continue()
|
continue()
|
||||||
|
Loading…
Reference in New Issue
Block a user