Skip to content

Commit 7517fea

Browse files
author
Igor Sokolov
committed
gpl: fix CUDA flags
without `-fopenmp` Kokkos raises an error if it was built with OpenMP support Signed-off-by: Igor Sokolov <disk.destroyer@yahoo.com>
1 parent 5a166fb commit 7517fea

1 file changed

Lines changed: 7 additions & 1 deletion

File tree

src/gpl/CMakeLists.txt

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ find_package(ortools REQUIRED)
1313
find_package(LEMON NAMES LEMON lemon REQUIRED)
1414
find_package(OpenMP REQUIRED)
1515

16+
1617
message(STATUS "Found OR-Tools: ${ortools_DIR} (version: ${ortools_VERSION})")
1718

1819
swig_lib(NAME gpl
@@ -112,10 +113,15 @@ if(ENABLE_GPU)
112113
# but the CXX flag is also harmless on the existing CPU TUs.
113114
target_compile_options(gpl_lib PRIVATE
114115
$<$<COMPILE_LANGUAGE:CXX>:-ffp-contract=off>
115-
$<$<COMPILE_LANGUAGE:CUDA>:--fmad=false>
116+
$<$<COMPILE_LANGUAGE:CUDA>:--fmad=false --extended-lambda>
116117
$<$<COMPILE_LANGUAGE:HIP>:-ffp-contract=off>
117118
)
118119
target_link_libraries(gpl_lib Kokkos::kokkos KokkosFFT::fft)
120+
if (Kokkos_ENABLE_OPENMP)
121+
target_compile_options(gpl_lib PRIVATE
122+
$<$<COMPILE_LANGUAGE:CUDA>:-fopenmp>
123+
)
124+
endif()
119125
if(Kokkos_ENABLE_CUDA)
120126
# cuda runtime symbols are referenced from the CUDA TU; expose cudart
121127
# so that gpl_lib (and the openroad binary) link against libcudart.

0 commit comments

Comments
 (0)