forked from lijiext/lammps
Merge pull request #910 from junghans/cmake_intel
USER-INTEL: enforce icc and add icc flags
This commit is contained in:
commit
3f316f71ef
cmake
|
@ -56,6 +56,9 @@ option(BUILD_SHARED_LIBS "Build shared libs" OFF)
|
|||
if(BUILD_SHARED_LIBS) # for all pkg libs, mpi_stubs and linalg
|
||||
set(CMAKE_POSITION_INDEPENDENT_CODE ON)
|
||||
endif()
|
||||
option(DEVELOPER_MODE "Enable developer mode" OFF)
|
||||
mark_as_advanced(DEVELOPER_MODE)
|
||||
option(CMAKE_VERBOSE_MAKEFILE "Generate verbose Makefiles" OFF)
|
||||
include(GNUInstallDirs)
|
||||
|
||||
set(LAMMPS_LINK_LIBS)
|
||||
|
@ -182,7 +185,7 @@ if(PKG_KSPACE)
|
|||
if(NOT FFT STREQUAL "KISSFFT")
|
||||
find_package(${FFT} REQUIRED)
|
||||
if(NOT FFT STREQUAL "FFTW3F")
|
||||
add_definitions(-DFFT_FFTW)
|
||||
add_definitions(-DFFT_FFTW)
|
||||
else()
|
||||
add_definitions(-DFFT_${FFT})
|
||||
endif()
|
||||
|
@ -603,6 +606,29 @@ if(PKG_OPT)
|
|||
endif()
|
||||
|
||||
if(PKG_USER-INTEL)
|
||||
if(NOT DEVELOPER_MODE)
|
||||
if(NOT CMAKE_CXX_COMPILER_ID STREQUAL "Intel")
|
||||
message(FATAL_ERROR "USER-INTEL is only useful together with intel compiler")
|
||||
endif()
|
||||
if(CMAKE_CXX_COMPILER_VERSION VERSION_LESS 16)
|
||||
message(FATAL_ERROR "USER-INTEL is needed at least 2016 intel compiler, found ${CMAKE_CXX_COMPILER_VERSION}")
|
||||
endif()
|
||||
endif()
|
||||
option(INJECT_INTEL_FLAG "Inject OMG fast flags for USER-INTEL" ON)
|
||||
if(INJECT_INTEL_FLAG AND CMAKE_CXX_COMPILER_ID STREQUAL "Intel")
|
||||
if(CMAKE_CXX_COMPILER_VERSION VERSION_EQUAL 17.3 OR CMAKE_CXX_COMPILER_VERSION VERSION_EQUAL 17.4)
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -xCOMMON-AVX512")
|
||||
else()
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -xHost")
|
||||
endif()
|
||||
include(CheckCXXCompilerFlag)
|
||||
foreach(_FLAG -qopenmp -qno-offload -fno-alias -ansi-alias -restrict -DLMP_INTEL_USELRT -DLMP_USE_MKL_RNG -O2 "-fp-model fast=2" -no-prec-div -qoverride-limits -qopt-zmm-usage=high)
|
||||
check_cxx_compiler_flag("${__FLAG}" COMPILER_SUPPORTS${_FLAG})
|
||||
if(COMPILER_SUPPORTS${_FLAG})
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${_FLAG}")
|
||||
endif()
|
||||
endforeach()
|
||||
endif()
|
||||
set(USER-INTEL_SOURCES_DIR ${LAMMPS_SOURCE_DIR}/USER-INTEL)
|
||||
set(USER-INTEL_SOURCES ${USER-INTEL_SOURCES_DIR}/intel_preprocess.h
|
||||
${USER-INTEL_SOURCES_DIR}/intel_buffers.h
|
||||
|
@ -844,5 +870,5 @@ if(ENABLED_GPU)
|
|||
endif()
|
||||
endif()
|
||||
if(PKG_KSPACE)
|
||||
message(STATUS "Using ${FFT} as FFT")
|
||||
message(STATUS "Using ${FFT} as FFT")
|
||||
endif()
|
||||
|
|
Loading…
Reference in New Issue