Commits (28)
......@@ -11,5 +11,5 @@ Find:
- cd modules/find/tests
- mkdir -p build
- cd build
- cmake .. -DENABLE_CTEST=ON -DLAPACKE_COMPONENTS="TMG" -DQUARK_COMPONENTS="HWLOC" -DPASTIX_COMPONENTS="PARSEC;STARPU"
- cmake .. -DENABLE_CTEST=ON -DLAPACKE_COMPONENTS="TMG" -DQUARK_COMPONENTS="HWLOC" -DCHAMELEON_COMPONENTS="MPI;FXT;STARPU"
- ctest -V
......@@ -23,18 +23,19 @@ See the file [morse_cmakefind_doc.org](modules/find/morse_cmakefind_doc.org).
Installation
---------------------
We recommend to use this project as a `git submodule` of your project.
# Example if morse_cmake is defined as a git submodule in ./cmake_modules/
git submodule add https://gitlab.inria.fr/solverstack/morse_cmake.git cmake_modules/morse_cmake
To use MORSE modules you have to add the path to the modules in your
CMake project and include the MorseInit module:
# Define where are located module files on your system
set(MORSE_CMAKE_MODULE_PATH "/where/is/morse_cmake" CACHE PATH "Path to morse_cmake sources")
# Append this directory to the list of directories containing CMake modules
list(APPEND CMAKE_MODULE_PATH "${MORSE_CMAKE_MODULE_PATH}/modules/" )
# Example if Morse CMake modules are located in ./cmake_modules/morse_cmake/modules
list(APPEND CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake_modules/morse_cmake/modules" )
# Include the init module
include(MorseInit)
We recommend to use this project as a `git submodule` of your project.
Testing
---------------------
......
###
#
# @copyright (c) 2018 Inria. All rights reserved.
#
###
#
# @file FindPkgconfigLibrariesAbsolutePath.cmake
#
# @project MORSE
# MORSE is a software package provided by:
# Inria Bordeaux - Sud-Ouest,
# Univ. of Tennessee,
# King Abdullah Univesity of Science and Technology
# Univ. of California Berkeley,
# Univ. of Colorado Denver.
#
# @version 1.0.0
# @author Florent Pruvost
# @date 06-04-2018
#
###
# Transform relative path into absolute path for libraries found with the
# pkg_search_module cmake macro
# _prefix: the name of the CMake variable used when pkg_search_module was called
# e.g. for pkg_search_module(BLAS blas) _prefix would be BLAS
macro(FIND_PKGCONFIG_LIBRARIES_ABSOLUTE_PATH _prefix)
if(WIN32)
string(REPLACE ":" ";" _lib_env "$ENV{LIB}")
elseif(APPLE)
string(REPLACE ":" ";" _lib_env "$ENV{DYLD_LIBRARY_PATH}")
else()
string(REPLACE ":" ";" _lib_env "$ENV{LD_LIBRARY_PATH}")
endif()
list(APPEND _lib_env "${CMAKE_PLATFORM_IMPLICIT_LINK_DIRECTORIES}")
list(APPEND _lib_env "${CMAKE_C_IMPLICIT_LINK_DIRECTORIES}")
# non static case
set(${_prefix}_LIBRARIES_COPY "${${_prefix}_LIBRARIES}")
set(${_prefix}_LIBRARIES "")
foreach(_library ${${_prefix}_LIBRARIES_COPY})
if(EXISTS "${_library}")
list(APPEND ${_prefix}_LIBRARIES ${_library})
else()
get_filename_component(_ext "${_library}" EXT)
set(_lib_extensions ".so" ".a" ".dyld" ".dll")
list(FIND _lib_extensions "${_ext}" _index)
if (${_index} GREATER -1)
get_filename_component(_library "${_library}" NAME_WE)
endif()
find_library(_library_path NAMES ${_library}
HINTS ${${_prefix}_LIBDIR} ${${_prefix}_LIBRARY_DIRS} ${_lib_env})
if (_library_path)
list(APPEND ${_prefix}_LIBRARIES ${_library_path})
else()
message(FATAL_ERROR "Dependency of ${_prefix} '${_library}' NOT FOUND")
endif()
unset(_library_path CACHE)
endif()
endforeach()
set (${_prefix}_LIBRARIES "${${_prefix}_LIBRARIES}" CACHE INTERNAL "" FORCE)
# static case
set(${_prefix}_STATIC_LIBRARIES_COPY "${${_prefix}_STATIC_LIBRARIES}")
set(${_prefix}_STATIC_LIBRARIES "")
foreach(_library ${${_prefix}_STATIC_LIBRARIES_COPY})
if(EXISTS "${_library}")
list(APPEND ${_prefix}_STATIC_LIBRARIES ${_library})
else()
get_filename_component(_ext "${_library}" EXT)
set(_lib_extensions ".so" ".a" ".dyld" ".dll")
list(FIND _lib_extensions "${_ext}" _index)
if (${_index} GREATER -1)
get_filename_component(_library "${_library}" NAME_WE)
endif()
# try static first
set (default_find_library_suffixes ${CMAKE_FIND_LIBRARY_SUFFIXES})
set (CMAKE_FIND_LIBRARY_SUFFIXES ${CMAKE_STATIC_LIBRARY_SUFFIX})
find_library(_library_path NAMES ${_library}
HINTS ${${_prefix}_STATIC_LIBDIR} ${${_prefix}_STATIC_LIBRARY_DIRS} ${_lib_env})
set (CMAKE_FIND_LIBRARY_SUFFIXES ${default_find_library_suffixes})
# if not found try dynamic
if (NOT _library_path)
find_library(_library_path NAMES ${_library}
HINTS ${${_prefix}_STATIC_LIBDIR} ${${_prefix}_STATIC_LIBRARY_DIRS} ${_lib_env})
endif()
if (_library_path)
list(APPEND ${_prefix}_STATIC_LIBRARIES ${_library_path})
else()
message(FATAL_ERROR "Dependency of ${_prefix} '${_library}' NOT FOUND")
endif()
unset(_library_path CACHE)
endif()
endforeach()
set (${_prefix}_STATIC_LIBRARIES "${${_prefix}_STATIC_LIBRARIES}" CACHE INTERNAL "" FORCE)
endmacro()
##
## @end file FindPkgconfigLibrariesAbsolutePath.cmake
##
###
#
# @copyright (c) 2018 Inria. All rights reserved.
#
###
#
# @file LibrariesAbsolutePath.cmake
#
# @project MORSE
# MORSE is a software package provided by:
# Inria Bordeaux - Sud-Ouest,
# Univ. of Tennessee,
# King Abdullah Univesity of Science and Technology
# Univ. of California Berkeley,
# Univ. of Colorado Denver.
#
# @version 1.0.0
# @author Florent Pruvost
# @date 13-04-2018
#
###
# Transform relative path into absolute path for libraries
# lib_list (input/output): the name of the CMake variable containing libraries, e.g. BLAS_LIBRARIES
# hints_paths (input): additional paths to add when looking for libraries
macro(LIBRARIES_ABSOLUTE_PATH lib_list hints_paths)
# collect environment paths to dig
if(WIN32)
string(REPLACE ":" ";" _lib_env "$ENV{LIB}")
elseif(APPLE)
string(REPLACE ":" ";" _lib_env "$ENV{DYLD_LIBRARY_PATH}")
else()
string(REPLACE ":" ";" _lib_env "$ENV{LD_LIBRARY_PATH}")
endif()
list(APPEND _lib_env "${CMAKE_PLATFORM_IMPLICIT_LINK_DIRECTORIES}")
list(APPEND _lib_env "${CMAKE_C_IMPLICIT_LINK_DIRECTORIES}")
# copy the lib list
set (${lib_list}_COPY "${${lib_list}}")
# reset the lib list to populate
set(${lib_list} "")
foreach(_library ${${lib_list}_COPY})
if(EXISTS "${_library}")
# if already an absolute path, nothing special to do
list(APPEND ${lib_list} ${_library})
else()
# replace pattern -lfoo -> foo
string(REGEX REPLACE "^-l" "" _library "${_library}")
# remove extensions if exist
get_filename_component(_ext "${_library}" EXT)
set(_lib_extensions ".so" ".a" ".dyld" ".dll")
list(FIND _lib_extensions "${_ext}" _index)
if (${_index} GREATER -1)
get_filename_component(_library "${_library}" NAME_WE)
endif()
# try to find the lib
find_library(_library_path NAMES ${_library} HINTS ${hints_paths} ${_lib_env})
if (_library_path)
list(APPEND ${lib_list} ${_library_path})
else()
message(FATAL_ERROR "Dependency of ${lib_list} '${_library}' NOT FOUND")
endif()
unset(_library_path CACHE)
endif()
endforeach()
endmacro()
##
## @end file LibrariesAbsolutePath.cmake
##
......@@ -50,6 +50,12 @@ endif()
# To find headers and libs
include(FindHeadersAndLibs)
# To transform relative path from pkg-config into absolute
include(FindPkgconfigLibrariesAbsolutePath)
# To transform relative path into absolute for a list of libraries
include(LibrariesAbsolutePath)
# Some macros to print status when search for headers and libs
# PrintFindStatus.cmake is in cmake_modules/morse/find directory
include(PrintFindStatus)
......
......@@ -233,16 +233,21 @@ MACRO(precisions_rules_py)
# We generate a dependency only if a file will be generated
if( got_file )
set( _compile_flags "-DPRECISION_${_dependency_PREC}" )
set( _listtmp ${PREC_RULE_PRECISIONS})
list(REMOVE_ITEM _listtmp ${_dependency_PREC})
foreach( _prec ${_listtmp})
set( _compile_flags "${_compile_flags} -UPRECISION_${_prec}" )
endforeach()
if( generate_out )
# the custom command is executed in CMAKE_CURRENT_BINARY_DIR
ADD_CUSTOM_COMMAND(
OUTPUT ${_dependency_OUTPUT}
COMMAND ${CMAKE_COMMAND} -E remove -f ${_dependency_OUTPUT} && ${pythoncmd} && chmod a-w ${_dependency_OUTPUT}
DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/${_dependency_INPUT} ${RP_CODEGEN} ${RP_${CMAKE_PROJECT_NAME}_DICTIONNARY})
set_source_files_properties(${_dependency_OUTPUT} PROPERTIES COMPILE_FLAGS "-DPRECISION_${_dependency_PREC}" GENERATED 1 IS_IN_BINARY_DIR 1 )
set_source_files_properties(${_dependency_OUTPUT} PROPERTIES COMPILE_FLAGS ${_compile_flags} GENERATED 1 IS_IN_BINARY_DIR 1 )
else( generate_out )
set_source_files_properties(${_dependency_OUTPUT} PROPERTIES COMPILE_FLAGS "-DPRECISION_${_dependency_PREC}" GENERATED 0 )
set_source_files_properties(${_dependency_OUTPUT} PROPERTIES COMPILE_FLAGS ${_compile_flags} GENERATED 0 )
endif( generate_out )
list(APPEND ${OUTPUTLIST} ${_dependency_OUTPUT})
......
......@@ -18,12 +18,17 @@
# This module sets the following variables:
# BLAS_FOUND - set to true if a library implementing the BLAS interface
# is found
# BLAS_LINKER_FLAGS - uncached list of required linker flags (excluding -l
# BLAS_LDFLAGS_OTHER - list of required linker flags (excluding -l
# and -L).
# BLAS_COMPILER_FLAGS - uncached list of required compiler flags (including -I for mkl headers).
# BLAS_LIBRARIES - uncached list of libraries (using full path name) to
# link against to use BLAS
# BLAS95_LIBRARIES - uncached list of libraries (using full path name)
# BLAS_CFLAGS_OTHER - list of required compiler flags (excluding -I).
# BLAS_INCLUDE_DIRS - include directories
# BLAS_LIBRARIES - list of libraries (using full path name) to
# link against to use BLAS, sequential or multithreaded version depending on BLA_VENDOR
# BLAS_LIBRARIES_SEQ - list of libraries (using full path name) to
# link against to use BLAS, sequential version (Intel MKL)
# BLAS_LIBRARIES_PAR - list of libraries (using full path name) to
# link against to use BLAS, multithreaded version (Intel MKL)
# BLAS95_LIBRARIES - list of libraries (using full path name)
# to link against to use BLAS95 interface
# BLAS95_FOUND - set to true if a library implementing the BLAS f95 interface
# is found
......@@ -32,6 +37,21 @@
# all the possibilities
# BLAS_VENDOR_FOUND stores the BLAS vendor found
# BLA_F95 if set on tries to find the f95 interfaces for BLAS/LAPACK
#
# BLAS_FOUND_WITH_PKGCONFIG - True if found with pkg-config
# if found with pkg-config the following variables are set
# <PREFIX> = BLAS
# <XPREFIX> = <PREFIX> for common case
# <XPREFIX> = <PREFIX>_STATIC for static linking
# <XPREFIX>_FOUND ... set to 1 if module(s) exist
# <XPREFIX>_LIBRARIES ... only the libraries (w/o the '-l')
# <XPREFIX>_LIBRARY_DIRS ... the paths of the libraries (w/o the '-L')
# <XPREFIX>_LDFLAGS ... all required linker flags
# <XPREFIX>_LDFLAGS_OTHER ... all other linker flags
# <XPREFIX>_INCLUDE_DIRS ... the '-I' preprocessor flags (w/o the '-I')
# <XPREFIX>_CFLAGS ... all required cflags
# <XPREFIX>_CFLAGS_OTHER ... the other compiler flags
#
# The user can give specific paths where to find the libraries adding cmake
# options at configure (ex: cmake path/to/project -DBLAS_DIR=path/to/blas):
# BLAS_DIR - Where to find the base directory of blas
......@@ -279,7 +299,8 @@ macro(Check_Fortran_Libraries LIBRARIES _prefix _name _flags _list _thread)
list(APPEND ${LIBRARIES} "-Wl,--end-group")
endif()
set(CMAKE_REQUIRED_LIBRARIES "${_flags};${${LIBRARIES}};${_thread}")
set(CMAKE_REQUIRED_FLAGS "${BLAS_COMPILER_FLAGS}")
set(CMAKE_REQUIRED_INCLUDES "${BLAS_INCLUDE_DIRS}")
set(CMAKE_REQUIRED_FLAGS "${BLAS_CFLAGS_OTHER}")
if (BLAS_VERBOSE)
message("${Cyan}BLAS libs found for BLA_VENDOR ${BLA_VENDOR}."
"Try to compile symbol ${_name} with following libraries:"
......@@ -316,7 +337,7 @@ macro(Check_Fortran_Libraries LIBRARIES _prefix _name _flags _list _thread)
endmacro(Check_Fortran_Libraries)
set(BLAS_LINKER_FLAGS)
set(BLAS_LDFLAGS_OTHER)
set(BLAS_LIBRARIES)
set(BLAS95_LIBRARIES)
if ($ENV{BLA_VENDOR} MATCHES ".+")
......@@ -327,1075 +348,1215 @@ else ()
endif()
endif ()
#BLAS in intel mkl 10 library? (em64t 64bit)
if (BLA_VENDOR MATCHES "Intel*" OR BLA_VENDOR STREQUAL "All")
if(NOT BLAS_LIBRARIES OR BLA_VENDOR MATCHES "Intel*")
# Looking for include
# -------------------
# Add system include paths to search include
# ------------------------------------------
unset(_inc_env)
set(ENV_MKLROOT "$ENV{MKLROOT}")
set(ENV_BLAS_DIR "$ENV{BLAS_DIR}")
set(ENV_BLAS_INCDIR "$ENV{BLAS_INCDIR}")
if(ENV_BLAS_INCDIR)
list(APPEND _inc_env "${ENV_BLAS_INCDIR}")
elseif(ENV_BLAS_DIR)
list(APPEND _inc_env "${ENV_BLAS_DIR}")
list(APPEND _inc_env "${ENV_BLAS_DIR}/include")
else()
if (ENV_MKLROOT)
list(APPEND _inc_env "${ENV_MKLROOT}/include")
set(ENV_BLAS_DIR "$ENV{BLAS_DIR}")
set(ENV_BLAS_INCDIR "$ENV{BLAS_INCDIR}")
set(ENV_BLAS_LIBDIR "$ENV{BLAS_LIBDIR}")
set(BLAS_GIVEN_BY_USER "FALSE")
if ( BLAS_DIR OR ( BLAS_INCDIR AND BLAS_LIBDIR) OR ENV_BLAS_DIR OR (ENV_BLAS_INCDIR AND ENV_BLAS_LIBDIR) )
set(BLAS_GIVEN_BY_USER "TRUE")
endif()
# Optionally use pkg-config to detect include/library dirs (if pkg-config is available)
# -------------------------------------------------------------------------------------
include(FindPkgConfig)
find_package(PkgConfig QUIET)
if( PKG_CONFIG_EXECUTABLE AND NOT BLAS_GIVEN_BY_USER )
if (BLA_STATIC)
set(MKL_STR_BLA_STATIC "static")
else()
set(MKL_STR_BLA_STATIC "dynamic")
endif()
# try different blas
if (BLA_VENDOR STREQUAL "Intel10_64lp")
pkg_search_module(BLAS mkl-${MKL_STR_BLA_STATIC}-lp64-seq)
if (BLAS_FOUND)
set (BLAS_VENDOR_FOUND "Intel MKL Sequential")
set (BLAS_LIBRARIES_SEQ "${BLAS_LIBRARIES}")
endif()
pkg_search_module(BLAS mkl-${MKL_STR_BLA_STATIC}-lp64-iomp)
if (BLAS_FOUND)
set (BLAS_VENDOR_FOUND "Intel MKL Multithreaded")
set (BLAS_LIBRARIES_PAR "${BLAS_LIBRARIES}")
endif()
elseif(BLA_VENDOR STREQUAL "Intel10_64lp_seq")
pkg_search_module(BLAS mkl-${MKL_STR_BLA_STATIC}-lp64-seq)
if (BLAS_FOUND)
set (BLAS_VENDOR_FOUND "Intel MKL")
set (BLAS_LIBRARIES_SEQ "${BLAS_LIBRARIES}")
endif()
elseif(BLA_VENDOR STREQUAL "Open")
pkg_search_module(BLAS openblas)
if (BLAS_FOUND)
set (BLAS_VENDOR_FOUND "Openblas")
endif()
elseif(BLA_VENDOR STREQUAL "Generic")
pkg_search_module(BLAS blas)
if (BLAS_FOUND)
set (BLAS_VENDOR_FOUND "Netlib or other Generic libblas")
endif()
else()
if (NOT BLAS_FOUND)
pkg_search_module(BLAS mkl-${MKL_STR_BLA_STATIC}-lp64-iomp)
if (BLAS_FOUND)
set (BLAS_VENDOR_FOUND "Intel MKL Multithreaded")
set (BLAS_LIBRARIES_PAR "${BLAS_LIBRARIES}")
endif()
# system variables
if(WIN32)
string(REPLACE ":" ";" _path_env "$ENV{INCLUDE}")
list(APPEND _inc_env "${_path_env}")
else()
string(REPLACE ":" ";" _path_env "$ENV{INCLUDE}")
list(APPEND _inc_env "${_path_env}")
string(REPLACE ":" ";" _path_env "$ENV{C_INCLUDE_PATH}")
list(APPEND _inc_env "${_path_env}")
string(REPLACE ":" ";" _path_env "$ENV{CPATH}")
list(APPEND _inc_env "${_path_env}")
string(REPLACE ":" ";" _path_env "$ENV{INCLUDE_PATH}")
list(APPEND _inc_env "${_path_env}")
pkg_search_module(BLAS mkl-${MKL_STR_BLA_STATIC}-lp64-seq)
if (BLAS_FOUND)
set (BLAS_VENDOR_FOUND "Intel MKL Sequential")
set (BLAS_LIBRARIES_SEQ "${BLAS_LIBRARIES}")
endif()
endif()
list(APPEND _inc_env "${CMAKE_PLATFORM_IMPLICIT_INCLUDE_DIRECTORIES}")
list(APPEND _inc_env "${CMAKE_C_IMPLICIT_INCLUDE_DIRECTORIES}")
list(REMOVE_DUPLICATES _inc_env)
# set paths where to look for
set(PATH_TO_LOOK_FOR "${_inc_env}")
# Try to find the fftw header in the given paths
# -------------------------------------------------
# call cmake macro to find the header path
if(BLAS_INCDIR)
set(BLAS_mkl.h_DIRS "BLAS_mkl.h_DIRS-NOTFOUND")
find_path(BLAS_mkl.h_DIRS
NAMES mkl.h
HINTS ${BLAS_INCDIR})
else()
if(BLAS_DIR)
set(BLAS_mkl.h_DIRS "BLAS_mkl.h_DIRS-NOTFOUND")
find_path(BLAS_mkl.h_DIRS
NAMES mkl.h
HINTS ${BLAS_DIR}
PATH_SUFFIXES "include")
else()
set(BLAS_mkl.h_DIRS "BLAS_mkl.h_DIRS-NOTFOUND")
find_path(BLAS_mkl.h_DIRS
NAMES mkl.h
HINTS ${PATH_TO_LOOK_FOR})
if (NOT BLAS_FOUND)
pkg_search_module(BLAS openblas)
if (BLAS_FOUND)
set (BLAS_VENDOR_FOUND "Openblas")
endif()
endif()
mark_as_advanced(BLAS_mkl.h_DIRS)
# If found, add path to cmake variable
# ------------------------------------
if (BLAS_mkl.h_DIRS)
set(BLAS_INCLUDE_DIRS "${BLAS_mkl.h_DIRS}")
else ()
set(BLAS_INCLUDE_DIRS "BLAS_INCLUDE_DIRS-NOTFOUND")
if(NOT BLAS_FIND_QUIETLY)
message(STATUS "Looking for BLAS -- mkl.h not found")
if (NOT BLAS_FOUND)
pkg_search_module(BLAS blas)
if (BLAS_FOUND)
set (BLAS_VENDOR_FOUND "Netlib or other Generic libblas")
endif()
endif()
endif()
if (WIN32)
string(REPLACE ":" ";" _libdir "$ENV{LIB}")
elseif (APPLE)
string(REPLACE ":" ";" _libdir "$ENV{DYLD_LIBRARY_PATH}")
else ()
string(REPLACE ":" ";" _libdir "$ENV{LD_LIBRARY_PATH}")
endif ()
list(APPEND _libdir "${CMAKE_PLATFORM_IMPLICIT_LINK_DIRECTORIES}")
list(APPEND _libdir "${CMAKE_C_IMPLICIT_LINK_DIRECTORIES}")
# libiomp5
# --------
set(OMP_iomp5_LIBRARY "OMP_iomp5_LIBRARY-NOTFOUND")
find_library(OMP_iomp5_LIBRARY
NAMES iomp5
HINTS ${_libdir}
)
mark_as_advanced(OMP_iomp5_LIBRARY)
set(OMP_LIB "")
# libgomp
# -------
set(OMP_gomp_LIBRARY "OMP_gomp_LIBRARY-NOTFOUND")
find_library(OMP_gomp_LIBRARY
NAMES gomp
HINTS ${_libdir}
)
mark_as_advanced(OMP_gomp_LIBRARY)
# choose one or another depending on the compilo
if (CMAKE_C_COMPILER_ID STREQUAL "GNU")
if (OMP_gomp_LIBRARY)
set(OMP_LIB "${OMP_gomp_LIBRARY}")
endif()
else(CMAKE_C_COMPILER_ID STREQUAL "Intel")
if (OMP_iomp5_LIBRARY)
set(OMP_LIB "${OMP_iomp5_LIBRARY}")
endif()
if (NOT BLAS_FIND_QUIETLY)
if (BLAS_FOUND AND BLAS_LIBRARIES)
message(STATUS "Looking for BLAS - found using PkgConfig")
else()
message(STATUS "${Magenta}Looking for BLAS - not found using PkgConfig."
"\n Perhaps you should add the directory containing blas.pc to"
"\n the PKG_CONFIG_PATH environment variable.${ColourReset}")
endif()
endif()
if (BLAS_FOUND AND BLAS_LIBRARIES)
set(BLAS_FOUND_WITH_PKGCONFIG "TRUE")
find_pkgconfig_libraries_absolute_path(BLAS)
else()
set(BLAS_FOUND_WITH_PKGCONFIG "FALSE")
endif()
endif()
if (UNIX AND NOT WIN32)
# m
find_library(M_LIBRARY
NAMES m
HINTS ${_libdir})
mark_as_advanced(M_LIBRARY)
if(M_LIBRARY)
set(LM "-lm")
if( (NOT BLAS_FOUND_WITH_PKGCONFIG) OR BLAS_GIVEN_BY_USER )
#BLAS in intel mkl 10 library? (em64t 64bit)
if (BLA_VENDOR MATCHES "Intel*" OR BLA_VENDOR STREQUAL "All")
if(NOT BLAS_LIBRARIES OR BLA_VENDOR MATCHES "Intel*")
# Looking for include
# -------------------
# Add system include paths to search include
# ------------------------------------------
unset(_inc_env)
set(ENV_MKLROOT "$ENV{MKLROOT}")
set(ENV_BLAS_DIR "$ENV{BLAS_DIR}")
set(ENV_BLAS_INCDIR "$ENV{BLAS_INCDIR}")
if(ENV_BLAS_INCDIR)
list(APPEND _inc_env "${ENV_BLAS_INCDIR}")
elseif(ENV_BLAS_DIR)
list(APPEND _inc_env "${ENV_BLAS_DIR}")
list(APPEND _inc_env "${ENV_BLAS_DIR}/include")
else()
set(LM "")
endif()
# Fortran
set(LGFORTRAN "")
if (CMAKE_C_COMPILER_ID MATCHES "GNU")
find_library(
FORTRAN_gfortran_LIBRARY
NAMES gfortran
HINTS ${_libdir}
)
mark_as_advanced(FORTRAN_gfortran_LIBRARY)
if (FORTRAN_gfortran_LIBRARY)
set(LGFORTRAN "${FORTRAN_gfortran_LIBRARY}")
if (ENV_MKLROOT)
list(APPEND _inc_env "${ENV_MKLROOT}/include")
endif()
elseif (CMAKE_C_COMPILER_ID MATCHES "Intel")
find_library(
FORTRAN_ifcore_LIBRARY
NAMES ifcore
HINTS ${_libdir}
)
mark_as_advanced(FORTRAN_ifcore_LIBRARY)
if (FORTRAN_ifcore_LIBRARY)
set(LGFORTRAN "{FORTRAN_ifcore_LIBRARY}")
# system variables
if(WIN32)
string(REPLACE ":" ";" _path_env "$ENV{INCLUDE}")
list(APPEND _inc_env "${_path_env}")
else()
string(REPLACE ":" ";" _path_env "$ENV{INCLUDE}")
list(APPEND _inc_env "${_path_env}")
string(REPLACE ":" ";" _path_env "$ENV{C_INCLUDE_PATH}")
list(APPEND _inc_env "${_path_env}")
string(REPLACE ":" ";" _path_env "$ENV{CPATH}")
list(APPEND _inc_env "${_path_env}")
string(REPLACE ":" ";" _path_env "$ENV{INCLUDE_PATH}")
list(APPEND _inc_env "${_path_env}")
endif()
endif()
set(BLAS_COMPILER_FLAGS "")
if (NOT BLA_VENDOR STREQUAL "Intel10_64lp_seq")
if(BLAS_FIND_REQUIRED)
find_package(OpenMP REQUIRED)
list(APPEND _inc_env "${CMAKE_PLATFORM_IMPLICIT_INCLUDE_DIRECTORIES}")
list(APPEND _inc_env "${CMAKE_C_IMPLICIT_INCLUDE_DIRECTORIES}")
list(REMOVE_DUPLICATES _inc_env)
# set paths where to look for
set(PATH_TO_LOOK_FOR "${_inc_env}")
# Try to find the fftw header in the given paths
# -------------------------------------------------
# call cmake macro to find the header path
if(BLAS_INCDIR)
set(BLAS_mkl.h_DIRS "BLAS_mkl.h_DIRS-NOTFOUND")
find_path(BLAS_mkl.h_DIRS
NAMES mkl.h
HINTS ${BLAS_INCDIR})
else()
if(BLAS_DIR)
set(BLAS_mkl.h_DIRS "BLAS_mkl.h_DIRS-NOTFOUND")
find_path(BLAS_mkl.h_DIRS
NAMES mkl.h
HINTS ${BLAS_DIR}
PATH_SUFFIXES "include")
else()
find_package(OpenMP)
set(BLAS_mkl.h_DIRS "BLAS_mkl.h_DIRS-NOTFOUND")
find_path(BLAS_mkl.h_DIRS
NAMES mkl.h
HINTS ${PATH_TO_LOOK_FOR})
endif()
if(OPENMP_C_FLAGS)
list(APPEND BLAS_COMPILER_FLAGS "${OPENMP_C_FLAGS}")
endif()
mark_as_advanced(BLAS_mkl.h_DIRS)
# If found, add path to cmake variable
# ------------------------------------
if (BLAS_mkl.h_DIRS)
set(BLAS_INCLUDE_DIRS "${BLAS_mkl.h_DIRS}")
else ()
set(BLAS_INCLUDE_DIRS "BLAS_INCLUDE_DIRS-NOTFOUND")
if(NOT BLAS_FIND_QUIETLY)
message(STATUS "Looking for BLAS -- mkl.h not found")
endif()
endif()
if (WIN32)
string(REPLACE ":" ";" _libdir "$ENV{LIB}")
elseif (APPLE)
string(REPLACE ":" ";" _libdir "$ENV{DYLD_LIBRARY_PATH}")
else ()
string(REPLACE ":" ";" _libdir "$ENV{LD_LIBRARY_PATH}")
endif ()
list(APPEND _libdir "${CMAKE_PLATFORM_IMPLICIT_LINK_DIRECTORIES}")
list(APPEND _libdir "${CMAKE_C_IMPLICIT_LINK_DIRECTORIES}")
# libiomp5
# --------
set(OMP_iomp5_LIBRARY "OMP_iomp5_LIBRARY-NOTFOUND")
find_library(OMP_iomp5_LIBRARY
NAMES iomp5
HINTS ${_libdir}
)
mark_as_advanced(OMP_iomp5_LIBRARY)
set(OMP_LIB "")
# libgomp
# -------
set(OMP_gomp_LIBRARY "OMP_gomp_LIBRARY-NOTFOUND")
find_library(OMP_gomp_LIBRARY
NAMES gomp
HINTS ${_libdir}
)
mark_as_advanced(OMP_gomp_LIBRARY)
# choose one or another depending on the compilo
if (CMAKE_C_COMPILER_ID STREQUAL "GNU")
if (BLA_VENDOR STREQUAL "Intel10_32")
list(APPEND BLAS_COMPILER_FLAGS "-m32")
if (OMP_gomp_LIBRARY)
set(OMP_LIB "${OMP_gomp_LIBRARY}")
endif()
else(CMAKE_C_COMPILER_ID STREQUAL "Intel")
if (OMP_iomp5_LIBRARY)
set(OMP_LIB "${OMP_iomp5_LIBRARY}")
endif()
endif()
if (UNIX AND NOT WIN32)
# m
find_library(M_LIBRARY
NAMES m
HINTS ${_libdir})
mark_as_advanced(M_LIBRARY)
if(M_LIBRARY)
set(LM "${M_LIBRARY}")
else()
list(APPEND BLAS_COMPILER_FLAGS "-m64")
set(LM "")
endif()
# Fortran
set(LGFORTRAN "")
if (CMAKE_C_COMPILER_ID MATCHES "GNU")
find_library(
FORTRAN_gfortran_LIBRARY
NAMES gfortran
HINTS ${_libdir}
)
mark_as_advanced(FORTRAN_gfortran_LIBRARY)
if (FORTRAN_gfortran_LIBRARY)
set(LGFORTRAN "${FORTRAN_gfortran_LIBRARY}")
endif()
elseif (CMAKE_C_COMPILER_ID MATCHES "Intel")
find_library(
FORTRAN_ifcore_LIBRARY
NAMES ifcore
HINTS ${_libdir}
)
mark_as_advanced(FORTRAN_ifcore_LIBRARY)
if (FORTRAN_ifcore_LIBRARY)
set(LGFORTRAN "{FORTRAN_ifcore_LIBRARY}")
endif()
endif()
set(BLAS_CFLAGS_OTHER "")
if (NOT BLA_VENDOR STREQUAL "Intel10_64lp_seq")
list(APPEND OMP_LIB "-ldl")
if(BLAS_FIND_REQUIRED)
find_package(OpenMP REQUIRED)
else()
find_package(OpenMP)
endif()
if(OPENMP_C_FLAGS)
list(APPEND BLAS_CFLAGS_OTHER "${OPENMP_C_FLAGS}")
endif()
endif()
if (ENV_MKLROOT)
list(APPEND BLAS_COMPILER_FLAGS "-I${ENV_MKLROOT}/include")
if (CMAKE_C_COMPILER_ID STREQUAL "GNU")
if (BLA_VENDOR STREQUAL "Intel10_32")
list(APPEND BLAS_CFLAGS_OTHER "-m32")
else()
list(APPEND BLAS_CFLAGS_OTHER "-m64")
endif()
if (NOT BLA_VENDOR STREQUAL "Intel10_64lp_seq")
find_library(
DL_LIBRARY
NAMES dl
HINTS ${_libdir}
)
list(APPEND OMP_LIB "${DL_LIBRARY}")
endif()
endif()
endif()
set(additional_flags "")
if (CMAKE_C_COMPILER_ID STREQUAL "GNU" AND CMAKE_SYSTEM_NAME STREQUAL "Linux")
set(additional_flags "-Wl,--no-as-needed")
endif()
endif ()
set(additional_flags "")
if (CMAKE_C_COMPILER_ID STREQUAL "GNU" AND CMAKE_SYSTEM_NAME STREQUAL "Linux")
set(additional_flags "-Wl,--no-as-needed")
endif()
endif ()
if (_LANGUAGES_ MATCHES C OR _LANGUAGES_ MATCHES CXX)
if(BLAS_FIND_QUIETLY OR NOT BLAS_FIND_REQUIRED)
find_package(Threads)
else()
find_package(Threads REQUIRED)
endif()
if (_LANGUAGES_ MATCHES C OR _LANGUAGES_ MATCHES CXX)
if(BLAS_FIND_QUIETLY OR NOT BLAS_FIND_REQUIRED)
find_package(Threads)
else()
find_package(Threads REQUIRED)
endif()
if( THREADS_FOUND )
libraries_absolute_path(CMAKE_THREAD_LIBS_INIT "")
endif ()
set(BLAS_SEARCH_LIBS "")
set(BLAS_SEARCH_LIBS "")
if(BLA_F95)
if(BLA_F95)
set(BLAS_mkl_SEARCH_SYMBOL SGEMM)
set(_LIBRARIES BLAS95_LIBRARIES)
if (WIN32)
if (BLA_STATIC)
set(BLAS_mkl_DLL_SUFFIX "")
else()
set(BLAS_mkl_DLL_SUFFIX "_dll")
endif()
set(BLAS_mkl_SEARCH_SYMBOL SGEMM)
set(_LIBRARIES BLAS95_LIBRARIES)
if (WIN32)
if (BLA_STATIC)
set(BLAS_mkl_DLL_SUFFIX "")
else()
set(BLAS_mkl_DLL_SUFFIX "_dll")
endif()
# Find the main file (32-bit or 64-bit)
set(BLAS_SEARCH_LIBS_WIN_MAIN "")
if (BLA_VENDOR STREQUAL "Intel10_32" OR BLA_VENDOR STREQUAL "All")
list(APPEND BLAS_SEARCH_LIBS_WIN_MAIN
"mkl_blas95${BLAS_mkl_DLL_SUFFIX} mkl_intel_c${BLAS_mkl_DLL_SUFFIX}")
endif()
if (BLA_VENDOR STREQUAL "Intel10_64lp*" OR BLA_VENDOR STREQUAL "All")
list(APPEND BLAS_SEARCH_LIBS_WIN_MAIN
"mkl_blas95_lp64${BLAS_mkl_DLL_SUFFIX} mkl_intel_lp64${BLAS_mkl_DLL_SUFFIX}")
endif ()
# Add threading/sequential libs
set(BLAS_SEARCH_LIBS_WIN_THREAD "")
if (BLA_VENDOR STREQUAL "*_seq" OR BLA_VENDOR STREQUAL "All")
list(APPEND BLAS_SEARCH_LIBS_WIN_THREAD
"mkl_sequential${BLAS_mkl_DLL_SUFFIX}")
endif()
if (NOT BLA_VENDOR STREQUAL "*_seq" OR BLA_VENDOR STREQUAL "All")
# old version
list(APPEND BLAS_SEARCH_LIBS_WIN_THREAD
"libguide40 mkl_intel_thread${BLAS_mkl_DLL_SUFFIX}")
# mkl >= 10.3
list(APPEND BLAS_SEARCH_LIBS_WIN_THREAD
"libiomp5md mkl_intel_thread${BLAS_mkl_DLL_SUFFIX}")
endif()
# Find the main file (32-bit or 64-bit)
set(BLAS_SEARCH_LIBS_WIN_MAIN "")
if (BLA_VENDOR STREQUAL "Intel10_32" OR BLA_VENDOR STREQUAL "All")
list(APPEND BLAS_SEARCH_LIBS_WIN_MAIN
"mkl_blas95${BLAS_mkl_DLL_SUFFIX} mkl_intel_c${BLAS_mkl_DLL_SUFFIX}")
endif()
if (BLA_VENDOR STREQUAL "Intel10_64lp*" OR BLA_VENDOR STREQUAL "All")
list(APPEND BLAS_SEARCH_LIBS_WIN_MAIN
"mkl_blas95_lp64${BLAS_mkl_DLL_SUFFIX} mkl_intel_lp64${BLAS_mkl_DLL_SUFFIX}")
endif ()
# Add threading/sequential libs
set(BLAS_SEARCH_LIBS_WIN_THREAD "")
if (BLA_VENDOR STREQUAL "*_seq" OR BLA_VENDOR STREQUAL "All")
list(APPEND BLAS_SEARCH_LIBS_WIN_THREAD
"mkl_sequential${BLAS_mkl_DLL_SUFFIX}")
endif()
if (NOT BLA_VENDOR STREQUAL "*_seq" OR BLA_VENDOR STREQUAL "All")
# old version
list(APPEND BLAS_SEARCH_LIBS_WIN_THREAD
"libguide40 mkl_intel_thread${BLAS_mkl_DLL_SUFFIX}")
# mkl >= 10.3
# sequential version
list(APPEND BLAS_SEARCH_LIBS_WIN_THREAD
"mkl_sequential${BLAS_mkl_DLL_SUFFIX}")
# multithreaded version
list(APPEND BLAS_SEARCH_LIBS_WIN_THREAD
"libiomp5md mkl_intel_thread${BLAS_mkl_DLL_SUFFIX}")
endif()
# Cartesian product of the above
foreach (MAIN ${BLAS_SEARCH_LIBS_WIN_MAIN})
foreach (THREAD ${BLAS_SEARCH_LIBS_WIN_THREAD})
list(APPEND BLAS_SEARCH_LIBS
"${MAIN} ${THREAD} mkl_core${BLAS_mkl_DLL_SUFFIX}")
# Cartesian product of the above
foreach (MAIN ${BLAS_SEARCH_LIBS_WIN_MAIN})
foreach (THREAD ${BLAS_SEARCH_LIBS_WIN_THREAD})
list(APPEND BLAS_SEARCH_LIBS
"${MAIN} ${THREAD} mkl_core${BLAS_mkl_DLL_SUFFIX}")
endforeach()
endforeach()
endforeach()
else (WIN32)
if (BLA_VENDOR STREQUAL "Intel10_32" OR BLA_VENDOR STREQUAL "All")
list(APPEND BLAS_SEARCH_LIBS
"mkl_blas95 mkl_intel mkl_intel_thread mkl_core guide")
endif ()
if (BLA_VENDOR STREQUAL "Intel10_64lp" OR BLA_VENDOR STREQUAL "All")
# old version
list(APPEND BLAS_SEARCH_LIBS
"mkl_blas95 mkl_intel_lp64 mkl_intel_thread mkl_core guide")
# mkl >= 10.3
if (CMAKE_C_COMPILER_ID STREQUAL "Intel")
else (WIN32)
if (BLA_VENDOR STREQUAL "Intel10_32" OR BLA_VENDOR STREQUAL "All")
list(APPEND BLAS_SEARCH_LIBS
"mkl_blas95_lp64 mkl_intel_lp64 mkl_intel_thread mkl_core")
endif()
if (CMAKE_C_COMPILER_ID STREQUAL "GNU")
"mkl_blas95 mkl_intel mkl_intel_thread mkl_core guide")
endif ()
if (BLA_VENDOR STREQUAL "Intel10_64lp" OR BLA_VENDOR STREQUAL "All")
# old version
list(APPEND BLAS_SEARCH_LIBS
"mkl_blas95_lp64 mkl_intel_lp64 mkl_gnu_thread mkl_core")
endif()
endif ()
if (BLA_VENDOR STREQUAL "Intel10_64lp_seq" OR BLA_VENDOR STREQUAL "All")
list(APPEND BLAS_SEARCH_LIBS
"mkl_intel_lp64 mkl_sequential mkl_core")
if (BLA_VENDOR STREQUAL "Intel10_64lp_seq")
set(OMP_LIB "")
"mkl_blas95 mkl_intel_lp64 mkl_intel_thread mkl_core guide")
# mkl >= 10.3
# sequential version
list(APPEND BLAS_SEARCH_LIBS
"mkl_intel_lp64 mkl_sequential mkl_core")
# multithreaded version
if (CMAKE_C_COMPILER_ID STREQUAL "Intel")
list(APPEND BLAS_SEARCH_LIBS
"mkl_blas95_lp64 mkl_intel_lp64 mkl_intel_thread mkl_core")
endif()
if (CMAKE_C_COMPILER_ID STREQUAL "GNU")
list(APPEND BLAS_SEARCH_LIBS
"mkl_blas95_lp64 mkl_intel_lp64 mkl_gnu_thread mkl_core")
endif()
endif ()
if (BLA_VENDOR STREQUAL "Intel10_64lp_seq" OR BLA_VENDOR STREQUAL "All")
list(APPEND BLAS_SEARCH_LIBS
"mkl_intel_lp64 mkl_sequential mkl_core")
if (BLA_VENDOR STREQUAL "Intel10_64lp_seq")
set(OMP_LIB "")
endif()
endif ()
endif (WIN32)
else (BLA_F95)
set(BLAS_mkl_SEARCH_SYMBOL sgemm)
set(_LIBRARIES BLAS_LIBRARIES)
if (WIN32)
if (BLA_STATIC)
set(BLAS_mkl_DLL_SUFFIX "")
else()
set(BLAS_mkl_DLL_SUFFIX "_dll")
endif()
endif ()
endif (WIN32)
else (BLA_F95)
set(BLAS_mkl_SEARCH_SYMBOL sgemm)
set(_LIBRARIES BLAS_LIBRARIES)
if (WIN32)
if (BLA_STATIC)
set(BLAS_mkl_DLL_SUFFIX "")
else()
set(BLAS_mkl_DLL_SUFFIX "_dll")
endif()
# Find the main file (32-bit or 64-bit)
set(BLAS_SEARCH_LIBS_WIN_MAIN "")
if (BLA_VENDOR STREQUAL "Intel10_32" OR BLA_VENDOR STREQUAL "All")
list(APPEND BLAS_SEARCH_LIBS_WIN_MAIN
"mkl_intel_c${BLAS_mkl_DLL_SUFFIX}")
endif()
if (BLA_VENDOR STREQUAL "Intel10_64lp*" OR BLA_VENDOR STREQUAL "All")
list(APPEND BLAS_SEARCH_LIBS_WIN_MAIN
"mkl_intel_lp64${BLAS_mkl_DLL_SUFFIX}")
endif ()
# Add threading/sequential libs
set(BLAS_SEARCH_LIBS_WIN_THREAD "")
if (NOT BLA_VENDOR STREQUAL "*_seq" OR BLA_VENDOR STREQUAL "All")
# old version
list(APPEND BLAS_SEARCH_LIBS_WIN_THREAD
"libguide40 mkl_intel_thread${BLAS_mkl_DLL_SUFFIX}")
# mkl >= 10.3
list(APPEND BLAS_SEARCH_LIBS_WIN_THREAD
"libiomp5md mkl_intel_thread${BLAS_mkl_DLL_SUFFIX}")
endif()
if (BLA_VENDOR STREQUAL "*_seq" OR BLA_VENDOR STREQUAL "All")
list(APPEND BLAS_SEARCH_LIBS_WIN_THREAD
"mkl_sequential${BLAS_mkl_DLL_SUFFIX}")
endif()
# Find the main file (32-bit or 64-bit)
set(BLAS_SEARCH_LIBS_WIN_MAIN "")
if (BLA_VENDOR STREQUAL "Intel10_32" OR BLA_VENDOR STREQUAL "All")
list(APPEND BLAS_SEARCH_LIBS_WIN_MAIN
"mkl_intel_c${BLAS_mkl_DLL_SUFFIX}")
endif()
if (BLA_VENDOR STREQUAL "Intel10_64lp*" OR BLA_VENDOR STREQUAL "All")
list(APPEND BLAS_SEARCH_LIBS_WIN_MAIN
"mkl_intel_lp64${BLAS_mkl_DLL_SUFFIX}")
endif ()
# Add threading/sequential libs
set(BLAS_SEARCH_LIBS_WIN_THREAD "")
if (NOT BLA_VENDOR STREQUAL "*_seq" OR BLA_VENDOR STREQUAL "All")
# old version
list(APPEND BLAS_SEARCH_LIBS_WIN_THREAD
"libguide40 mkl_intel_thread${BLAS_mkl_DLL_SUFFIX}")
# mkl >= 10.3
# sequential version
list(APPEND BLAS_SEARCH_LIBS_WIN_THREAD
"mkl_sequential${BLAS_mkl_DLL_SUFFIX}")
# multithreaded version
list(APPEND BLAS_SEARCH_LIBS_WIN_THREAD
"libiomp5md mkl_intel_thread${BLAS_mkl_DLL_SUFFIX}")
endif()
if (BLA_VENDOR STREQUAL "*_seq" OR BLA_VENDOR STREQUAL "All")
list(APPEND BLAS_SEARCH_LIBS_WIN_THREAD
"mkl_sequential${BLAS_mkl_DLL_SUFFIX}")
endif()
# Cartesian product of the above
foreach (MAIN ${BLAS_SEARCH_LIBS_WIN_MAIN})
foreach (THREAD ${BLAS_SEARCH_LIBS_WIN_THREAD})
list(APPEND BLAS_SEARCH_LIBS
"${MAIN} ${THREAD} mkl_core${BLAS_mkl_DLL_SUFFIX}")
# Cartesian product of the above
foreach (MAIN ${BLAS_SEARCH_LIBS_WIN_MAIN})
foreach (THREAD ${BLAS_SEARCH_LIBS_WIN_THREAD})
list(APPEND BLAS_SEARCH_LIBS
"${MAIN} ${THREAD} mkl_core${BLAS_mkl_DLL_SUFFIX}")
endforeach()
endforeach()
endforeach()
else (WIN32)
if (BLA_VENDOR STREQUAL "Intel10_32" OR BLA_VENDOR STREQUAL "All")
list(APPEND BLAS_SEARCH_LIBS
"mkl_intel mkl_intel_thread mkl_core guide")
endif ()
if (BLA_VENDOR STREQUAL "Intel10_64lp" OR BLA_VENDOR STREQUAL "All")
# old version
list(APPEND BLAS_SEARCH_LIBS
"mkl_intel_lp64 mkl_intel_thread mkl_core guide")
# mkl >= 10.3
if (CMAKE_C_COMPILER_ID STREQUAL "Intel")
else (WIN32)
if (BLA_VENDOR STREQUAL "Intel10_32" OR BLA_VENDOR STREQUAL "All")
list(APPEND BLAS_SEARCH_LIBS
"mkl_intel_lp64 mkl_intel_thread mkl_core")
endif()
if (CMAKE_C_COMPILER_ID STREQUAL "GNU")
"mkl_intel mkl_intel_thread mkl_core guide")
endif ()
if (BLA_VENDOR STREQUAL "Intel10_64lp" OR BLA_VENDOR STREQUAL "All")
# old version
list(APPEND BLAS_SEARCH_LIBS
"mkl_intel_lp64 mkl_intel_thread mkl_core guide")
# mkl >= 10.3
# sequential version
list(APPEND BLAS_SEARCH_LIBS
"mkl_intel_lp64 mkl_sequential mkl_core")
# multithreaded version
if (CMAKE_C_COMPILER_ID STREQUAL "Intel")
list(APPEND BLAS_SEARCH_LIBS
"mkl_intel_lp64 mkl_intel_thread mkl_core")
endif()
if (CMAKE_C_COMPILER_ID STREQUAL "GNU")
list(APPEND BLAS_SEARCH_LIBS
"mkl_intel_lp64 mkl_gnu_thread mkl_core")
endif()
endif ()
if (BLA_VENDOR STREQUAL "Intel10_64lp_seq" OR BLA_VENDOR STREQUAL "All")
list(APPEND BLAS_SEARCH_LIBS
"mkl_intel_lp64 mkl_sequential mkl_core")
if (BLA_VENDOR STREQUAL "Intel10_64lp_seq")
set(OMP_LIB "")
endif()
endif ()
#older versions of intel mkl libs
if (BLA_VENDOR STREQUAL "Intel" OR BLA_VENDOR STREQUAL "All")
list(APPEND BLAS_SEARCH_LIBS
"mkl")
list(APPEND BLAS_SEARCH_LIBS
"mkl_ia32")
list(APPEND BLAS_SEARCH_LIBS
"mkl_intel_lp64 mkl_gnu_thread mkl_core")
"mkl_em64t")
endif ()
endif (WIN32)
endif (BLA_F95)
foreach (IT ${BLAS_SEARCH_LIBS})
string(REPLACE " " ";" SEARCH_LIBS ${IT})
# determine if we look at a sequential or multithreaded version
set(MKL_MT OFF)
foreach(_lib ${SEARCH_LIBS})
if (${_lib} MATCHES "thread")
set (MKL_MT ON)
endif()
endif ()
if (BLA_VENDOR STREQUAL "Intel10_64lp_seq" OR BLA_VENDOR STREQUAL "All")
list(APPEND BLAS_SEARCH_LIBS
"mkl_intel_lp64 mkl_sequential mkl_core")
if (BLA_VENDOR STREQUAL "Intel10_64lp_seq")
set(OMP_LIB "")
endforeach()
if (MKL_MT)
check_fortran_libraries(
${_LIBRARIES}
BLAS
${BLAS_mkl_SEARCH_SYMBOL}
"${additional_flags}"
"${SEARCH_LIBS}"
"${OMP_LIB};${CMAKE_THREAD_LIBS_INIT};${LM}"
)
else()
check_fortran_libraries(
${_LIBRARIES}
BLAS
${BLAS_mkl_SEARCH_SYMBOL}
"${additional_flags}"
"${SEARCH_LIBS}"
"${CMAKE_THREAD_LIBS_INIT};${LM}"
)
endif()
if(${_LIBRARIES})
set(BLAS_LDFLAGS_OTHER "${additional_flags}")
if (MKL_MT)
set (BLAS_LIBRARIES_PAR "${${_LIBRARIES}}")
else()
set (BLAS_LIBRARIES_SEQ "${${_LIBRARIES}}")
endif()
endif ()
#older vesions of intel mkl libs
if (BLA_VENDOR STREQUAL "Intel" OR BLA_VENDOR STREQUAL "All")
list(APPEND BLAS_SEARCH_LIBS
"mkl")
list(APPEND BLAS_SEARCH_LIBS
"mkl_ia32")
list(APPEND BLAS_SEARCH_LIBS
"mkl_em64t")
endif ()
endif (WIN32)
endif (BLA_F95)
foreach (IT ${BLAS_SEARCH_LIBS})
string(REPLACE " " ";" SEARCH_LIBS ${IT})
if (${_LIBRARIES})
else ()
check_fortran_libraries(
${_LIBRARIES}
BLAS
${BLAS_mkl_SEARCH_SYMBOL}
"${additional_flags}"
"${SEARCH_LIBS}"
"${OMP_LIB};${CMAKE_THREAD_LIBS_INIT};${LM}"
)
if(_LIBRARIES)
set(BLAS_LINKER_FLAGS "${additional_flags}")
set(${_LIBRARIES}_COPY "${${_LIBRARIES}}")
endif()
endforeach ()
if (${_LIBRARIES}_COPY)
set(${_LIBRARIES} "${${_LIBRARIES}_COPY}")
endif()
if(NOT BLAS_FIND_QUIETLY)
if(${_LIBRARIES})
message(STATUS "Looking for MKL BLAS: found")
else()
message(STATUS "Looking for MKL BLAS: not found")
endif()
endif()
endforeach ()
if (${_LIBRARIES} AND NOT BLAS_VENDOR_FOUND)
set (BLAS_VENDOR_FOUND "Intel MKL")
endif()
endif (_LANGUAGES_ MATCHES C OR _LANGUAGES_ MATCHES CXX)
endif(NOT BLAS_LIBRARIES OR BLA_VENDOR MATCHES "Intel*")
endif (BLA_VENDOR MATCHES "Intel*" OR BLA_VENDOR STREQUAL "All")
if (BLA_VENDOR STREQUAL "Goto" OR BLA_VENDOR STREQUAL "All")
if(NOT BLAS_LIBRARIES)
# gotoblas (http://www.tacc.utexas.edu/tacc-projects/gotoblas2)
check_fortran_libraries(
BLAS_LIBRARIES
BLAS
sgemm
""
"goto2"
""
)
if(NOT BLAS_FIND_QUIETLY)
if(${_LIBRARIES})
message(STATUS "Looking for MKL BLAS: found")
if(BLAS_LIBRARIES)
message(STATUS "Looking for Goto BLAS: found")
else()
message(STATUS "Looking for MKL BLAS: not found")
message(STATUS "Looking for Goto BLAS: not found")
endif()
endif()
if (${_LIBRARIES} AND NOT BLAS_VENDOR_FOUND)
set (BLAS_VENDOR_FOUND "Intel MKL")
endif()
endif (_LANGUAGES_ MATCHES C OR _LANGUAGES_ MATCHES CXX)
endif(NOT BLAS_LIBRARIES OR BLA_VENDOR MATCHES "Intel*")
endif (BLA_VENDOR MATCHES "Intel*" OR BLA_VENDOR STREQUAL "All")
if (BLA_VENDOR STREQUAL "Goto" OR BLA_VENDOR STREQUAL "All")
if(NOT BLAS_LIBRARIES)
# gotoblas (http://www.tacc.utexas.edu/tacc-projects/gotoblas2)
check_fortran_libraries(
BLAS_LIBRARIES
BLAS
sgemm
""
"goto2"
""
)
if(NOT BLAS_FIND_QUIETLY)
if(BLAS_LIBRARIES)
message(STATUS "Looking for Goto BLAS: found")
else()
message(STATUS "Looking for Goto BLAS: not found")
endif()
endif()
endif()
if (BLAS_LIBRARIES AND NOT BLAS_VENDOR_FOUND)
set (BLAS_VENDOR_FOUND "Goto")
endif()
if (BLAS_LIBRARIES AND NOT BLAS_VENDOR_FOUND)
set (BLAS_VENDOR_FOUND "Goto")
endif()
endif (BLA_VENDOR STREQUAL "Goto" OR BLA_VENDOR STREQUAL "All")
endif (BLA_VENDOR STREQUAL "Goto" OR BLA_VENDOR STREQUAL "All")
# OpenBlas
if (BLA_VENDOR STREQUAL "Open" OR BLA_VENDOR STREQUAL "All")
# OpenBlas
if (BLA_VENDOR STREQUAL "Open" OR BLA_VENDOR STREQUAL "All")
if(NOT BLAS_LIBRARIES)
# openblas (http://www.openblas.net/)
check_fortran_libraries(
BLAS_LIBRARIES
BLAS
sgemm
""
"openblas"
""
)
if(NOT BLAS_FIND_QUIETLY)
if(BLAS_LIBRARIES)
message(STATUS "Looking for Open BLAS: found")
else()
message(STATUS "Looking for Open BLAS: not found")
if(NOT BLAS_LIBRARIES)
# openblas (http://www.openblas.net/)
check_fortran_libraries(
BLAS_LIBRARIES
BLAS
sgemm
""
"openblas"
""
)
if(NOT BLAS_FIND_QUIETLY)
if(BLAS_LIBRARIES)
message(STATUS "Looking for Open BLAS: found")
else()
message(STATUS "Looking for Open BLAS: not found")
endif()
endif()
endif()
endif()
if (BLAS_LIBRARIES AND NOT BLAS_VENDOR_FOUND)
set (BLAS_VENDOR_FOUND "Openblas")
endif()
if (BLAS_LIBRARIES AND NOT BLAS_VENDOR_FOUND)
set (BLAS_VENDOR_FOUND "Openblas")
endif()
endif (BLA_VENDOR STREQUAL "Open" OR BLA_VENDOR STREQUAL "All")
endif (BLA_VENDOR STREQUAL "Open" OR BLA_VENDOR STREQUAL "All")
# EigenBlas
if (BLA_VENDOR STREQUAL "Eigen" OR BLA_VENDOR STREQUAL "All")
# EigenBlas
if (BLA_VENDOR STREQUAL "Eigen" OR BLA_VENDOR STREQUAL "All")
if(NOT BLAS_LIBRARIES)
# eigenblas (http://eigen.tuxfamily.org/index.php?title=Main_Page)
check_fortran_libraries(
BLAS_LIBRARIES
BLAS
sgemm
""
"eigen_blas"
""
)
if(NOT BLAS_FIND_QUIETLY)
if(BLAS_LIBRARIES AND NOT BLAS_VENDOR_FOUND)
message(STATUS "Looking for Eigen BLAS: found")
else()
message(STATUS "Looking for Eigen BLAS: not found")
if(NOT BLAS_LIBRARIES)
# eigenblas (http://eigen.tuxfamily.org/index.php?title=Main_Page)
check_fortran_libraries(
BLAS_LIBRARIES
BLAS
sgemm
""
"eigen_blas"
""
)
if(NOT BLAS_FIND_QUIETLY)
if(BLAS_LIBRARIES AND NOT BLAS_VENDOR_FOUND)
message(STATUS "Looking for Eigen BLAS: found")
else()
message(STATUS "Looking for Eigen BLAS: not found")
endif()
endif()
endif()
endif()
if(NOT BLAS_LIBRARIES)
# eigenblas (http://eigen.tuxfamily.org/index.php?title=Main_Page)
check_fortran_libraries(
BLAS_LIBRARIES
BLAS
sgemm
""
"eigen_blas_static"
""
)
if(NOT BLAS_FIND_QUIETLY)
if(BLAS_LIBRARIES)
message(STATUS "Looking for Eigen BLAS: found")
else()
message(STATUS "Looking for Eigen BLAS: not found")
if(NOT BLAS_LIBRARIES)
# eigenblas (http://eigen.tuxfamily.org/index.php?title=Main_Page)
check_fortran_libraries(
BLAS_LIBRARIES
BLAS
sgemm
""
"eigen_blas_static"
""
)
if(NOT BLAS_FIND_QUIETLY)
if(BLAS_LIBRARIES)
message(STATUS "Looking for Eigen BLAS: found")
else()
message(STATUS "Looking for Eigen BLAS: not found")
endif()
endif()
endif()
endif()
if (BLAS_LIBRARIES AND NOT BLAS_VENDOR_FOUND)
set (BLAS_VENDOR_FOUND "Eigen")
endif()
if (BLAS_LIBRARIES AND NOT BLAS_VENDOR_FOUND)
set (BLAS_VENDOR_FOUND "Eigen")
endif()
endif (BLA_VENDOR STREQUAL "Eigen" OR BLA_VENDOR STREQUAL "All")
endif (BLA_VENDOR STREQUAL "Eigen" OR BLA_VENDOR STREQUAL "All")
if (BLA_VENDOR STREQUAL "ATLAS" OR BLA_VENDOR STREQUAL "All")
if (BLA_VENDOR STREQUAL "ATLAS" OR BLA_VENDOR STREQUAL "All")
if(NOT BLAS_LIBRARIES)
# BLAS in ATLAS library? (http://math-atlas.sourceforge.net/)
check_fortran_libraries(
BLAS_LIBRARIES
BLAS
dgemm
""
"f77blas;atlas"
""
)
if(NOT BLAS_FIND_QUIETLY)
if(BLAS_LIBRARIES)
message(STATUS "Looking for Atlas BLAS: found")
else()
message(STATUS "Looking for Atlas BLAS: not found")
if(NOT BLAS_LIBRARIES)
# BLAS in ATLAS library? (http://math-atlas.sourceforge.net/)
check_fortran_libraries(
BLAS_LIBRARIES
BLAS
dgemm
""
"f77blas;atlas"
""
)
if(NOT BLAS_FIND_QUIETLY)
if(BLAS_LIBRARIES)
message(STATUS "Looking for Atlas BLAS: found")
else()
message(STATUS "Looking for Atlas BLAS: not found")
endif()
endif()
endif()
endif()
if (BLAS_LIBRARIES AND NOT BLAS_VENDOR_FOUND)
set (BLAS_VENDOR_FOUND "Atlas")
endif()
if (BLAS_LIBRARIES AND NOT BLAS_VENDOR_FOUND)
set (BLAS_VENDOR_FOUND "Atlas")
endif()
endif (BLA_VENDOR STREQUAL "ATLAS" OR BLA_VENDOR STREQUAL "All")
endif (BLA_VENDOR STREQUAL "ATLAS" OR BLA_VENDOR STREQUAL "All")
# BLAS in PhiPACK libraries? (requires generic BLAS lib, too)
if (BLA_VENDOR STREQUAL "PhiPACK" OR BLA_VENDOR STREQUAL "All")
# BLAS in PhiPACK libraries? (requires generic BLAS lib, too)
if (BLA_VENDOR STREQUAL "PhiPACK" OR BLA_VENDOR STREQUAL "All")
if(NOT BLAS_LIBRARIES)
check_fortran_libraries(
BLAS_LIBRARIES
BLAS
sgemm
""
"sgemm;dgemm;blas"
""
)
if(NOT BLAS_FIND_QUIETLY)
if(BLAS_LIBRARIES)
message(STATUS "Looking for PhiPACK BLAS: found")
else()
message(STATUS "Looking for PhiPACK BLAS: not found")
if(NOT BLAS_LIBRARIES)
check_fortran_libraries(
BLAS_LIBRARIES
BLAS
sgemm
""
"sgemm;dgemm;blas"
""
)
if(NOT BLAS_FIND_QUIETLY)
if(BLAS_LIBRARIES)
message(STATUS "Looking for PhiPACK BLAS: found")
else()
message(STATUS "Looking for PhiPACK BLAS: not found")
endif()
endif()
endif()
endif()
if (BLAS_LIBRARIES AND NOT BLAS_VENDOR_FOUND)
set (BLAS_VENDOR_FOUND "PhiPACK")
endif()
if (BLAS_LIBRARIES AND NOT BLAS_VENDOR_FOUND)
set (BLAS_VENDOR_FOUND "PhiPACK")
endif()
endif (BLA_VENDOR STREQUAL "PhiPACK" OR BLA_VENDOR STREQUAL "All")
endif (BLA_VENDOR STREQUAL "PhiPACK" OR BLA_VENDOR STREQUAL "All")
# BLAS in Alpha CXML library?
if (BLA_VENDOR STREQUAL "CXML" OR BLA_VENDOR STREQUAL "All")
# BLAS in Alpha CXML library?
if (BLA_VENDOR STREQUAL "CXML" OR BLA_VENDOR STREQUAL "All")
if(NOT BLAS_LIBRARIES)
check_fortran_libraries(
BLAS_LIBRARIES
BLAS
sgemm
""
"cxml"
""
)