Skip to content

Commit

Permalink
CMake: Fix Clang 14 version checks
Browse files Browse the repository at this point in the history
Fine tune Clang compiler support table for common CUDA versions and
GPU architectures. Remove unsupported AppleClang compiler flag.
  • Loading branch information
jngrad committed Oct 27, 2022
1 parent 262fbfa commit 7ecc44e
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
11 changes: 8 additions & 3 deletions cmake/FindCUDACompilerClang.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -93,9 +93,14 @@ target_compile_options(
$<$<STREQUAL:${CMAKE_BUILD_TYPE},RelWithDebInfo>:-O2 -g -DNDEBUG>
$<$<STREQUAL:${CMAKE_BUILD_TYPE},Coverage>:-O3 -g>
$<$<STREQUAL:${CMAKE_BUILD_TYPE},RelWithAssert>:-O3 -g>
$<$<VERSION_LESS:${CMAKE_CUDA_COMPILER_VERSION},12>:--cuda-gpu-arch=sm_52> # GTX-900 series (Maxwell)
$<$<VERSION_GREATER_EQUAL:${CMAKE_CUDA_COMPILER_VERSION},12>:--cuda-gpu-arch=sm_61> # GTX-1000 series (Pascal)
$<$<VERSION_GREATER_EQUAL:${CMAKE_CUDA_COMPILER_VERSION},12>:--cuda-gpu-arch=sm_75> # RTX-2000 series (Turing)
# GTX-900 series (Maxwell)
$<$<VERSION_LESS:${CMAKE_CUDA_COMPILER_VERSION},12>:--cuda-gpu-arch=sm_52>
# GTX-1000 series (Pascal)
$<$<VERSION_GREATER_EQUAL:${CMAKE_CUDA_COMPILER_VERSION},10>:--cuda-gpu-arch=sm_61>
# RTX-2000 series (Turing)
# With Clang 14+, architectures sm_70+ are only supported with Thrust 1.11+
# from CUDA 11.3+, for details see https://github.com/NVIDIA/cub/pull/170
$<$<AND:$<VERSION_GREATER_EQUAL:${CMAKE_CUDA_COMPILER_VERSION},10>,$<OR:$<VERSION_LESS:${CMAKE_CUDA_COMPILER_VERSION},14>,$<VERSION_GREATER_EQUAL:${CUDA_VERSION},11.3.0>>>:--cuda-gpu-arch=sm_75>
)

function(add_gpu_library)
Expand Down
1 change: 0 additions & 1 deletion src/python/espressomd/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,6 @@ target_compile_options(
$<$<CXX_COMPILER_ID:Clang,AppleClang,IntelLLVM>:-Wno-sometimes-uninitialized>
$<$<CXX_COMPILER_ID:Clang,AppleClang,IntelLLVM>:-Wno-\#warnings>
$<$<AND:$<CXX_COMPILER_ID:Clang>,$<VERSION_GREATER_EQUAL:$<CXX_COMPILER_VERSION>,14.0.0>>:-Wno-c++17-attribute-extensions>
$<$<AND:$<CXX_COMPILER_ID:AppleClang>,$<VERSION_GREATER_EQUAL:$<CXX_COMPILER_VERSION>,14.0.0>>:-Wno-c++17-attribute-extensions>
$<$<CXX_COMPILER_ID:IntelLLVM>:-Wno-c++17-attribute-extensions>
-Wno-unused-variable)

Expand Down

0 comments on commit 7ecc44e

Please sign in to comment.