mirror of
https://github.com/Kitware/CMake.git
synced 2026-11-06 05:16:58 +00:00
OpenMP::OpenMP_<lang> carries no device flags, and for GCC and Clang links the OpenMP runtime without the OpenMP flag, so target regions built through it fail to link or silently run on the host. Once OpenMP_<lang>_OFFLOAD or OpenMP_<lang>_OFFLOAD_FLAGS is set, the new targets add the device flags, plus the OpenMP flag at link time; otherwise they match the host targets. FindOpenMP.Offload runs a target kernel on a GPU and is enabled in the nvhpc job. Fixes: #21784, #26701
16 lines
408 B
Plaintext
16 lines
408 B
Plaintext
integer function offload_check()
|
|
@OpenMP_Fortran_INCLUDE_LINE@
|
|
integer :: i, s
|
|
logical :: on_host
|
|
on_host = .true.
|
|
s = 0
|
|
!$omp target map(tofrom: on_host, s)
|
|
on_host = omp_is_initial_device()
|
|
do i = 1, 10
|
|
s = s + i
|
|
end do
|
|
!$omp end target
|
|
offload_check = 0
|
|
if (on_host .or. s /= 55) offload_check = 1
|
|
end function offload_check
|