From 128d44677278574bd59b84e83e2d3f79685b8024 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ren=C3=A9=20Widera?= Date: Mon, 23 Sep 2024 12:35:59 +0200 Subject: [PATCH 1/3] fix cray clang compile issue ``` include/alpaka/acc/TagAccIsEnabled.hpp:34:66: error: template template argument has different template parameters than its corresponding template template parameter 34 | using EnabledAccTags = alpaka::meta::Filter; | ^ ``` --- include/alpaka/meta/Filter.hpp | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/include/alpaka/meta/Filter.hpp b/include/alpaka/meta/Filter.hpp index 4a260777a4e5..52e93dc1e1b1 100644 --- a/include/alpaka/meta/Filter.hpp +++ b/include/alpaka/meta/Filter.hpp @@ -12,16 +12,16 @@ namespace alpaka::meta { namespace detail { - template class TList, template class TPred, typename... Ts> + template class TList, template class TPred, typename... Ts> struct FilterImplHelper; - template class TList, template class TPred> + template class TList, template class TPred> struct FilterImplHelper { using type = TList<>; }; - template class TList, template class TPred, typename T, typename... Ts> + template class TList, template class TPred, typename T, typename... Ts> struct FilterImplHelper { using type = std::conditional_t< @@ -30,15 +30,18 @@ namespace alpaka::meta typename FilterImplHelper::type>; }; - template class TPred> + template class TPred> struct FilterImpl; - template class TList, template class TPred, typename... Ts> + template class TList, template class TPred, typename... Ts> struct FilterImpl, TPred> { using type = typename detail::FilterImplHelper::type; }; } // namespace detail - template class TPred> + + /// \tparam TPred Only the first parameter is used, all other must be set by TPred to some default. + /// Using '...' instead of a single type is a workaround for CrayClang. + template class TPred> using Filter = typename detail::FilterImpl::type; } // namespace alpaka::meta From 351935e23d1113753f7a01eb504b3c764ea577ad Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ren=C3=A9=20Widera?= Date: Mon, 23 Sep 2024 12:36:25 +0200 Subject: [PATCH 2/3] fix cray clang OpenMP linker issues CMake is not setting the linker flag `-fopenmp` for the cray clang compiler. --- cmake/alpakaCommon.cmake | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/cmake/alpakaCommon.cmake b/cmake/alpakaCommon.cmake index 8516a0090720..5f778b8c4abe 100644 --- a/cmake/alpakaCommon.cmake +++ b/cmake/alpakaCommon.cmake @@ -357,6 +357,11 @@ if(alpaka_ACC_CPU_B_OMP2_T_SEQ_ENABLE OR alpaka_ACC_CPU_B_SEQ_T_OMP2_ENABLE) else() find_package(OpenMP REQUIRED COMPONENTS CXX) target_link_libraries(alpaka INTERFACE OpenMP::OpenMP_CXX) + # shown with CMake 3.29 and cray clang 17 + # workaround: cmake is missing to add '-fopenmp' to the linker flags + if(CMAKE_CXX_COMPILER_ID STREQUAL "CrayClang") + target_link_libraries(alpaka INTERFACE -fopenmp) + endif() endif() endif() From 4dc8da66432ffd600053f2642505149b7fa8dd5f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ren=C3=A9=20Widera?= Date: Mon, 23 Sep 2024 14:00:42 +0200 Subject: [PATCH 3/3] remove clang `-frelaxed-template-template-args` remove clang workaround --- cmake/alpakaCommon.cmake | 15 --------------- 1 file changed, 15 deletions(-) diff --git a/cmake/alpakaCommon.cmake b/cmake/alpakaCommon.cmake index 5f778b8c4abe..09872beca68e 100644 --- a/cmake/alpakaCommon.cmake +++ b/cmake/alpakaCommon.cmake @@ -194,13 +194,6 @@ else() endif() endif() - # C++17 relaxed template template argument matching is disabled by default until Clang 19 - # https://github.com/llvm/llvm-project/commit/b86e0992bfa6 - # https://www.open-std.org/jtc1/sc22/wg21/docs/cwg_defects.html#150 - # for example, is required to create alpaka::EnabledAccTags - # the feature is implemented since Clang 4 - alpaka_set_compiler_options(HOST_DEVICE target alpaka "$<$>:SHELL:-frelaxed-template-template-args>") - # Add debug optimization levels. CMake doesn't do this by default. # Note that -Og is the recommended gcc optimization level for debug mode but is equivalent to -O1 for clang (and its derivates). alpaka_set_compiler_options(HOST_DEVICE target alpaka "$<$,$,$>:SHELL:-Og>" @@ -610,13 +603,6 @@ if(alpaka_ACC_GPU_HIP_ENABLE) alpaka_set_compiler_options(HOST_DEVICE target alpaka "$<$:-D__HIP_PLATFORM_HCC__>") endif() - # C++17 relaxed template template argument matching is disabled by default until Clang 19 - # https://github.com/llvm/llvm-project/commit/b86e0992bfa6 - # https://www.open-std.org/jtc1/sc22/wg21/docs/cwg_defects.html#150 - # for example, is required to create alpaka::EnabledAccTags - # TODO(SimeonEhrig): restict HIP version, if first HIP version is release using Clang 19 - alpaka_set_compiler_options(HOST_DEVICE target alpaka "$<$:SHELL:-frelaxed-template-template-args>") - alpaka_compiler_option(HIP_KEEP_FILES "Keep all intermediate files that are generated during internal compilation steps 'CMakeFiles/.dir'" OFF) if(alpaka_HIP_KEEP_FILES) alpaka_set_compiler_options(HOST_DEVICE target alpaka "$<$:SHELL:-save-temps>") @@ -677,7 +663,6 @@ if(alpaka_ACC_SYCL_ENABLE) alpaka_set_compiler_options(HOST_DEVICE target alpaka "-fsycl") target_link_options(alpaka INTERFACE "-fsycl") alpaka_set_compiler_options(HOST_DEVICE target alpaka "-sycl-std=2020") - alpaka_set_compiler_options(HOST_DEVICE target alpaka "-frelaxed-template-template-args") #----------------------------------------------------------------------------------------------------------------- # Determine SYCL targets