From 2961ba7ebb0d27accaf9b33957597e592bb56f9e Mon Sep 17 00:00:00 2001 From: Christoph Junghans Date: Wed, 19 Jul 2017 10:35:48 -0600 Subject: [PATCH] added MKL support --- cmake/CMakeLists.txt | 9 ++++++++- cmake/Modules/FindMKL.cmake | 22 ++++++++++++++++++++++ 2 files changed, 30 insertions(+), 1 deletion(-) create mode 100644 cmake/Modules/FindMKL.cmake diff --git a/cmake/CMakeLists.txt b/cmake/CMakeLists.txt index 5764700ebd..9d8b93e12d 100644 --- a/cmake/CMakeLists.txt +++ b/cmake/CMakeLists.txt @@ -117,14 +117,21 @@ endif() if(ENABLE_KSPACE) find_package(FFTW3) + find_package(MKL) if(FFTW3_FOUND) add_definitions(-DFFT_FFTW3) include_directories(${FFTW3_INCLUDE_DIRS}) list(APPEND LAMMPS_LINK_LIBS ${FFTW3_LIBRARIES}) + elseif(MKL_FOUND) + add_definitions(-DFFT_MKL) + include_directories(${MKL_INCLUDE_DIRS}) + list(APPEND LAMMPS_LINK_LIBS ${MKL_LIBRARIES}) endif() set(PACK_OPTIMIZATION "PACK_ARRAY" CACHE STRING "Optimization for FFT") set_property(CACHE LAMMPS_SIZE_LIMIT PROPERTY STRINGS PACK_ARRAY PACK_POINTER PACK_MEMCPY) - add_definitions(-D${PACK_OPTIMIZATION}) + if(NOT PACK_OPTIMIZATION STREQUAL "PACK_ARRAY") + add_definitions(-D${PACK_OPTIMIZATION}) + endif() endif() if(ENABLE_MISC) diff --git a/cmake/Modules/FindMKL.cmake b/cmake/Modules/FindMKL.cmake new file mode 100644 index 0000000000..4246062103 --- /dev/null +++ b/cmake/Modules/FindMKL.cmake @@ -0,0 +1,22 @@ +# - Find mkl +# Find the native MKL headers and libraries. +# +# MKL_INCLUDE_DIRS - where to find mkl.h, etc. +# MKL_LIBRARIES - List of libraries when using mkl. +# MKL_FOUND - True if mkl found. +# + +find_path(MKL_INCLUDE_DIR mkl_dfti.h HINTS $ENV{MKLROOT}/include) + +find_library(MKL_LIBRARY NAMES mkl_rt HINTS $ENV{MKLROOT}/lib $ENV{MKLROOT}/lib/intel64) + +set(MKL_LIBRARIES ${MKL_LIBRARY}) +set(MKL_INCLUDE_DIRS ${MKL_INCLUDE_DIR}) + +include(FindPackageHandleStandardArgs) +# handle the QUIETLY and REQUIRED arguments and set MKL_FOUND to TRUE +# if all listed variables are TRUE + +find_package_handle_standard_args(MKL DEFAULT_MSG MKL_LIBRARY MKL_INCLUDE_DIR) + +mark_as_advanced(MKL_INCLUDE_DIR MKL_LIBRARY )