Skip to content

Commit

Permalink
Merge pull request #4389 from ye-luo/update-cmake-intel
Browse files Browse the repository at this point in the history
Update intel classic compiler version minimum to 2021.1
  • Loading branch information
ye-luo authored Jan 10, 2023
2 parents 2dbc640 + d7ca12e commit 988dc08
Show file tree
Hide file tree
Showing 6 changed files with 21 additions and 16 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ Notable changes to QMCPACK are documented in this file.

## [Unreleased]

* Minimum supported Intel classic compiler version is 2021.1. [\#4389](https://github.com/QMCPACK/qmcpack/pull/4389)

# Known problems

* When offload builds are compiled with CUDA toolkit versions above 11.2 (tested
Expand Down
12 changes: 5 additions & 7 deletions CMake/IntelCompilers.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -7,17 +7,15 @@ if(CMAKE_CXX_COMPILER_ID MATCHES "IntelLLVM")
if(CMAKE_CXX_COMPILER_VERSION VERSION_LESS 2021.3)
message(FATAL_ERROR "Requires Intel oneAPI 2021.3 or higher!")
endif()
elseif(INTEL_ONEAPI_COMPILER_FOUND)
# in this case, the version string reported based on Clang, not accurate enough. just skip check.
else()
if(CMAKE_CXX_COMPILER_VERSION VERSION_LESS 19.1.2)
message(FATAL_ERROR "Requires Intel classic compiler 19.1.2 or higher!")
if(CMAKE_CXX_COMPILER_VERSION VERSION_LESS 2021.1)
message(FATAL_ERROR "Requires Intel classic compiler 2021.1 or higher!")
endif()
endif()

# Enable OpenMP
if(QMC_OMP)
if(CMAKE_CXX_COMPILER_ID MATCHES "IntelLLVM" OR INTEL_ONEAPI_COMPILER_FOUND)
if(CMAKE_CXX_COMPILER_ID MATCHES "IntelLLVM")
if(ENABLE_OFFLOAD)
set(OFFLOAD_TARGET
"spir64"
Expand All @@ -35,7 +33,7 @@ if(QMC_OMP)
endif()
endif(QMC_OMP)

if(CMAKE_CXX_COMPILER_ID MATCHES "IntelLLVM" OR INTEL_ONEAPI_COMPILER_FOUND)
if(CMAKE_CXX_COMPILER_ID MATCHES "IntelLLVM")
# oneAPI compiler options

# Set clang specific flags (which we always want)
Expand Down Expand Up @@ -84,7 +82,7 @@ endif()
if(NOT CMAKE_SYSTEM_NAME STREQUAL "CrayLinuxEnvironment")

# use -x for classic compiler only. this option is not robust with oneAPI compiler as 2021.3 release
if(NOT CMAKE_CXX_COMPILER_ID MATCHES "IntelLLVM" AND NOT INTEL_ONEAPI_COMPILER_FOUND)
if(NOT CMAKE_CXX_COMPILER_ID MATCHES "IntelLLVM")
set(X_OPTION "^-x| -x")
set(AX_OPTION "^-ax| -ax")
#check if the user has already specified -x option for cross-compiling.
Expand Down
8 changes: 8 additions & 0 deletions CMake/Testlibstdc++.cmake
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
# Test that if a C++ compiler is compatiable with the libstdc++ in use

# Test "#include <cstdio>" before version compatibility checks.
include(CheckIncludeFileCXX)
check_include_file_cxx(cstdio INCLUDE_CSTDIO_WORKS)
if(NOT INCLUDE_CSTDIO_WORKS)
unset(INCLUDE_CSTDIO_WORKS CACHE)
message(FATAL_ERROR "`#include <cstdio>` test failed! Please provide a working C++ compiler.")
endif()

try_compile(
LIBSTDCXX_OKAY
${CMAKE_BINARY_DIR}
Expand Down
5 changes: 3 additions & 2 deletions CMake/inspectCompiler.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,16 @@ if(VERSION_QUERY_RETURN EQUAL 0)
if(CMAKE_VERSION VERSION_LESS 3.20
AND VERSION_QUERY_OUTPUT MATCHES "Intel"
AND VERSION_QUERY_OUTPUT MATCHES "oneAPI")
set(INTEL_ONEAPI_COMPILER_FOUND TRUE)
# require 3.20 to recognize IntelLLVM compiler ID and check accurate version numbers.
message(FATAL_ERROR "Using Intel OneAPI compilers requires CMake 3.20.0 or later.")
endif()
endif()

if(CMAKE_CXX_COMPILER_ID MATCHES "GNU")
set(COMPILER GNU)
elseif(CMAKE_CXX_COMPILER_ID MATCHES "XL")
set(COMPILER IBM)
elseif(CMAKE_CXX_COMPILER_ID MATCHES "Intel" OR INTEL_ONEAPI_COMPILER_FOUND)
elseif(CMAKE_CXX_COMPILER_ID MATCHES "Intel")
set(COMPILER Intel)
elseif(CMAKE_CXX_COMPILER_ID MATCHES "PGI" OR CMAKE_CXX_COMPILER_ID MATCHES "NVHPC")
set(COMPILER NVHPC)
Expand Down
4 changes: 2 additions & 2 deletions CMake/try_compile_sources/check_libstdcxx.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@

int main(int argc, char **argv)
{
#if ( ( __INTEL_COMPILER == 1910 ) && ( _GLIBCXX_RELEASE < 9 || _GLIBCXX_RELEASE > 9 ) )
#error You are using the Intel compiler v19.1 ("20") which obtains libstdc++ from a GCC installation. Due to incompatibilities, you must use a GCC version 9 with this Intel compiler version. Check with 'icpc -v'.
#if ( defined(_GLIBCXX_RELEASE) && ( _GLIBCXX_RELEASE < 9 ) )
#error Detected libstdc++. libstdc++ from a GCC version lower than 9 is not supported.
#endif
return 0;
}
6 changes: 1 addition & 5 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -867,12 +867,8 @@ endif(ENABLE_HIP)
# set up SYCL compiler options and libraries
#-------------------------------------------------------------------
if(ENABLE_SYCL)
# require 3.20 to recognize IntelLLVM compiler ID and check accurate version numbers.
if(CMAKE_VERSION VERSION_LESS 3.20.0)
message(FATAL_ERROR "ENABLE_SYCL require CMake 3.20.0 or later")
endif()
if(NOT "x${CMAKE_CXX_COMPILER_ID}" STREQUAL "xIntelLLVM")
message(FATAL_ERROR "QMCPACK only supports SYCL with LLVM-based Intel compiler (icpx).")
message(FATAL_ERROR "QMCPACK only supports SYCL with LLVM-based Intel oneAPI compiler (icpx).")
endif()
if(CMAKE_CXX_COMPILER_VERSION VERSION_LESS 2023.0)
message(FATAL_ERROR "Requires Intel oneAPI 2023.0 or higher!")
Expand Down

0 comments on commit 988dc08

Please sign in to comment.