From: Roland Schulz Date: Sun, 11 Apr 2021 01:15:33 +0000 (+0000) Subject: Fix compile with Intel oneAPI 2021.2 X-Git-Url: http://biod.pnpi.spb.ru/gitweb/?a=commitdiff_plain;h=a579a4c6891a0f14cab3af07e6be98afad84d86e;p=alexxy%2Fgromacs.git Fix compile with Intel oneAPI 2021.2 --- diff --git a/CMakeLists.txt b/CMakeLists.txt index e4b6ffd4fb..32a6621dfd 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -298,6 +298,7 @@ include(gmxManageOpenMP) # These need to be done early (before further tests). ##################################################################### +include(gmxTestIntelLLVM) include(gmxCFlags) gmx_c_flags() diff --git a/cmake/TestIntelLLVM.cpp b/cmake/TestIntelLLVM.cpp new file mode 100644 index 0000000000..637bf46539 --- /dev/null +++ b/cmake/TestIntelLLVM.cpp @@ -0,0 +1,7 @@ +#ifndef __INTEL_LLVM_COMPILER +#error +#endif +#define VALUE_TO_STRING(x) #x +#define VALUE(x) VALUE_TO_STRING(x) +#pragma message(VALUE(__INTEL_LLVM_COMPILER)) +int main() {} diff --git a/cmake/gmxCFlags.cmake b/cmake/gmxCFlags.cmake index 287c56bbdd..97d095eec6 100644 --- a/cmake/gmxCFlags.cmake +++ b/cmake/gmxCFlags.cmake @@ -3,7 +3,7 @@ # # Copyright (c) 2009,2010,2011,2012,2013 by the GROMACS development team. # Copyright (c) 2014,2015,2016,2017,2018 by the GROMACS development team. -# Copyright (c) 2019,2020, by the GROMACS development team, led by +# Copyright (c) 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. @@ -444,6 +444,10 @@ GMX_TEST_CFLAG(CFLAGS_WARN "/W3;/wd161;/wd177;/wd411;/wd593;/wd981;/wd1418;/wd14 GMX_TEST_CXXFLAG(CXXFLAGS_PRAGMA "-Wno-unknown-pragmas" GMXC_CXXFLAGS) endif() GMX_TEST_CXXFLAG(CXXFLAGS_WARN_NO_MISSING_FIELD_INITIALIZERS "-Wno-missing-field-initializers" GMXC_CXXFLAGS) + # Intel LLVM 2021.2 defaults to no-finite-math which isn't OK for GROMACS + if(GMX_INTEL_LLVM AND GMX_INTEL_LLVM_VERSION GREATER_EQUAL 2021020) + GMX_TEST_CXXFLAG(CXXFLAGS_FINITE_MATH "-fno-finite-math-only" GMXC_CXXFLAGS) + endif() endif() # Apple bastardized version of Clang diff --git a/cmake/gmxManageFFTLibraries.cmake b/cmake/gmxManageFFTLibraries.cmake index f59e011ecc..bc310470b1 100644 --- a/cmake/gmxManageFFTLibraries.cmake +++ b/cmake/gmxManageFFTLibraries.cmake @@ -2,7 +2,7 @@ # 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, by the GROMACS development team, led by +# 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. @@ -33,8 +33,6 @@ # To help us fund GROMACS development, we humbly ask that you cite # the research papers on the package. Check out http://www.gromacs.org. -include(gmxTestICCNextGen) - # Manage setup of the different FFT libraries we can use in Gromacs. set(PKG_FFT "") set(PKG_FFT_LIBS "") @@ -44,7 +42,7 @@ set(PKG_FFT_LIBS "") set(MKL_MANUALLY FALSE) if (GMX_FFT_LIBRARY STREQUAL "MKL" AND NOT ((CMAKE_C_COMPILER_ID MATCHES "Intel" AND CMAKE_C_COMPILER_VERSION VERSION_GREATER "11") - OR GMX_ICC_NEXTGEN)) + OR GMX_INTEL_LLVM)) # The user will have to provide the set of magic libraries in # MKL_LIBRARIES (see below), which we cache (non-advanced), so that they # don't have to keep specifying it, and can easily see that @@ -138,6 +136,8 @@ elseif(${GMX_FFT_LIBRARY} STREQUAL "MKL") # docs, but on Jenkins Win2k8, icl tries to interpret it # as a file. Shrug. set(FFT_LINKER_FLAGS "/Qmkl:sequential") + elseif(GMX_INTEL_LLVM AND GMX_INTEL_LLVM_VERSION GREATER_EQUAL 2021020) + set(FFT_LINKER_FLAGS "-qmkl=sequential") else() set(FFT_LINKER_FLAGS "-mkl=sequential") endif() diff --git a/cmake/gmxTestICCNextGen.cmake b/cmake/gmxTestIntelLLVM.cmake similarity index 70% rename from cmake/gmxTestICCNextGen.cmake rename to cmake/gmxTestIntelLLVM.cmake index 06af4aee3c..75d499181d 100644 --- a/cmake/gmxTestICCNextGen.cmake +++ b/cmake/gmxTestIntelLLVM.cmake @@ -1,7 +1,7 @@ # # This file is part of the GROMACS molecular simulation package. # -# Copyright (c) 2020, by the GROMACS development team, led by +# Copyright (c) 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. @@ -32,10 +32,15 @@ # To help us fund GROMACS development, we humbly ask that you cite # the research papers on the package. Check out http://www.gromacs.org. -# CMake detects ICC NextGen (based on LLVM) as Clang -if (CMAKE_CXX_COMPILER_ID MATCHES "Clang") - include(CheckCXXSourceCompiles) - check_cxx_source_compiles( - "int main() { return __INTEL_LLVM_COMPILER; }" - GMX_ICC_NEXTGEN) +# CMake detects Intel compiler (based on LLVM) as Clang +# Was fixed in Cmake 3.20. When we require 3.20 this can be deleted. +if (CMAKE_CXX_COMPILER_ID MATCHES "Clang" OR CMAKE_CXX_COMPILER_ID MATCHES "IntelLLVM") + try_compile(GMX_INTEL_LLVM "${CMAKE_BINARY_DIR}" SOURCES "${CMAKE_SOURCE_DIR}/cmake/TestIntelLLVM.cpp" OUTPUT_VARIABLE GMX_INTEL_LLVM_VERSION) + if (GMX_INTEL_LLVM) + if(GMX_INTEL_LLVM_VERSION MATCHES ": ([0-9]+) ") + set(GMX_INTEL_LLVM_VERSION ${CMAKE_MATCH_1}) + else() + message(WARNING "Intel LLVM version detection failed. Output: ${GMX_INTEL_LLVM_VERSION}") + endif() + endif() endif() diff --git a/docs/release-notes/2021/2021.2.rst b/docs/release-notes/2021/2021.2.rst index 1cdba12e3a..bd97fdbaa8 100644 --- a/docs/release-notes/2021/2021.2.rst +++ b/docs/release-notes/2021/2021.2.rst @@ -38,6 +38,11 @@ code incorrectly tried to construct a string from nullptr. Fixes that affect portability ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +Support for Intel oneAPI compiler 2021.2 +""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" + +Fixed compiler infinity math and MKL flags. + Miscellaneous ^^^^^^^^^^^^^