You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
340 lines
21 KiB
340 lines
21 KiB
--- gromacs-2021.7/cmake/gmxManageNvccConfig.cmake 2023-01-31 12:45:45.000000000 +0100
|
|
+++ gromacs-2022.5/cmake/gmxManageNvccConfig.cmake 2023-02-03 12:53:34.000000000 +0100
|
|
@@ -1,11 +1,9 @@
|
|
#
|
|
# This file is part of the GROMACS molecular simulation package.
|
|
#
|
|
-# Copyright (c) 2012,2013,2014,2015,2016 by the GROMACS development team.
|
|
-# Copyright (c) 2017,2018,2019,2020,2021, by the GROMACS development team, led by
|
|
-# Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
|
|
-# and including many others, as listed in the AUTHORS file in the
|
|
-# top-level source directory and at http://www.gromacs.org.
|
|
+# Copyright 2012- The GROMACS Authors
|
|
+# and the project initiators Erik Lindahl, Berk Hess and David van der Spoel.
|
|
+# Consult the AUTHORS/COPYING files and https://www.gromacs.org for details.
|
|
#
|
|
# GROMACS is free software; you can redistribute it and/or
|
|
# modify it under the terms of the GNU Lesser General Public License
|
|
@@ -19,7 +17,7 @@
|
|
#
|
|
# You should have received a copy of the GNU Lesser General Public
|
|
# License along with GROMACS; if not, see
|
|
-# http://www.gnu.org/licenses, or write to the Free Software Foundation,
|
|
+# https://www.gnu.org/licenses, or write to the Free Software Foundation,
|
|
# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
|
#
|
|
# If you want to redistribute modifications to GROMACS, please
|
|
@@ -28,10 +26,10 @@
|
|
# consider code for inclusion in the official distribution, but
|
|
# derived work must not be called official GROMACS. Details are found
|
|
# in the README & COPYING files - if they are missing, get the
|
|
-# official version at http://www.gromacs.org.
|
|
+# official version at https://www.gromacs.org.
|
|
#
|
|
# To help us fund GROMACS development, we humbly ask that you cite
|
|
-# the research papers on the package. Check out http://www.gromacs.org.
|
|
+# the research papers on the package. Check out https://www.gromacs.org.
|
|
|
|
# Manage CUDA nvcc compilation configuration, try to be smart to ease the users'
|
|
# pain as much as possible:
|
|
@@ -51,7 +49,7 @@
|
|
# glibc source shows that _FORCE_INLINES is only used in this string.h
|
|
# feature and performance of memcpy variants is unimportant for CUDA
|
|
# code in GROMACS. So this workaround is good enough to keep problems
|
|
-# away from users installing GROMACS. See Issue #1942.
|
|
+# away from users installing GROMACS. See Issue #1982.
|
|
function(work_around_glibc_2_23)
|
|
try_compile(IS_GLIBC_2_23_OR_HIGHER ${CMAKE_BINARY_DIR} ${CMAKE_SOURCE_DIR}/cmake/TestGlibcVersion.cpp)
|
|
if(IS_GLIBC_2_23_OR_HIGHER)
|
|
@@ -83,67 +81,158 @@
|
|
mark_as_advanced(CUDA_HOST_COMPILER CUDA_HOST_COMPILER_OPTIONS)
|
|
endif()
|
|
|
|
+# We would like to be helpful and reject the host compiler with a
|
|
+# clear error message at configure time, rather than let nvcc
|
|
+# later reject the host compiler as not supported when the first
|
|
+# CUDA source file is built. We've implemented that for current
|
|
+# nvcc running on Unix-like systems, but e.g. changes to nvcc
|
|
+# will further affect the limited portability of this checking
|
|
+# code. Set the CMake variable GMX_NVCC_WORKS on if you want to
|
|
+# bypass this check.
|
|
+if((_cuda_nvcc_executable_or_flags_changed OR CUDA_HOST_COMPILER_CHANGED OR NOT GMX_NVCC_WORKS) AND NOT WIN32)
|
|
+ message(STATUS "Check for working NVCC/C++ compiler combination with nvcc '${CUDA_NVCC_EXECUTABLE}'")
|
|
+ execute_process(COMMAND ${CUDA_NVCC_EXECUTABLE} --compiler-bindir=${CUDA_HOST_COMPILER} -c ${CUDA_NVCC_FLAGS} ${CUDA_NVCC_FLAGS_${_build_type}} ${CMAKE_SOURCE_DIR}/cmake/TestCUDA.cu
|
|
+ RESULT_VARIABLE _cuda_test_res
|
|
+ OUTPUT_VARIABLE _cuda_test_out
|
|
+ ERROR_VARIABLE _cuda_test_err
|
|
+ OUTPUT_STRIP_TRAILING_WHITESPACE)
|
|
+
|
|
+ if(${_cuda_test_res})
|
|
+ message(STATUS "Check for working NVCC/C compiler combination - broken")
|
|
+ message(STATUS "${CUDA_NVCC_EXECUTABLE} standard output: '${_cuda_test_out}'")
|
|
+ message(STATUS "${CUDA_NVCC_EXECUTABLE} standard error: '${_cuda_test_err}'")
|
|
+ if(${_cuda_test_err} MATCHES "nsupported")
|
|
+ message(FATAL_ERROR "NVCC/C++ compiler combination does not seem to be supported. CUDA frequently does not support the latest versions of the host compiler, so you might want to try an earlier C++ compiler version and make sure your CUDA compiler and driver are as recent as possible. Set the GMX_NVCC_WORKS CMake cache variable to bypass this check if you know what you are doing.")
|
|
+ elseif(CMAKE_CXX_COMPILER_ID MATCHES "GNU" AND CMAKE_CXX_COMPILER_VERSION VERSION_EQUAL 11.2 AND CUDA_VERSION VERSION_GREATER 11.4 AND CUDA_VERSION VERSION_LESS 11.7) # Issue #4574, #4641
|
|
+ # Above, we should be checking for VERSION_LESS 11.6.2, but CUDA_VERSION is only "major.minor"
|
|
+ message(FATAL_ERROR "CUDA versions 11.5-11.6.1 are known to be incompatible with some GCC 11.x. Use a different GCC or update your CUDA installation to at least CUDA 11.6.2")
|
|
+ else()
|
|
+ message(FATAL_ERROR "CUDA compiler does not seem to be functional or is not compatible with the host compiler. Set the GMX_NVCC_WORKS CMake cache variable to bypass this check if you know what you are doing.")
|
|
+ endif()
|
|
+ elseif(NOT GMX_CUDA_TEST_COMPILER_QUIETLY)
|
|
+ message(STATUS "Check for working NVCC/C++ compiler combination - works")
|
|
+ set(GMX_NVCC_WORKS TRUE CACHE INTERNAL "Nvcc can compile a trivial test program")
|
|
+ endif()
|
|
+endif() # GMX_CHECK_NVCC
|
|
+
|
|
+# Tests a single flag to use with nvcc.
|
|
+#
|
|
+# If the flags are accepted, they are appended to the variable named
|
|
+# in the first argument. The cache variable named in the second
|
|
+# argument is used to avoid rerunning the check in future invocations
|
|
+# of cmake. The list of flags to check follows these two required
|
|
+# arguments.
|
|
+#
|
|
+# Note that a space-separated string of flags, or a flag-value pair
|
|
+# separated by spaces will not work. Use the single-argument forms
|
|
+# accepted by nvcc, like "--arg=value".
|
|
+#
|
|
+# As this code is not yet tested on Windows, it always accepts the
|
|
+# flags in that case.
|
|
+function(gmx_add_nvcc_flag_if_supported _output_variable_name_to_append_to _flags_cache_variable_name)
|
|
+ # If the check has already been run, do not re-run it
|
|
+ if (NOT ${_flags_cache_variable_name} AND NOT WIN32)
|
|
+ message(STATUS "Checking if nvcc accepts flags ${ARGN}")
|
|
+ # See detailed comment about gcc 7 below
|
|
+ if (CMAKE_CXX_COMPILER_ID MATCHES "GNU" AND CMAKE_CXX_COMPILER_VERSION VERSION_LESS 8)
|
|
+ set(_cache_variable_value TRUE)
|
|
+ message(STATUS "Checking if nvcc accepts flags ${ARGN} - Assuming success when using gcc 7")
|
|
+ else()
|
|
+ if(NOT(CMAKE_CXX_COMPILER_ID MATCHES "GNU" AND CMAKE_CXX_COMPILER_VERSION VERSION_LESS 11))
|
|
+ set(CCBIN "--compiler-bindir=${CUDA_HOST_COMPILER}")
|
|
+ endif()
|
|
+ execute_process(
|
|
+ COMMAND ${CUDA_NVCC_EXECUTABLE} ${ARGN} ${CCBIN} "${CMAKE_SOURCE_DIR}/cmake/TestCUDA.cu"
|
|
+ RESULT_VARIABLE _cuda_success
|
|
+ OUTPUT_QUIET
|
|
+ ERROR_QUIET
|
|
+ )
|
|
+ # Convert the success value to a boolean and report status
|
|
+ if (_cuda_success EQUAL 0)
|
|
+ set(_cache_variable_value TRUE)
|
|
+ message(STATUS "Checking if nvcc accepts flags ${ARGN} - Success")
|
|
+ else()
|
|
+ set(_cache_variable_value FALSE)
|
|
+ message(STATUS "Checking if nvcc accepts flags ${ARGN} - Failed")
|
|
+ endif()
|
|
+ endif()
|
|
+ set(${_flags_cache_variable_name} ${_cache_variable_value} CACHE BOOL "Whether NVCC supports flag(s) ${ARGN}")
|
|
+ endif()
|
|
+ # Append the flags to the output variable if they have been tested to work
|
|
+ if (${_flags_cache_variable_name} OR WIN32)
|
|
+ list(APPEND ${_output_variable_name_to_append_to} ${ARGN})
|
|
+ set(${_output_variable_name_to_append_to} ${${_output_variable_name_to_append_to}} PARENT_SCOPE)
|
|
+ endif()
|
|
+endfunction()
|
|
+
|
|
+# Versions of gcc 7 have differing behavior when executing
|
|
+#
|
|
+# nvcc $args --compiler-bindir=gcc TestCUDA.cu
|
|
+#
|
|
+# and would need e.g. adding -lstdc++ to the command line so that
|
|
+# linking of a C++/CUDA object by the C-compiler flavor of gcc works.
|
|
+# This means we can't reliably test compiler flags in this case
|
|
+# without risking creating other problems. Instead we assume (above)
|
|
+# that all compiler flags will work, and issue this warning.
|
|
+# We also want to skip this warning during GROMACS CI testing.
|
|
+if (CMAKE_CXX_COMPILER_ID MATCHES "GNU" AND CMAKE_CXX_COMPILER_VERSION VERSION_LESS 8
|
|
+ AND NOT DEFINED ENV{GITLAB_CI})
|
|
+ message(WARNING "You are using gcc version 7 with the CUDA compiler nvcc. GROMACS cannot reliably test compiler arguments for this combination, so if you later experience errors in building GROMACS, please use a more recent version of gcc.")
|
|
+endif()
|
|
+
|
|
# If any of these manual override variables for target CUDA GPU architectures
|
|
# or virtual architecture is set, parse the values and assemble the nvcc
|
|
# command line for these. Otherwise use our defaults.
|
|
# Note that the manual override variables require a semicolon separating
|
|
# architecture codes.
|
|
+set(GMX_CUDA_NVCC_GENCODE_FLAGS)
|
|
if (GMX_CUDA_TARGET_SM OR GMX_CUDA_TARGET_COMPUTE)
|
|
- set(GMX_CUDA_NVCC_GENCODE_FLAGS)
|
|
set(_target_sm_list ${GMX_CUDA_TARGET_SM})
|
|
foreach(_target ${_target_sm_list})
|
|
- list(APPEND GMX_CUDA_NVCC_GENCODE_FLAGS "-gencode;arch=compute_${_target},code=sm_${_target}")
|
|
+ gmx_add_nvcc_flag_if_supported(GMX_CUDA_NVCC_GENCODE_FLAGS NVCC_HAS_GENCODE_COMPUTE_AND_SM_${_target} "--generate-code=arch=compute_${_target},code=sm_${_target}")
|
|
+ if (NOT NVCC_HAS_GENCODE_COMPUTE_AND_SM_${_target} AND NOT WIN32)
|
|
+ message(FATAL_ERROR "Your choice of ${_target} in GMX_CUDA_TARGET_SM was not accepted by nvcc, please choose a target that it accepts")
|
|
+ endif()
|
|
endforeach()
|
|
set(_target_compute_list ${GMX_CUDA_TARGET_COMPUTE})
|
|
foreach(_target ${_target_compute_list})
|
|
- list(APPEND GMX_CUDA_NVCC_GENCODE_FLAGS "-gencode;arch=compute_${_target},code=compute_${_target}")
|
|
+ gmx_add_nvcc_flag_if_supported(GMX_CUDA_NVCC_GENCODE_FLAGS NVCC_HAS_GENCODE_COMPUTE_${_target} --generate-code=arch=compute_${_target},code=compute_${_target})
|
|
+ if (NOT NVCC_HAS_GENCODE_COMPUTE_${_target} AND NOT WIN32)
|
|
+ message(FATAL_ERROR "Your choice of ${_target} in GMX_CUDA_TARGET_COMPUTE was not accepted by nvcc, please choose a target that it accepts")
|
|
+ endif()
|
|
endforeach()
|
|
else()
|
|
# Set the CUDA GPU architectures to compile for:
|
|
- # - with CUDA >=9.0 CC 7.0 is supported and CC 2.0 is no longer supported
|
|
- # => compile sm_30, sm_35, sm_37, sm_50, sm_52, sm_60, sm_61, sm_70 SASS, and compute_35, compute_70 PTX
|
|
- # - with CUDA >=10.0 CC 7.5 is supported
|
|
- # => compile sm_30, sm_35, sm_37, sm_50, sm_52, sm_60, sm_61, sm_70, sm_75 SASS, and compute_35, compute_75 PTX
|
|
# - with CUDA >=11.0 CC 8.0 is supported
|
|
# => compile sm_35, sm_37, sm_50, sm_52, sm_60, sm_61, sm_70, sm_75, sm_80 SASS, and compute_35, compute_80 PTX
|
|
|
|
# First add flags that trigger SASS (binary) code generation for physical arch
|
|
- if(CUDA_VERSION VERSION_LESS "11.0")
|
|
- list (APPEND GMX_CUDA_NVCC_GENCODE_FLAGS "-gencode;arch=compute_30,code=sm_30")
|
|
- endif()
|
|
- list (APPEND GMX_CUDA_NVCC_GENCODE_FLAGS "-gencode;arch=compute_35,code=sm_35")
|
|
- list (APPEND GMX_CUDA_NVCC_GENCODE_FLAGS "-gencode;arch=compute_37,code=sm_37")
|
|
- list (APPEND GMX_CUDA_NVCC_GENCODE_FLAGS "-gencode;arch=compute_50,code=sm_50")
|
|
- list (APPEND GMX_CUDA_NVCC_GENCODE_FLAGS "-gencode;arch=compute_52,code=sm_52")
|
|
- list (APPEND GMX_CUDA_NVCC_GENCODE_FLAGS "-gencode;arch=compute_60,code=sm_60")
|
|
- list (APPEND GMX_CUDA_NVCC_GENCODE_FLAGS "-gencode;arch=compute_61,code=sm_61")
|
|
- list (APPEND GMX_CUDA_NVCC_GENCODE_FLAGS "-gencode;arch=compute_70,code=sm_70")
|
|
- if(NOT CUDA_VERSION VERSION_LESS "10.0")
|
|
- list (APPEND GMX_CUDA_NVCC_GENCODE_FLAGS "-gencode;arch=compute_75,code=sm_75")
|
|
- endif()
|
|
- if(NOT CUDA_VERSION VERSION_LESS "11.0")
|
|
- list (APPEND GMX_CUDA_NVCC_GENCODE_FLAGS "-gencode;arch=compute_80,code=sm_80")
|
|
- # Requesting sm or compute 35, 37, or 50 triggers deprecation messages with
|
|
- # nvcc 11.0, which we need to suppress for use in CI
|
|
- list (APPEND GMX_CUDA_NVCC_GENCODE_FLAGS "-Wno-deprecated-gpu-targets")
|
|
- endif()
|
|
- if(NOT CUDA_VERSION VERSION_LESS "11.1")
|
|
- list (APPEND GMX_CUDA_NVCC_GENCODE_FLAGS "-gencode;arch=compute_86,code=sm_86")
|
|
+ gmx_add_nvcc_flag_if_supported(GMX_CUDA_NVCC_GENCODE_FLAGS NVCC_HAS_GENCODE_COMPUTE_AND_SM_35 --generate-code=arch=compute_35,code=sm_35)
|
|
+ gmx_add_nvcc_flag_if_supported(GMX_CUDA_NVCC_GENCODE_FLAGS NVCC_HAS_GENCODE_COMPUTE_AND_SM_37 --generate-code=arch=compute_37,code=sm_37)
|
|
+ gmx_add_nvcc_flag_if_supported(GMX_CUDA_NVCC_GENCODE_FLAGS NVCC_HAS_GENCODE_COMPUTE_AND_SM_50 --generate-code=arch=compute_50,code=sm_50)
|
|
+ gmx_add_nvcc_flag_if_supported(GMX_CUDA_NVCC_GENCODE_FLAGS NVCC_HAS_GENCODE_COMPUTE_AND_SM_52 --generate-code=arch=compute_52,code=sm_52)
|
|
+ gmx_add_nvcc_flag_if_supported(GMX_CUDA_NVCC_GENCODE_FLAGS NVCC_HAS_GENCODE_COMPUTE_AND_SM_60 --generate-code=arch=compute_60,code=sm_60)
|
|
+ gmx_add_nvcc_flag_if_supported(GMX_CUDA_NVCC_GENCODE_FLAGS NVCC_HAS_GENCODE_COMPUTE_AND_SM_61 --generate-code=arch=compute_61,code=sm_61)
|
|
+ gmx_add_nvcc_flag_if_supported(GMX_CUDA_NVCC_GENCODE_FLAGS NVCC_HAS_GENCODE_COMPUTE_AND_SM_70 --generate-code=arch=compute_70,code=sm_70)
|
|
+ gmx_add_nvcc_flag_if_supported(GMX_CUDA_NVCC_GENCODE_FLAGS NVCC_HAS_GENCODE_COMPUTE_AND_SM_75 --generate-code=arch=compute_75,code=sm_75)
|
|
+ gmx_add_nvcc_flag_if_supported(GMX_CUDA_NVCC_GENCODE_FLAGS NVCC_HAS_GENCODE_COMPUTE_AND_SM_80 --generate-code=arch=compute_80,code=sm_80)
|
|
+ # Don't attempt to add newest architectures with old GNU compiler, to avoid issues in CI
|
|
+ # related to being unable to test which flags are supported
|
|
+ if (NOT (CMAKE_CXX_COMPILER_ID MATCHES "GNU" AND CMAKE_CXX_COMPILER_VERSION VERSION_LESS 8))
|
|
+ gmx_add_nvcc_flag_if_supported(GMX_CUDA_NVCC_GENCODE_FLAGS NVCC_HAS_GENCODE_COMPUTE_AND_SM_86 --generate-code=arch=compute_86,code=sm_86)
|
|
+ gmx_add_nvcc_flag_if_supported(GMX_CUDA_NVCC_GENCODE_FLAGS NVCC_HAS_GENCODE_COMPUTE_AND_SM_89 --generate-code=arch=compute_89,code=sm_89)
|
|
+ gmx_add_nvcc_flag_if_supported(GMX_CUDA_NVCC_GENCODE_FLAGS NVCC_HAS_GENCODE_COMPUTE_AND_SM_90 --generate-code=arch=compute_90,code=sm_90)
|
|
endif()
|
|
+ # Requesting sm or compute 35, 37, or 50 triggers deprecation messages with
|
|
+ # nvcc 11.0, which we need to suppress for use in CI
|
|
+ gmx_add_nvcc_flag_if_supported(GMX_CUDA_NVCC_GENCODE_FLAGS NVCC_HAS_WARNING_NO_DEPRECATED_GPU_TARGETS -Wno-deprecated-gpu-targets)
|
|
|
|
# Next add flags that trigger PTX code generation for the
|
|
# newest supported virtual arch that's useful to JIT to future architectures
|
|
# as well as an older one suitable for JIT-ing to any rare intermediate arch
|
|
# (like that of Jetson / Drive PX devices)
|
|
- list (APPEND GMX_CUDA_NVCC_GENCODE_FLAGS "-gencode;arch=compute_35,code=compute_35")
|
|
- if(CUDA_VERSION VERSION_LESS "11.0")
|
|
- list (APPEND GMX_CUDA_NVCC_GENCODE_FLAGS "-gencode;arch=compute_32,code=compute_32")
|
|
- else()
|
|
- list (APPEND GMX_CUDA_NVCC_GENCODE_FLAGS "-gencode;arch=compute_53,code=compute_53")
|
|
- endif()
|
|
- if(NOT CUDA_VERSION VERSION_LESS "11.0")
|
|
- list (APPEND GMX_CUDA_NVCC_GENCODE_FLAGS "-gencode;arch=compute_80,code=compute_80")
|
|
- endif()
|
|
+ gmx_add_nvcc_flag_if_supported(GMX_CUDA_NVCC_GENCODE_FLAGS NVCC_HAS_GENCODE_COMPUTE_53 --generate-code=arch=compute_53,code=sm_53)
|
|
+ gmx_add_nvcc_flag_if_supported(GMX_CUDA_NVCC_GENCODE_FLAGS NVCC_HAS_GENCODE_COMPUTE_80 --generate-code=arch=compute_80,code=sm_80)
|
|
endif()
|
|
|
|
if (GMX_CUDA_TARGET_SM)
|
|
@@ -158,27 +247,20 @@
|
|
# FindCUDA.cmake is unaware of the mechanism used by cmake to embed
|
|
# the compiler flag for the required C++ standard in the generated
|
|
# build files, so we have to pass it ourselves
|
|
-if (CUDA_VERSION VERSION_LESS 11.0)
|
|
- # CUDA doesn't formally support C++17 until version 11.0, so for
|
|
- # now host-side code that compiles with CUDA is restricted to
|
|
- # C++14. This needs to be expressed formally for older CUDA
|
|
- # version.
|
|
+
|
|
+# gcc-7 pre-dated C++17, so uses the -std=c++1z compiler flag for it,
|
|
+# which modern nvcc does not recognize. So we work around that by
|
|
+# compiling in C++14 mode. Clang doesn't have this problem because nvcc
|
|
+# only supports version of clang that already understood -std=c++17
|
|
+if (CMAKE_CXX_COMPILER_ID MATCHES "GNU" AND CMAKE_CXX_COMPILER_VERSION VERSION_LESS 8)
|
|
list(APPEND GMX_CUDA_NVCC_FLAGS "${CMAKE_CXX14_STANDARD_COMPILE_OPTION}")
|
|
else()
|
|
- # gcc-7 pre-dated C++17, so uses the -std=c++1z compiler flag for it,
|
|
- # which modern nvcc does not recognize. So we work around that by
|
|
- # compiling in C++14 mode. Clang doesn't have this problem because nvcc
|
|
- # only supports version of clang that already understood -std=c++17
|
|
- if (CMAKE_CXX_COMPILER_ID MATCHES "GNU" AND CMAKE_CXX_COMPILER_VERSION VERSION_LESS 8)
|
|
- list(APPEND GMX_CUDA_NVCC_FLAGS "${CMAKE_CXX14_STANDARD_COMPILE_OPTION}")
|
|
- else()
|
|
- list(APPEND GMX_CUDA_NVCC_FLAGS "${CMAKE_CXX17_STANDARD_COMPILE_OPTION}")
|
|
- endif()
|
|
+ list(APPEND GMX_CUDA_NVCC_FLAGS "${CMAKE_CXX17_STANDARD_COMPILE_OPTION}")
|
|
endif()
|
|
|
|
# assemble the CUDA flags
|
|
list(APPEND GMX_CUDA_NVCC_FLAGS "${GMX_CUDA_NVCC_GENCODE_FLAGS}")
|
|
-list(APPEND GMX_CUDA_NVCC_FLAGS "-use_fast_math")
|
|
+gmx_add_nvcc_flag_if_supported(GMX_CUDA_NVCC_FLAGS NVCC_HAS_USE_FAST_MATH -use_fast_math)
|
|
|
|
# assemble the CUDA host compiler flags
|
|
list(APPEND GMX_CUDA_NVCC_FLAGS "${CUDA_HOST_COMPILER_OPTIONS}")
|
|
@@ -187,12 +269,18 @@
|
|
# CUDA header cuda_runtime_api.h in at least CUDA 10.1 uses 0
|
|
# where nullptr would be preferable. GROMACS can't fix these, so
|
|
# must suppress them.
|
|
- GMX_TEST_CXXFLAG(CXXFLAGS_NO_ZERO_AS_NULL_POINTER_CONSTANT "-Wno-zero-as-null-pointer-constant" NVCC_CLANG_SUPPRESSIONS_CXXFLAGS)
|
|
+ GMX_TEST_CXXFLAG(HAS_WARNING_NO_ZERO_AS_NULL_POINTER_CONSTANT "-Wno-zero-as-null-pointer-constant" NVCC_CLANG_SUPPRESSIONS_CXXFLAGS)
|
|
|
|
# CUDA header crt/math_functions.h in at least CUDA 10.x and 11.1
|
|
# used throw() specifications that are deprecated in more recent
|
|
# C++ versions. GROMACS can't fix these, so must suppress them.
|
|
- GMX_TEST_CXXFLAG(CXXFLAGS_NO_DEPRECATED_DYNAMIC_EXCEPTION_SPEC "-Wno-deprecated-dynamic-exception-spec" NVCC_CLANG_SUPPRESSIONS_CXXFLAGS)
|
|
+ GMX_TEST_CXXFLAG(HAS_WARNING_NO_DEPRECATED_DYNAMIC_EXCEPTION_SPEC "-Wno-deprecated-dynamic-exception-spec" NVCC_CLANG_SUPPRESSIONS_CXXFLAGS)
|
|
+
|
|
+ # CUDA headers cuda_runtime.h and channel_descriptor.h in at least
|
|
+ # CUDA 11.0 uses many C-style casts, which are ncessary for this
|
|
+ # header to work for C. GROMACS can't fix these, so must suppress
|
|
+ # the warnings they generate
|
|
+ GMX_TEST_CXXFLAG(HAS_WARNING_NO_OLD_STYLE_CAST "-Wno-old-style-cast" NVCC_CLANG_SUPPRESSIONS_CXXFLAGS)
|
|
|
|
# Add these flags to those used for the host compiler. The
|
|
# "-Xcompiler" prefix directs nvcc to only use them for host
|
|
@@ -205,37 +293,6 @@
|
|
string(TOUPPER "${CMAKE_BUILD_TYPE}" _build_type)
|
|
gmx_check_if_changed(_cuda_nvcc_executable_or_flags_changed CUDA_NVCC_EXECUTABLE CUDA_NVCC_FLAGS CUDA_NVCC_FLAGS_${_build_type})
|
|
|
|
-# We would like to be helpful and reject the host compiler with a
|
|
-# clear error message at configure time, rather than let nvcc
|
|
-# later reject the host compiler as not supported when the first
|
|
-# CUDA source file is built. We've implemented that for current
|
|
-# nvcc running on Unix-like systems, but e.g. changes to nvcc
|
|
-# will further affect the limited portability of this checking
|
|
-# code. Set the CMake variable GMX_NVCC_WORKS on if you want to
|
|
-# bypass this check.
|
|
-if((_cuda_nvcc_executable_or_flags_changed OR CUDA_HOST_COMPILER_CHANGED OR NOT GMX_NVCC_WORKS) AND NOT WIN32)
|
|
- message(STATUS "Check for working NVCC/C++ compiler combination with nvcc '${CUDA_NVCC_EXECUTABLE}'")
|
|
- execute_process(COMMAND ${CUDA_NVCC_EXECUTABLE} -ccbin ${CUDA_HOST_COMPILER} -c ${CUDA_NVCC_FLAGS} ${CUDA_NVCC_FLAGS_${_build_type}} ${CMAKE_SOURCE_DIR}/cmake/TestCUDA.cu
|
|
- RESULT_VARIABLE _cuda_test_res
|
|
- OUTPUT_VARIABLE _cuda_test_out
|
|
- ERROR_VARIABLE _cuda_test_err
|
|
- OUTPUT_STRIP_TRAILING_WHITESPACE)
|
|
-
|
|
- if(${_cuda_test_res})
|
|
- message(STATUS "Check for working NVCC/C compiler combination - broken")
|
|
- message(STATUS "${CUDA_NVCC_EXECUTABLE} standard output: '${_cuda_test_out}'")
|
|
- message(STATUS "${CUDA_NVCC_EXECUTABLE} standard error: '${_cuda_test_err}'")
|
|
- if(${_cuda_test_err} MATCHES "nsupported")
|
|
- message(FATAL_ERROR "NVCC/C++ compiler combination does not seem to be supported. CUDA frequently does not support the latest versions of the host compiler, so you might want to try an earlier C++ compiler version and make sure your CUDA compiler and driver are as recent as possible.")
|
|
- else()
|
|
- message(FATAL_ERROR "CUDA compiler does not seem to be functional.")
|
|
- endif()
|
|
- elseif(NOT GMX_CUDA_TEST_COMPILER_QUIETLY)
|
|
- message(STATUS "Check for working NVCC/C++ compiler combination - works")
|
|
- set(GMX_NVCC_WORKS TRUE CACHE INTERNAL "Nvcc can compile a trivial test program")
|
|
- endif()
|
|
-endif() # GMX_CHECK_NVCC
|
|
-
|
|
|
|
# The flags are set as local variables which shadow the cache variables. The cache variables
|
|
# (can be set by the user) are appended. This is done in a macro to set the flags when all
|