Remove CUDA host compiler consistency checks
authorSzilárd Páll <pall.szilard@gmail.com>
Sun, 3 Apr 2016 22:30:06 +0000 (00:30 +0200)
committerTeemu Murtola <teemu.murtola@gmail.com>
Thu, 5 May 2016 02:46:50 +0000 (04:46 +0200)
Since CMake 2.8.10 the host compiler is set by CMake which effectively
broke our consistency checks. However, these checks are hard to
maintain, and even though CMake does not do any checks we are better off
without this code.

This commit removed the checks, unconditionally sets the
CUDA_HOST_COMPILER variable for CMake 2.8.9 and earlier - code that
should be removed when CMAke 2.8.10 is required.

Fixes #1248

Change-Id: I6c08b59642dd3b5d18c5fe5ac454f19c75718f6a

cmake/gmxManageNvccConfig.cmake

index a6184d35c5569ed04198af7e45d162546b4e5078..a0281a99181cb1beeaad8e0b7ed973c3ce93a588 100644 (file)
@@ -1,7 +1,7 @@
 #
 # This file is part of the GROMACS molecular simulation package.
 #
-# Copyright (c) 2012,2013,2014,215, by the GROMACS development team, led by
+# Copyright (c) 2012,2013,2014,2015,2016, 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.
@@ -51,8 +51,7 @@ if (CUDA_HOST_COMPILER_CHANGED AND CUDA_HOST_COMPILER_AUTOSET)
     unset(CUDA_HOST_COMPILER_AUTOSET CACHE)
 endif()
 
-# Explicitly set the host compiler for nvcc if the current compiler is
-# supported and it's not an MPI compiler wrapper, otherwise warn the user.
+# Set the host compiler for nvcc if this is not set by CMake (v<=2.8.9)
 #
 # Note that even though nvcc compiles host code as C++, we use the
 # CMAKE_C_COMPILER as host compiler. We do this because CUDA versions
@@ -62,48 +61,17 @@ endif()
 # Also note that with MSVC nvcc sets the -compiler-bindir option behind the
 # scenes; to avoid conflicts we don't set -ccbin automatically.
 #
-# This will be executed only with cmake <v2.8.10 as later versions set the
-# host compiler in FindCUDA.
+# TODO: remove this when CMAke >=v2.8.10 is required.
 if (NOT DEFINED CUDA_HOST_COMPILER AND NOT MSVC)
-    if (NOT CMAKE_COMPILER_IS_GNUCC AND
-        NOT (CMAKE_C_COMPILER_ID MATCHES "Intel" AND UNIX AND NOT APPLE))
-        message(WARNING "
-        Will not set the nvcc host compiler because the current C compiler is not
-        compatible with nvcc:
-        ${CMAKE_C_COMPILER} (ID: ${CMAKE_C_COMPILER_ID})
-        Compatible compilers are: gcc on Linux and Mac OS X, the Intel Compiler on 64-bit
-        Linux and MSVC on Windows. Note that with newer CUDA releases this might change,
-        for up-to-date compatibility information check the NVIDIA documentation.
-        If nothing specified, nvcc will automatically pick the platform-default compiler;
-        Note that mixing compilers can cause errors.
-        To manually set the nvcc host compiler, edit CUDA_NVCC_FLAGS or re-configure
-        setting CUDA_HOST_COMPILER to the full path of a compatible compiler.
-        ")
-    else()
-        # do not use MPI compiler wrappers, as these are prone to brake nvcc
-        if (GMX_MPI AND NOT "${MPI_C_FOUND}") # FindMPI-based detection
-            message(WARNING "
-        Will not set the nvcc host compiler because the current C compiler is an MPI
-        compiler wrapper: ${CMAKE_C_COMPILER}
-        MPI compiler wrappers are prone to not work with nvcc. You might get lucky,
-        but the safest is to use the C compiler that the MPI compiler wrapper uses
-        (if this is compatible).
-        To manually set the nvcc host compiler, edit CUDA_NVCC_FLAGS or re-configure
-        setting CUDA_HOST_COMPILER to the full path of a compatible compiler.
-        ")
-        else()
-            set(CUDA_HOST_COMPILER "${CMAKE_C_COMPILER}")
-            set(CUDA_HOST_COMPILER_AUTOSET TRUE CACHE INTERNAL
-                "True if CUDA_HOST_COMPILER is automatically set")
-        endif()
-    endif()
+    set(CUDA_HOST_COMPILER "${CMAKE_C_COMPILER}")
+    set(CUDA_HOST_COMPILER_AUTOSET TRUE CACHE INTERNAL
+        "True if CUDA_HOST_COMPILER is automatically set")
 endif()
 
 # set up host compiler and its options
 if(CUDA_HOST_COMPILER_CHANGED)
     # FindCUDA in CMake 2.8.10 sets the host compiler internally
     if (CMAKE_VERSION VERSION_LESS "2.8.10")
-        message(STATUS "Setting the nvcc host compiler to: ${CUDA_HOST_COMPILER}")
         set(CUDA_HOST_COMPILER ${CUDA_HOST_COMPILER}
             CACHE PATH "Host compiler for nvcc")
     endif()