From fbe8081349c24e16df5e274e4752279a1ea6f677 Mon Sep 17 00:00:00 2001 From: Simeon Ehrig Date: Wed, 8 Jan 2025 15:07:26 +0100 Subject: [PATCH] improve behavior if mdspan is enabled and alpaka_CUDA_EXPT_EXTENDED_LAMBDA is disabled - Instead automatically disabling mdspan if alpaka_CUDA_EXPT_EXTENDED_LAMBDA is off throw an error. That's more expected behavior than an enabled feature is off. Also the old behavior does not worked, because mdspan was still compiled and throws a compiler error. - Fix bug, that the Clang as CUDA compiler was also affected by the CMake options alpaka_CUDA_EXPT_EXTENDED_LAMBDA, which sets a nvcc flag. --- cmake/alpakaCommon.cmake | 11 ++++------- script/job_generator/generate_job_yaml.py | 5 +++++ 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/cmake/alpakaCommon.cmake b/cmake/alpakaCommon.cmake index 265808889f0..0cfe4d7e831 100644 --- a/cmake/alpakaCommon.cmake +++ b/cmake/alpakaCommon.cmake @@ -951,19 +951,16 @@ endif() if (NOT alpaka_USE_MDSPAN STREQUAL "OFF") if (MSVC AND (alpaka_CXX_STANDARD LESS 20)) - message(WARNING "std::mdspan on MSVC requires C++20. Please enable C++20 via alpaka_CXX_STANDARD. Use of std::mdspan has been disabled.") - set(alpaka_USE_MDSPAN "OFF" CACHE STRING "Use std::mdspan with alpaka" FORCE) + message(FATAL_ERROR "std::mdspan on MSVC requires C++20. Please enable C++20 via alpaka_CXX_STANDARD. Use of std::mdspan has been disabled.") endif () if (alpaka_ACC_GPU_CUDA_ENABLE AND (CMAKE_CUDA_COMPILER_ID STREQUAL "NVIDIA") AND (CMAKE_CXX_COMPILER_ID STREQUAL "Clang")) # this issue actually only occurs when the host compiler (not the CXX compiler) is clang, but cmake does not let us query the host compiler id # see: https://gitlab.kitware.com/cmake/cmake/-/issues/20901 - message(WARNING "std::mdspan does not work with nvcc and clang as host compiler. Use of std::mdspan has been disabled.") - set(alpaka_USE_MDSPAN "OFF" CACHE STRING "Use std::mdspan with alpaka" FORCE) + message(FATAL_ERROR "std::mdspan does not work with nvcc and clang as host compiler. Use of std::mdspan has been disabled.") endif () - if (alpaka_ACC_GPU_CUDA_ENABLE AND (NOT alpaka_CUDA_EXPT_EXTENDED_LAMBDA STREQUAL ON)) - message(WARNING "std::mdspan requires nvcc's extended lambdas. Use of std::mdspan has been disabled.") - set(alpaka_USE_MDSPAN "OFF" CACHE STRING "Use std::mdspan with alpaka" FORCE) + if (alpaka_ACC_GPU_CUDA_ENABLE AND CMAKE_CUDA_COMPILER_ID STREQUAL "NVIDIA" AND (NOT alpaka_CUDA_EXPT_EXTENDED_LAMBDA STREQUAL ON)) + message(FATAL_ERROR "std::mdspan requires nvcc's extended lambdas.") endif() endif() diff --git a/script/job_generator/generate_job_yaml.py b/script/job_generator/generate_job_yaml.py index 7343f62ccef..667ecf79616 100644 --- a/script/job_generator/generate_job_yaml.py +++ b/script/job_generator/generate_job_yaml.py @@ -345,11 +345,16 @@ def job_variables(job: Dict[str, Tuple[str, str]]) -> Dict[str, str]: variables["ALPAKA_CI_STDLIB"] = "libstdc++" variables["CMAKE_CUDA_ARCHITECTURES"] = job[SM_LEVEL][VERSION] variables["ALPAKA_CI_CUDA_VERSION"] = job[ALPAKA_ACC_GPU_CUDA_ENABLE][VERSION] + variables["alpaka_CUDA_EXPT_EXTENDED_LAMBDA"] = "OFF" if job[DEVICE_COMPILER][NAME] == NVCC: # general configuration, if nvcc is the CUDA compiler variables["ALPAKA_CI_CUDA_COMPILER"] = "nvcc" + # MdSpan requires alpaka_CUDA_EXPT_EXTENDED_LAMBDA + if job[MDSPAN][VERSION] == ON_VER: + variables["alpaka_CUDA_EXPT_EXTENDED_LAMBDA"] = "ON" + # configuration, if GCC is the CUDA host compiler if job[HOST_COMPILER][NAME] == GCC: variables["ALPAKA_CI_CXX"] = "g++"