Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CMake: overwork std::mdspan support for nvcc #2445

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 3 additions & 12 deletions cmake/alpakaCommon.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -951,19 +951,10 @@ 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)
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()
5 changes: 5 additions & 0 deletions script/job_generator/generate_job_yaml.py
Original file line number Diff line number Diff line change
Expand Up @@ -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++"
Expand Down
Loading