#
# 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.
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
# 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()