Skip to content

Commit

Permalink
Add support for modern Clang compilers (#4601)
Browse files Browse the repository at this point in the history
Description of changes:
- fix Clang 14 compiler support
- fix AppleClang 14 compiler support
  • Loading branch information
kodiakhq[bot] authored Oct 28, 2022
2 parents 3a8d4e5 + 7ecc44e commit 3ae2768
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 8 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
5 changes: 2 additions & 3 deletions src/script_interface/analysis/ObservableStat.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,8 @@ namespace Analysis {
static auto get_summary(Observable_stat const &obs, bool const calc_sp) {
auto const obs_dim = obs.get_chunk_size();

auto const get_obs_contribs =
[obs_dim,
calc_sp](Utils::Span<double> const views) -> std::vector<Variant> {
auto const get_obs_contribs = [obs_dim,
calc_sp](Utils::Span<double> const views) {
if (obs_dim == 1) {
return std::vector<Variant>(views.begin(), views.end());
}
Expand Down
2 changes: 1 addition & 1 deletion testsuite/python/integrator_npt_stats.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ def test_compressibility(self):
compressibility = np.var(Vs) / np.average(Vs)

self.assertAlmostEqual(avp, p_ext, delta=0.02)
self.assertAlmostEqual(compressibility, 0.32, delta=0.02)
self.assertAlmostEqual(compressibility, 0.32, delta=0.025)


if __name__ == "__main__":
Expand Down

0 comments on commit 3ae2768

Please sign in to comment.