From 4a694edad83c1b4264d3710eb7829e8176d19bbd Mon Sep 17 00:00:00 2001 From: Daniel Arndt Date: Thu, 18 Jul 2024 19:02:30 +0000 Subject: [PATCH] Fix compiling with SYCL and IntelLLVM --- examples/01-axpy-ndarray/CMakeLists.txt | 7 +++++-- examples/02-axpy-dualview/CMakeLists.txt | 7 +++++-- examples/03-axpy-view/CMakeLists.txt | 7 +++++-- examples/04-complex-ndarray/CMakeLists.txt | 7 +++++-- src/flcl-cxx.hpp | 4 ++++ test/CMakeLists.txt | 5 ++++- 6 files changed, 28 insertions(+), 9 deletions(-) diff --git a/examples/01-axpy-ndarray/CMakeLists.txt b/examples/01-axpy-ndarray/CMakeLists.txt index cd69d80..9330449 100644 --- a/examples/01-axpy-ndarray/CMakeLists.txt +++ b/examples/01-axpy-ndarray/CMakeLists.txt @@ -20,8 +20,11 @@ target_link_libraries(example-axpy-ndarray ${PROJECT_LIBS} flcl::flcl) if (CMAKE_Fortran_COMPILER_ID STREQUAL "XL") target_link_options(example-axpy-ndarray PRIVATE LINKER:-lxlf90_r) endif() -if (CMAKE_Fortran_COMPILER_ID STREQUAL "Intel" OR CMAKE_Fortran_COMPILER_ID STREQUAL "GNU") - set_target_properties(example-axpy-ndarray PROPERTIES LINKER_LANGUAGE Fortran) +if (CMAKE_Fortran_COMPILER_ID MATCHES "Intel" OR CMAKE_Fortran_COMPILER_ID STREQUAL "GNU") + set_target_properties(example-axpy-ndarray PROPERTIES LINKER_LANGUAGE Fortran) +endif() +if (CMAKE_Fortran_COMPILER_ID STREQUAL "IntelLLVM") + target_link_options(example-axpy-ndarray PRIVATE -fsycl) endif() set(RPATHS "$ENV{LD_LIBRARY_PATH}") set_target_properties(example-axpy-ndarray PROPERTIES diff --git a/examples/02-axpy-dualview/CMakeLists.txt b/examples/02-axpy-dualview/CMakeLists.txt index 703b64a..a86b8c0 100644 --- a/examples/02-axpy-dualview/CMakeLists.txt +++ b/examples/02-axpy-dualview/CMakeLists.txt @@ -20,8 +20,11 @@ target_link_libraries(example-axpy-dualview ${PROJECT_LIBS} flcl::flcl) if (CMAKE_Fortran_COMPILER_ID STREQUAL "XL") target_link_options(example-axpy-dualview PRIVATE LINKER:-lxlf90_r) endif() -if (CMAKE_Fortran_COMPILER_ID STREQUAL "Intel" OR CMAKE_Fortran_COMPILER_ID STREQUAL "GNU") - set_target_properties(example-axpy-dualview PROPERTIES LINKER_LANGUAGE Fortran) +if (CMAKE_Fortran_COMPILER_ID MATCHES "Intel" OR CMAKE_Fortran_COMPILER_ID STREQUAL "GNU") + set_target_properties(example-axpy-dualview PROPERTIES LINKER_LANGUAGE Fortran) +endif() +if (CMAKE_Fortran_COMPILER_ID STREQUAL "IntelLLVM") + target_link_options(example-axpy-dualview PRIVATE -fsycl) endif() set(RPATHS "$ENV{LD_LIBRARY_PATH}") set_target_properties(example-axpy-dualview PROPERTIES diff --git a/examples/03-axpy-view/CMakeLists.txt b/examples/03-axpy-view/CMakeLists.txt index 471a085..e269a82 100644 --- a/examples/03-axpy-view/CMakeLists.txt +++ b/examples/03-axpy-view/CMakeLists.txt @@ -20,8 +20,11 @@ target_link_libraries(example-axpy-view ${PROJECT_LIBS} flcl::flcl) if (CMAKE_Fortran_COMPILER_ID STREQUAL "XL") target_link_options(example-axpy-view PRIVATE LINKER:-lxlf90_r) endif() -if (CMAKE_Fortran_COMPILER_ID STREQUAL "Intel" OR CMAKE_Fortran_COMPILER_ID STREQUAL "GNU") - set_target_properties(example-axpy-view PROPERTIES LINKER_LANGUAGE Fortran) +if (CMAKE_Fortran_COMPILER_ID MATCHES "Intel" OR CMAKE_Fortran_COMPILER_ID STREQUAL "GNU") + set_target_properties(example-axpy-view PROPERTIES LINKER_LANGUAGE Fortran) +endif() +if (CMAKE_Fortran_COMPILER_ID STREQUAL "IntelLLVM") + target_link_options(example-axpy-view PRIVATE -fsycl) endif() set(RPATHS "$ENV{LD_LIBRARY_PATH}") set_target_properties(example-axpy-view PROPERTIES diff --git a/examples/04-complex-ndarray/CMakeLists.txt b/examples/04-complex-ndarray/CMakeLists.txt index ce50610..12bc712 100644 --- a/examples/04-complex-ndarray/CMakeLists.txt +++ b/examples/04-complex-ndarray/CMakeLists.txt @@ -20,8 +20,11 @@ target_link_libraries(example-complex-ndarray ${PROJECT_LIBS} flcl::flcl) if (CMAKE_Fortran_COMPILER_ID STREQUAL "XL") target_link_options(example-complex-ndarray PRIVATE LINKER:-lxlf90_r) endif() -if (CMAKE_Fortran_COMPILER_ID STREQUAL "Intel" OR CMAKE_Fortran_COMPILER_ID STREQUAL "GNU") - set_target_properties(example-complex-ndarray PROPERTIES LINKER_LANGUAGE Fortran) +if (CMAKE_Fortran_COMPILER_ID MATCHES "Intel" OR CMAKE_Fortran_COMPILER_ID STREQUAL "GNU") + set_target_properties(example-complex-ndarray PROPERTIES LINKER_LANGUAGE Fortran) +endif() +if (CMAKE_Fortran_COMPILER_ID STREQUAL "IntelLLVM") + target_link_options(example-complex-ndarray PRIVATE -fsycl) endif() set(RPATHS "$ENV{LD_LIBRARY_PATH}") set_target_properties(example-complex-ndarray PROPERTIES diff --git a/src/flcl-cxx.hpp b/src/flcl-cxx.hpp index f362160..cdad851 100644 --- a/src/flcl-cxx.hpp +++ b/src/flcl-cxx.hpp @@ -60,6 +60,8 @@ namespace flcl { using HostMemorySpace = Kokkos::CudaUVMSpace; #elif defined(KOKKOS_ENABLE_HIP) using HostMemorySpace = Kokkos::HIPManagedSpace; +#elif defined(KOKKOS_ENABLE_SYCL) +using HostMemorySpace = Kokkos::Experimental::SYCLSharedUSMSpace; #else using HostMemorySpace = Kokkos::HostSpace; #endif @@ -79,6 +81,8 @@ namespace flcl { using HostMemorySpace = Kokkos::CudaUVMSpace; #elif defined(KOKKOS_ENABLE_HIP) using HostMemorySpace = Kokkos::HIPManagedSpace; + #elif defined(KOKKOS_ENABLE_SYCL) + using HostMemorySpace = Kokkos::Experimental::SYCLSharedUSMSpace; #else using HostMemorySpace = Kokkos::HostSpace; #endif diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index 3e3d55a..13961b0 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -87,9 +87,12 @@ foreach(file ${files}) if (CMAKE_Fortran_COMPILER_ID STREQUAL "XL") target_link_options(${file_without_ext} PRIVATE LINKER:-lxlf90_r) endif() - if (CMAKE_Fortran_COMPILER_ID STREQUAL "Intel" OR CMAKE_Fortran_COMPILER_ID STREQUAL "GNU") + if (CMAKE_Fortran_COMPILER_ID MATCHES "Intel" OR CMAKE_Fortran_COMPILER_ID STREQUAL "GNU") set_target_properties(${file_without_ext} PROPERTIES LINKER_LANGUAGE Fortran) endif() + if (CMAKE_Fortran_COMPILER_ID STREQUAL "IntelLLVM") + target_link_options(${file_without_ext} PRIVATE -fsycl) + endif() set(RPATHS "$ENV{LD_LIBRARY_PATH}") set_target_properties(${file_without_ext} PROPERTIES BUILD_WITH_INSTALL_RPATH True