ENH: FindBLAS.cmake, FindLAPACK.cmake modules were redesigned so now you have three new variables BLA_VENDOR (you can specify the VENDOR), BLA_STATIC (gets the static version of libs), BLA_F95 (gets the fortran 95 interface). BLA_VENDOR can be specified as an environment variable. Intel mkls libs need FindThreads to be found correctly so you will need to enable the C/CXX
This commit is contained in:
parent
6db292d656
commit
a57fc5585a
|
@ -24,7 +24,7 @@ macro(CHECK_FORTRAN_FUNCTION_EXISTS FUNCTION VARIABLE)
|
||||||
program TESTFortran
|
program TESTFortran
|
||||||
external ${FUNCTION}
|
external ${FUNCTION}
|
||||||
call ${FUNCTION}()
|
call ${FUNCTION}()
|
||||||
end
|
end program TESTFortran
|
||||||
"
|
"
|
||||||
)
|
)
|
||||||
try_compile(${VARIABLE}
|
try_compile(${VARIABLE}
|
||||||
|
@ -33,6 +33,7 @@ macro(CHECK_FORTRAN_FUNCTION_EXISTS FUNCTION VARIABLE)
|
||||||
CMAKE_FLAGS "${CHECK_FUNCTION_EXISTS_ADD_LIBRARIES}"
|
CMAKE_FLAGS "${CHECK_FUNCTION_EXISTS_ADD_LIBRARIES}"
|
||||||
OUTPUT_VARIABLE OUTPUT
|
OUTPUT_VARIABLE OUTPUT
|
||||||
)
|
)
|
||||||
|
# message(STATUS "${OUTPUT}")
|
||||||
if(${VARIABLE})
|
if(${VARIABLE})
|
||||||
set(${VARIABLE} 1 CACHE INTERNAL "Have Fortran function ${FUNCTION}")
|
set(${VARIABLE} 1 CACHE INTERNAL "Have Fortran function ${FUNCTION}")
|
||||||
message(STATUS "Looking for Fortran ${FUNCTION} - found")
|
message(STATUS "Looking for Fortran ${FUNCTION} - found")
|
||||||
|
|
|
@ -1,349 +1,453 @@
|
||||||
# - Find a Fortran BLAS library
|
# - Find BLAS library
|
||||||
# N.B. Fortran only. This module cannot be used to find a C BLAS library.
|
# This module finds an installed fortran library that implements the BLAS
|
||||||
# This module finds an installed fortran library that implements the BLAS
|
# linear-algebra interface (see http://www.netlib.org/blas/).
|
||||||
# linear-algebra interface (see http://www.netlib.org/blas/).
|
# The list of libraries searched for is taken
|
||||||
# The list of libraries searched for is taken
|
# from the autoconf macro file, acx_blas.m4 (distributed at
|
||||||
# from the autoconf macro file, acx_blas.m4 (distributed at
|
# http://ac-archive.sourceforge.net/ac-archive/acx_blas.html).
|
||||||
# http://ac-archive.sourceforge.net/ac-archive/acx_blas.html).
|
#
|
||||||
#
|
# This module sets the following variables:
|
||||||
# This module sets the following variables:
|
# BLAS_FOUND - set to true if a library implementing the BLAS interface
|
||||||
# BLAS_FOUND - set to true if a library implementing the BLAS interface
|
# is found
|
||||||
# is found
|
# BLAS_LINKER_FLAGS - uncached list of required linker flags (excluding -l
|
||||||
# BLAS_LINKER_FLAGS - uncached list of required linker flags (excluding -l
|
# and -L).
|
||||||
# and -L).
|
# BLAS_LIBRARIES - uncached list of libraries (using full path name) to
|
||||||
# BLAS_LIBRARIES - uncached list of libraries (using full path name) to
|
# link against to use BLAS
|
||||||
# link against to use BLAS
|
# BLAS95_LIBRARIES - uncached list of libraries (using full path name)
|
||||||
# BLAS95_LIBRARIES - uncached list of libraries (using full path name) # to link against to use BLAS95 interface
|
# to link against to use BLAS95 interface
|
||||||
#
|
# BLAS95_FOUND - set to true if a library implementing the BLAS f95 interface
|
||||||
|
# is found
|
||||||
get_property(_LANGUAGES_ GLOBAL PROPERTY ENABLED_LANGUAGES)
|
# BLA_STATIC if set on this determines what kind of linkage we do (static)
|
||||||
if(NOT _LANGUAGES_ MATCHES Fortran)
|
# BLA_VENDOR if set checks only the specified vendor, if not set checks
|
||||||
if(BLAS_FIND_REQUIRED)
|
# all the posibilities
|
||||||
message(FATAL_ERROR "FindBLAS is Fortran-only so Fortran must be enabled.")
|
# BLA_F95 if set on tries to find the f95 interfaces for BLAS/LAPACK
|
||||||
else(BLAS_FIND_REQUIRED)
|
##########
|
||||||
message(STATUS "Looking for BLAS... - NOT found (Fortran not enabled)") #
|
### List of vendors (BLA_VENDOR) valid in this module
|
||||||
return()
|
## ATLAS, PhiPACK,CXML,DXML,SunPerf,SCSL,SGIMATH,IBMESSL,Intel10_32 (intel mkl v10 32 bit),Intel10_64lp (intel mkl v10 64 bit,lp thread model, lp64 model),
|
||||||
endif(BLAS_FIND_REQUIRED)
|
## Intel( older versions of mkl 32 and 64 bit), ACML,Apple, NAS, Generic
|
||||||
endif(NOT _LANGUAGES_ MATCHES Fortran)
|
# C/CXX should be enabled to use Intel mkl
|
||||||
|
get_property(_LANGUAGES_ GLOBAL PROPERTY ENABLED_LANGUAGES)
|
||||||
include(CheckFortranFunctionExists)
|
if(NOT _LANGUAGES_ MATCHES Fortran)
|
||||||
|
if(BLAS_FIND_REQUIRED)
|
||||||
macro(Check_Fortran_Libraries LIBRARIES _prefix _name _flags _list)
|
message(FATAL_ERROR "FindBLAS is Fortran-only so Fortran must be enabled.")
|
||||||
# This macro checks for the existence of the combination of fortran libraries
|
else(BLAS_FIND_REQUIRED)
|
||||||
# given by _list. If the combination is found, this macro checks (using the
|
message(STATUS "Looking for BLAS... - NOT found (Fortran not enabled)") #
|
||||||
# Check_Fortran_Function_Exists macro) whether can link against that library
|
return()
|
||||||
# combination using the name of a routine given by _name using the linker
|
endif(BLAS_FIND_REQUIRED)
|
||||||
# flags given by _flags. If the combination of libraries is found and passes
|
endif(NOT _LANGUAGES_ MATCHES Fortran)
|
||||||
# the link test, LIBRARIES is set to the list of complete library paths that
|
|
||||||
# have been found. Otherwise, LIBRARIES is set to FALSE.
|
include(CheckFortranFunctionExists)
|
||||||
|
|
||||||
# N.B. _prefix is the prefix applied to the names of all cached variables that
|
macro(Check_Fortran_Libraries LIBRARIES _prefix _name _flags _list _threads)
|
||||||
# are generated internally and marked advanced by this macro.
|
# This macro checks for the existence of the combination of fortran libraries
|
||||||
|
# given by _list. If the combination is found, this macro checks (using the
|
||||||
set(_libraries_work TRUE)
|
# Check_Fortran_Function_Exists macro) whether can link against that library
|
||||||
set(${LIBRARIES})
|
# combination using the name of a routine given by _name using the linker
|
||||||
set(_combined_name)
|
# flags given by _flags. If the combination of libraries is found and passes
|
||||||
foreach(_library ${_list})
|
# the link test, LIBRARIES is set to the list of complete library paths that
|
||||||
set(_combined_name ${_combined_name}_${_library})
|
# have been found. Otherwise, LIBRARIES is set to FALSE.
|
||||||
|
|
||||||
if(_libraries_work)
|
# N.B. _prefix is the prefix applied to the names of all cached variables that
|
||||||
|
# are generated internally and marked advanced by this macro.
|
||||||
if ( WIN32 )
|
|
||||||
find_library(${_prefix}_${_library}_LIBRARY
|
set(_libraries_work TRUE)
|
||||||
NAMES ${_library}
|
set(${LIBRARIES})
|
||||||
PATHS ENV LIB
|
set(_combined_name)
|
||||||
)
|
foreach(_library ${_list})
|
||||||
endif ( WIN32 )
|
set(_combined_name ${_combined_name}_${_library})
|
||||||
|
|
||||||
if ( APPLE )
|
if(_libraries_work)
|
||||||
find_library(${_prefix}_${_library}_LIBRARY
|
if ( WIN32 )
|
||||||
NAMES ${_library}
|
if(BLA_STATIC)
|
||||||
PATHS /usr/local/lib /usr/lib /usr/local/lib64 /usr/lib64 ENV DYLD_LIBRARY_PATH
|
set(CMAKE_FIND_LIBRARY_SUFFIXES ".lib;.dll")
|
||||||
)
|
endif(BLA_STATIC)
|
||||||
|
find_library(${_prefix}_${_library}_LIBRARY
|
||||||
else ( APPLE )
|
NAMES ${_library}
|
||||||
find_library(${_prefix}_${_library}_LIBRARY
|
PATHS ENV LIB
|
||||||
NAMES ${_library}
|
)
|
||||||
PATHS /usr/local/lib /usr/lib /usr/local/lib64 /usr/lib64 ENV LD_LIBRARY_PATH
|
endif ( WIN32 )
|
||||||
)
|
|
||||||
endif( APPLE )
|
if ( APPLE )
|
||||||
mark_as_advanced(${_prefix}_${_library}_LIBRARY)
|
if(BLA_STATIC)
|
||||||
set(${LIBRARIES} ${${LIBRARIES}} ${${_prefix}_${_library}_LIBRARY})
|
set(CMAKE_FIND_LIBRARY_SUFFIXES ".lib;.dll")
|
||||||
set(_libraries_work ${${_prefix}_${_library}_LIBRARY})
|
endif(BLA_STATIC)
|
||||||
endif(_libraries_work)
|
find_library(${_prefix}_${_library}_LIBRARY
|
||||||
endforeach(_library ${_list})
|
NAMES ${_library}
|
||||||
if(_libraries_work)
|
PATHS /usr/local/lib /usr/lib /usr/local/lib64 /usr/lib64 ENV DYLD_LIBRARY_PATH
|
||||||
# Test this combination of libraries.
|
)
|
||||||
set(CMAKE_REQUIRED_LIBRARIES ${_flags} ${${LIBRARIES}})
|
|
||||||
#message("DEBUG: CMAKE_REQUIRED_LIBRARIES = ${CMAKE_REQUIRED_LIBRARIES}")
|
else ( APPLE )
|
||||||
check_fortran_function_exists(${_name} ${_prefix}${_combined_name}_WORKS)
|
if(BLA_STATIC)
|
||||||
set(CMAKE_REQUIRED_LIBRARIES)
|
set(CMAKE_FIND_LIBRARY_SUFFIXES ".a;.so")
|
||||||
mark_as_advanced(${_prefix}${_combined_name}_WORKS)
|
endif(BLA_STATIC)
|
||||||
set(_libraries_work ${${_prefix}${_combined_name}_WORKS})
|
find_library(${_prefix}_${_library}_LIBRARY
|
||||||
endif(_libraries_work)
|
NAMES ${_library}
|
||||||
if(NOT _libraries_work)
|
PATHS /usr/local/lib /usr/lib /usr/local/lib64 /usr/lib64 ENV LD_LIBRARY_PATH
|
||||||
set(${LIBRARIES} FALSE)
|
)
|
||||||
endif(NOT _libraries_work)
|
endif( APPLE )
|
||||||
#message("DEBUG: ${LIBRARIES} = ${${LIBRARIES}}")
|
mark_as_advanced(${_prefix}_${_library}_LIBRARY)
|
||||||
endmacro(Check_Fortran_Libraries)
|
set(${LIBRARIES} ${${LIBRARIES}} ${${_prefix}_${_library}_LIBRARY})
|
||||||
|
set(_libraries_work ${${_prefix}_${_library}_LIBRARY})
|
||||||
set(BLAS_LINKER_FLAGS)
|
endif(_libraries_work)
|
||||||
set(BLAS_LIBRARIES)
|
endforeach(_library ${_list})
|
||||||
set(BLAS95_LIBRARIES)
|
if(_libraries_work)
|
||||||
|
# Test this combination of libraries.
|
||||||
|
set(CMAKE_REQUIRED_LIBRARIES ${_flags} ${${LIBRARIES}} ${_threads})
|
||||||
|
# message("DEBUG: CMAKE_REQUIRED_LIBRARIES = ${CMAKE_REQUIRED_LIBRARIES}")
|
||||||
if(NOT BLAS_LIBRARIES)
|
check_fortran_function_exists(${_name} ${_prefix}${_combined_name}_WORKS)
|
||||||
# BLAS in ATLAS library? (http://math-atlas.sourceforge.net/)
|
set(CMAKE_REQUIRED_LIBRARIES)
|
||||||
check_fortran_libraries(
|
mark_as_advanced(${_prefix}${_combined_name}_WORKS)
|
||||||
BLAS_LIBRARIES
|
set(_libraries_work ${${_prefix}${_combined_name}_WORKS})
|
||||||
BLAS
|
endif(_libraries_work)
|
||||||
cblas_dgemm
|
if(NOT _libraries_work)
|
||||||
""
|
set(${LIBRARIES} FALSE)
|
||||||
"cblas;f77blas;atlas"
|
endif(NOT _libraries_work)
|
||||||
)
|
#message("DEBUG: ${LIBRARIES} = ${${LIBRARIES}}")
|
||||||
endif(NOT BLAS_LIBRARIES)
|
endmacro(Check_Fortran_Libraries)
|
||||||
|
|
||||||
# BLAS in PhiPACK libraries? (requires generic BLAS lib, too)
|
set(BLAS_LINKER_FLAGS)
|
||||||
if(NOT BLAS_LIBRARIES)
|
set(BLAS_LIBRARIES)
|
||||||
check_fortran_libraries(
|
set(BLAS95_LIBRARIES)
|
||||||
BLAS_LIBRARIES
|
if ($ENV{BLA_VENDOR} MATCHES ".+")
|
||||||
BLAS
|
set(BLA_VENDOR $ENV{BLA_VENDOR})
|
||||||
sgemm
|
else ($ENV{BLA_VENDOR} MATCHES ".+")
|
||||||
""
|
if(NOT BLA_VENDOR)
|
||||||
"sgemm;dgemm;blas"
|
set(BLA_VENDOR "All")
|
||||||
)
|
endif(NOT BLA_VENDOR)
|
||||||
endif(NOT BLAS_LIBRARIES)
|
endif ($ENV{BLA_VENDOR} MATCHES ".+")
|
||||||
|
|
||||||
# BLAS in Alpha CXML library?
|
if (BLA_VENDOR STREQUAL "ATLAS" OR BLA_VENDOR STREQUAL "All")
|
||||||
if(NOT BLAS_LIBRARIES)
|
if(NOT BLAS_LIBRARIES)
|
||||||
check_fortran_libraries(
|
# BLAS in ATLAS library? (http://math-atlas.sourceforge.net/)
|
||||||
BLAS_LIBRARIES
|
check_fortran_libraries(
|
||||||
BLAS
|
BLAS_LIBRARIES
|
||||||
sgemm
|
BLAS
|
||||||
""
|
cblas_dgemm
|
||||||
"cxml"
|
""
|
||||||
)
|
"cblas;f77blas;atlas"
|
||||||
endif(NOT BLAS_LIBRARIES)
|
""
|
||||||
|
)
|
||||||
# BLAS in Alpha DXML library? (now called CXML, see above)
|
endif(NOT BLAS_LIBRARIES)
|
||||||
if(NOT BLAS_LIBRARIES)
|
endif (BLA_VENDOR STREQUAL "ATLAS" OR BLA_VENDOR STREQUAL "All")
|
||||||
check_fortran_libraries(
|
|
||||||
BLAS_LIBRARIES
|
# BLAS in PhiPACK libraries? (requires generic BLAS lib, too)
|
||||||
BLAS
|
if (BLA_VENDOR STREQUAL "PhiPACK" OR BLA_VENDOR STREQUAL "All")
|
||||||
sgemm
|
if(NOT BLAS_LIBRARIES)
|
||||||
""
|
check_fortran_libraries(
|
||||||
"dxml"
|
BLAS_LIBRARIES
|
||||||
)
|
BLAS
|
||||||
endif(NOT BLAS_LIBRARIES)
|
sgemm
|
||||||
|
""
|
||||||
# BLAS in Sun Performance library?
|
"sgemm;dgemm;blas"
|
||||||
if(NOT BLAS_LIBRARIES)
|
""
|
||||||
check_fortran_libraries(
|
)
|
||||||
BLAS_LIBRARIES
|
endif(NOT BLAS_LIBRARIES)
|
||||||
BLAS
|
endif (BLA_VENDOR STREQUAL "PhiPACK" OR BLA_VENDOR STREQUAL "All")
|
||||||
sgemm
|
|
||||||
"-xlic_lib=sunperf"
|
# BLAS in Alpha CXML library?
|
||||||
"sunperf;sunmath"
|
if (BLA_VENDOR STREQUAL "CXML" OR BLA_VENDOR STREQUAL "All")
|
||||||
)
|
if(NOT BLAS_LIBRARIES)
|
||||||
if(BLAS_LIBRARIES)
|
check_fortran_libraries(
|
||||||
set(BLAS_LINKER_FLAGS "-xlic_lib=sunperf")
|
BLAS_LIBRARIES
|
||||||
endif(BLAS_LIBRARIES)
|
BLAS
|
||||||
|
sgemm
|
||||||
endif(NOT BLAS_LIBRARIES)
|
""
|
||||||
|
"cxml"
|
||||||
# BLAS in SCSL library? (SGI/Cray Scientific Library)
|
""
|
||||||
if(NOT BLAS_LIBRARIES)
|
)
|
||||||
check_fortran_libraries(
|
endif(NOT BLAS_LIBRARIES)
|
||||||
BLAS_LIBRARIES
|
endif (BLA_VENDOR STREQUAL "CXML" OR BLA_VENDOR STREQUAL "All")
|
||||||
BLAS
|
|
||||||
sgemm
|
# BLAS in Alpha DXML library? (now called CXML, see above)
|
||||||
""
|
if (BLA_VENDOR STREQUAL "DXML" OR BLA_VENDOR STREQUAL "All")
|
||||||
"scsl"
|
if(NOT BLAS_LIBRARIES)
|
||||||
)
|
check_fortran_libraries(
|
||||||
endif(NOT BLAS_LIBRARIES)
|
BLAS_LIBRARIES
|
||||||
|
BLAS
|
||||||
# BLAS in SGIMATH library?
|
sgemm
|
||||||
if(NOT BLAS_LIBRARIES)
|
""
|
||||||
check_fortran_libraries(
|
"dxml"
|
||||||
BLAS_LIBRARIES
|
""
|
||||||
BLAS
|
)
|
||||||
sgemm
|
endif(NOT BLAS_LIBRARIES)
|
||||||
""
|
endif (BLA_VENDOR STREQUAL "DXML" OR BLA_VENDOR STREQUAL "All")
|
||||||
"complib.sgimath"
|
|
||||||
)
|
# BLAS in Sun Performance library?
|
||||||
endif(NOT BLAS_LIBRARIES)
|
if (BLA_VENDOR STREQUAL "SunPerf" OR BLA_VENDOR STREQUAL "All")
|
||||||
|
if(NOT BLAS_LIBRARIES)
|
||||||
# BLAS in IBM ESSL library? (requires generic BLAS lib, too)
|
check_fortran_libraries(
|
||||||
if(NOT BLAS_LIBRARIES)
|
BLAS_LIBRARIES
|
||||||
check_fortran_libraries(
|
BLAS
|
||||||
BLAS_LIBRARIES
|
sgemm
|
||||||
BLAS
|
"-xlic_lib=sunperf"
|
||||||
sgemm
|
"sunperf;sunmath"
|
||||||
""
|
""
|
||||||
"essl;blas"
|
)
|
||||||
)
|
if(BLAS_LIBRARIES)
|
||||||
endif(NOT BLAS_LIBRARIES)
|
set(BLAS_LINKER_FLAGS "-xlic_lib=sunperf")
|
||||||
|
endif(BLAS_LIBRARIES)
|
||||||
|
endif(NOT BLAS_LIBRARIES)
|
||||||
|
endif (BLA_VENDOR STREQUAL "SunPerf" OR BLA_VENDOR STREQUAL "All")
|
||||||
|
|
||||||
#BLAS in intel mkl 10 library? (em64t 64bit)
|
# BLAS in SCSL library? (SGI/Cray Scientific Library)
|
||||||
if(NOT BLAS_LIBRARIES)
|
if (BLA_VENDOR STREQUAL "SCSL" OR BLA_VENDOR STREQUAL "All")
|
||||||
check_fortran_libraries(
|
if(NOT BLAS_LIBRARIES)
|
||||||
BLAS_LIBRARIES
|
check_fortran_libraries(
|
||||||
BLAS
|
BLAS_LIBRARIES
|
||||||
sgemm
|
BLAS
|
||||||
""
|
sgemm
|
||||||
"mkl_intel_lp64;mkl_intel_thread;mkl_core;guide;pthread"
|
""
|
||||||
)
|
"scsl"
|
||||||
endif(NOT BLAS_LIBRARIES)
|
""
|
||||||
if(NOT BLAS95_LIBRARIES)
|
)
|
||||||
check_fortran_libraries(
|
endif(NOT BLAS_LIBRARIES)
|
||||||
BLAS95_LIBRARIES
|
endif (BLA_VENDOR STREQUAL "SCSL" OR BLA_VENDOR STREQUAL "All")
|
||||||
BLAS
|
|
||||||
sgemm
|
# BLAS in SGIMATH library?
|
||||||
""
|
if (BLA_VENDOR STREQUAL "SGIMATH" OR BLA_VENDOR STREQUAL "All")
|
||||||
"mkl_blas95;mkl_intel_lp64;mkl_intel_thread;mkl_core;guide;pthread"
|
if(NOT BLAS_LIBRARIES)
|
||||||
)
|
check_fortran_libraries(
|
||||||
endif(NOT BLAS95_LIBRARIES)
|
BLAS_LIBRARIES
|
||||||
|
BLAS
|
||||||
### windows version of intel mkl 10
|
sgemm
|
||||||
|
""
|
||||||
if(NOT BLAS_LIBRARIES)
|
"complib.sgimath"
|
||||||
check_fortran_libraries(
|
""
|
||||||
BLAS_LIBRARIES
|
)
|
||||||
BLAS
|
endif(NOT BLAS_LIBRARIES)
|
||||||
SGEMM
|
endif (BLA_VENDOR STREQUAL "SGIMATH" OR BLA_VENDOR STREQUAL "All")
|
||||||
""
|
|
||||||
"mkl_c_dll;mkl_intel_thread_dll;mkl_core_dll;libguide40"
|
# BLAS in IBM ESSL library? (requires generic BLAS lib, too)
|
||||||
)
|
if (BLA_VENDOR STREQUAL "IBMESSL" OR BLA_VENDOR STREQUAL "All")
|
||||||
endif(NOT BLAS_LIBRARIES)
|
if(NOT BLAS_LIBRARIES)
|
||||||
|
check_fortran_libraries(
|
||||||
if(NOT BLAS95_LIBRARIES)
|
BLAS_LIBRARIES
|
||||||
check_fortran_libraries(
|
BLAS
|
||||||
BLAS95_LIBRARIES
|
sgemm
|
||||||
BLAS
|
""
|
||||||
sgemm
|
"essl;blas"
|
||||||
""
|
""
|
||||||
"mkl_blas95;mkl_intel_c;mkl_intel_thread;mkl_core;libguide40"
|
)
|
||||||
)
|
endif(NOT BLAS_LIBRARIES)
|
||||||
endif(NOT BLAS95_LIBRARIES)
|
endif (BLA_VENDOR STREQUAL "IBMESSL" OR BLA_VENDOR STREQUAL "All")
|
||||||
|
|
||||||
|
#BLAS in acml library?
|
||||||
# linux 32 bit
|
if (BLA_VENDOR STREQUAL "ACML" OR BLA_VENDOR STREQUAL "All")
|
||||||
if(NOT BLAS95_LIBRARIES)
|
if(NOT BLAS_LIBRARIES)
|
||||||
check_fortran_libraries(
|
check_fortran_libraries(
|
||||||
BLAS95_LIBRARIES
|
BLAS_LIBRARIES
|
||||||
BLAS
|
BLAS
|
||||||
sgemm
|
sgemm
|
||||||
""
|
""
|
||||||
"mkl_blas95;mkl_intel;mkl_intel_thread;mkl_core;guide;pthread"
|
"acml"
|
||||||
)
|
""
|
||||||
endif(NOT BLAS95_LIBRARIES)
|
)
|
||||||
|
endif(NOT BLAS_LIBRARIES)
|
||||||
|
endif (BLA_VENDOR STREQUAL "ACML" OR BLA_VENDOR STREQUAL "All")
|
||||||
#older vesions of intel mkl libs
|
|
||||||
|
# Apple BLAS library?
|
||||||
# BLAS in intel mkl library? (shared)
|
if (BLA_VENDOR STREQUAL "Apple" OR BLA_VENDOR STREQUAL "All")
|
||||||
if(NOT BLAS_LIBRARIES)
|
if(NOT BLAS_LIBRARIES)
|
||||||
check_fortran_libraries(
|
check_fortran_libraries(
|
||||||
BLAS_LIBRARIES
|
BLAS_LIBRARIES
|
||||||
BLAS
|
BLAS
|
||||||
sgemm
|
cblas_dgemm
|
||||||
""
|
""
|
||||||
"mkl;guide;pthread"
|
"Accelerate"
|
||||||
)
|
""
|
||||||
endif(NOT BLAS_LIBRARIES)
|
)
|
||||||
|
endif(NOT BLAS_LIBRARIES)
|
||||||
|
endif (BLA_VENDOR STREQUAL "Apple" OR BLA_VENDOR STREQUAL "All")
|
||||||
#BLAS in intel mkl library? (static, 32bit)
|
|
||||||
if(NOT BLAS_LIBRARIES)
|
if (BLA_VENDOR STREQUAL "NAS" OR BLA_VENDOR STREQUAL "All")
|
||||||
check_fortran_libraries(
|
if ( NOT BLAS_LIBRARIES )
|
||||||
BLAS_LIBRARIES
|
check_fortran_libraries(
|
||||||
BLAS
|
BLAS_LIBRARIES
|
||||||
sgemm
|
BLAS
|
||||||
""
|
cblas_dgemm
|
||||||
"mkl_ia32;guide;pthread"
|
""
|
||||||
)
|
"vecLib"
|
||||||
endif(NOT BLAS_LIBRARIES)
|
""
|
||||||
|
)
|
||||||
#BLAS in intel mkl library? (static, em64t 64bit)
|
endif ( NOT BLAS_LIBRARIES )
|
||||||
if(NOT BLAS_LIBRARIES)
|
endif (BLA_VENDOR STREQUAL "NAS" OR BLA_VENDOR STREQUAL "All")
|
||||||
check_fortran_libraries(
|
# Generic BLAS library?
|
||||||
BLAS_LIBRARIES
|
if (BLA_VENDOR STREQUAL "Generic" OR BLA_VENDOR STREQUAL "All")
|
||||||
BLAS
|
if(NOT BLAS_LIBRARIES)
|
||||||
sgemm
|
check_fortran_libraries(
|
||||||
""
|
BLAS_LIBRARIES
|
||||||
"mkl_em64t;guide;pthread"
|
BLAS
|
||||||
)
|
sgemm
|
||||||
endif(NOT BLAS_LIBRARIES)
|
""
|
||||||
|
"blas"
|
||||||
|
""
|
||||||
#BLAS in acml library?
|
)
|
||||||
if(NOT BLAS_LIBRARIES)
|
endif(NOT BLAS_LIBRARIES)
|
||||||
check_fortran_libraries(
|
endif (BLA_VENDOR STREQUAL "Generic" OR BLA_VENDOR STREQUAL "All")
|
||||||
BLAS_LIBRARIES
|
|
||||||
BLAS
|
#BLAS in intel mkl 10 library? (em64t 64bit)
|
||||||
sgemm
|
if (BLA_VENDOR MATCHES "Intel*" OR BLA_VENDOR STREQUAL "All")
|
||||||
""
|
if (_LANGUAGES_ MATCHES C OR _LANGUAGES_ MATCHES CXX)
|
||||||
"acml"
|
if(BLAS_FIND_QUIETLY OR NOT BLAS_FIND_REQUIRED)
|
||||||
)
|
find_package(Threads)
|
||||||
endif(NOT BLAS_LIBRARIES)
|
else(BLAS_FIND_QUIETLY OR NOT BLAS_FIND_REQUIRED)
|
||||||
|
find_package(Threads REQUIRED)
|
||||||
# Apple BLAS library?
|
endif(BLAS_FIND_QUIETLY OR NOT BLAS_FIND_REQUIRED)
|
||||||
if(NOT BLAS_LIBRARIES)
|
if (WIN32)
|
||||||
check_fortran_libraries(
|
if(BLA_F95)
|
||||||
BLAS_LIBRARIES
|
if(NOT BLAS95_LIBRARIES)
|
||||||
BLAS
|
check_fortran_libraries(
|
||||||
cblas_dgemm
|
BLAS95_LIBRARIES
|
||||||
""
|
BLAS
|
||||||
"Accelerate"
|
sgemm
|
||||||
)
|
""
|
||||||
|
"mkl_blas95;mkl_intel_c;mkl_intel_thread;mkl_core;libguide40"
|
||||||
endif(NOT BLAS_LIBRARIES)
|
""
|
||||||
|
)
|
||||||
if ( NOT BLAS_LIBRARIES )
|
endif(NOT BLAS95_LIBRARIES)
|
||||||
check_fortran_libraries(
|
else(BLA_F95)
|
||||||
BLAS_LIBRARIES
|
if(NOT BLAS_LIBRARIES)
|
||||||
BLAS
|
check_fortran_libraries(
|
||||||
cblas_dgemm
|
BLAS_LIBRARIES
|
||||||
""
|
BLAS
|
||||||
"vecLib"
|
SGEMM
|
||||||
)
|
""
|
||||||
endif ( NOT BLAS_LIBRARIES )
|
"mkl_c_dll;mkl_intel_thread_dll;mkl_core_dll;libguide40"
|
||||||
|
""
|
||||||
|
)
|
||||||
# Generic BLAS library?
|
endif(NOT BLAS_LIBRARIES)
|
||||||
if(NOT BLAS_LIBRARIES)
|
endif(BLA_F95)
|
||||||
check_fortran_libraries(
|
else(WIN32)
|
||||||
BLAS_LIBRARIES
|
if (BLA_VENDOR STREQUAL "Intel10_32" OR BLA_VENDOR STREQUAL "All")
|
||||||
BLAS
|
if(BLA_F95)
|
||||||
sgemm
|
if(NOT BLAS95_LIBRARIES)
|
||||||
""
|
check_fortran_libraries(
|
||||||
"blas"
|
BLAS95_LIBRARIES
|
||||||
)
|
BLAS
|
||||||
endif(NOT BLAS_LIBRARIES)
|
sgemm
|
||||||
|
""
|
||||||
|
"mkl_blas95;mkl_intel;mkl_intel_thread;mkl_core;guide"
|
||||||
if(BLAS_LIBRARIES)
|
"${CMAKE_THREAD_LIBS_INIT}"
|
||||||
set(BLAS_FOUND TRUE)
|
)
|
||||||
else(BLAS_LIBRARIES)
|
endif(NOT BLAS95_LIBRARIES)
|
||||||
set(BLAS_FOUND FALSE)
|
else(BLA_F95)
|
||||||
endif(BLAS_LIBRARIES)
|
if(NOT BLAS_LIBRARIES)
|
||||||
|
check_fortran_libraries(
|
||||||
if(NOT BLAS_FIND_QUIETLY)
|
BLAS_LIBRARIES
|
||||||
if(BLAS_FOUND)
|
BLAS
|
||||||
message(STATUS "A library with BLAS API found.")
|
sgemm
|
||||||
else(BLAS_FOUND)
|
""
|
||||||
if(BLAS_FIND_REQUIRED)
|
"mkl_intel;mkl_intel_thread;mkl_core;guide"
|
||||||
message(FATAL_ERROR
|
"${CMAKE_THREAD_LIBS_INIT}"
|
||||||
"A required library with BLAS API not found. Please specify library location."
|
)
|
||||||
)
|
endif(NOT BLAS_LIBRARIES)
|
||||||
else(BLAS_FIND_REQUIRED)
|
endif(BLA_F95)
|
||||||
message(STATUS
|
endif (BLA_VENDOR STREQUAL "Intel10_32" OR BLA_VENDOR STREQUAL "All")
|
||||||
"A library with BLAS API not found. Please specify library location."
|
if (BLA_VENDOR STREQUAL "Intel10_64lp" OR BLA_VENDOR STREQUAL "All")
|
||||||
)
|
if(BLA_F95)
|
||||||
endif(BLAS_FIND_REQUIRED)
|
if(NOT BLAS95_LIBRARIES)
|
||||||
endif(BLAS_FOUND)
|
check_fortran_libraries(
|
||||||
endif(NOT BLAS_FIND_QUIETLY)
|
BLAS95_LIBRARIES
|
||||||
|
BLAS
|
||||||
|
sgemm
|
||||||
|
""
|
||||||
|
"mkl_blas95;mkl_intel_lp64;mkl_intel_thread;mkl_core;guide"
|
||||||
|
"${CMAKE_THREAD_LIBS_INIT}"
|
||||||
|
)
|
||||||
|
endif(NOT BLAS95_LIBRARIES)
|
||||||
|
else(BLA_F95)
|
||||||
|
if(NOT BLAS_LIBRARIES)
|
||||||
|
check_fortran_libraries(
|
||||||
|
BLAS_LIBRARIES
|
||||||
|
BLAS
|
||||||
|
sgemm
|
||||||
|
""
|
||||||
|
"mkl_intel_lp64;mkl_intel_thread;mkl_core;guide"
|
||||||
|
"${CMAKE_THREAD_LIBS_INIT}"
|
||||||
|
)
|
||||||
|
endif(NOT BLAS_LIBRARIES)
|
||||||
|
endif(BLA_F95)
|
||||||
|
endif (BLA_VENDOR STREQUAL "Intel10_64lp" OR BLA_VENDOR STREQUAL "All")
|
||||||
|
endif (WIN32)
|
||||||
|
#older vesions of intel mkl libs
|
||||||
|
# BLAS in intel mkl library? (shared)
|
||||||
|
if(NOT BLAS_LIBRARIES)
|
||||||
|
check_fortran_libraries(
|
||||||
|
BLAS_LIBRARIES
|
||||||
|
BLAS
|
||||||
|
sgemm
|
||||||
|
""
|
||||||
|
"mkl;guide"
|
||||||
|
"${CMAKE_THREAD_LIBS_INIT}"
|
||||||
|
)
|
||||||
|
endif(NOT BLAS_LIBRARIES)
|
||||||
|
#BLAS in intel mkl library? (static, 32bit)
|
||||||
|
if(NOT BLAS_LIBRARIES)
|
||||||
|
check_fortran_libraries(
|
||||||
|
BLAS_LIBRARIES
|
||||||
|
BLAS
|
||||||
|
sgemm
|
||||||
|
""
|
||||||
|
"mkl_ia32;guide"
|
||||||
|
"${CMAKE_THREAD_LIBS_INIT}"
|
||||||
|
)
|
||||||
|
endif(NOT BLAS_LIBRARIES)
|
||||||
|
#BLAS in intel mkl library? (static, em64t 64bit)
|
||||||
|
if(NOT BLAS_LIBRARIES)
|
||||||
|
check_fortran_libraries(
|
||||||
|
BLAS_LIBRARIES
|
||||||
|
BLAS
|
||||||
|
sgemm
|
||||||
|
""
|
||||||
|
"mkl_em64t;guide"
|
||||||
|
"${CMAKE_THREAD_LIBS_INIT}"
|
||||||
|
)
|
||||||
|
endif(NOT BLAS_LIBRARIES)
|
||||||
|
endif (_LANGUAGES_ MATCHES C OR _LANGUAGES_ MATCHES CXX)
|
||||||
|
endif (BLA_VENDOR MATCHES "Intel*" OR BLA_VENDOR STREQUAL "All")
|
||||||
|
|
||||||
|
|
||||||
|
if(BLA_F95)
|
||||||
|
if(BLAS95_LIBRARIES)
|
||||||
|
set(BLAS95_FOUND TRUE)
|
||||||
|
else(BLAS95_LIBRARIES)
|
||||||
|
set(BLAS95_FOUND FALSE)
|
||||||
|
endif(BLAS95_LIBRARIES)
|
||||||
|
|
||||||
|
if(NOT BLAS_FIND_QUIETLY)
|
||||||
|
if(BLAS95_FOUND)
|
||||||
|
message(STATUS "A library with BLAS95 API found.")
|
||||||
|
else(BLAS95_FOUND)
|
||||||
|
if(BLAS_FIND_REQUIRED)
|
||||||
|
message(FATAL_ERROR
|
||||||
|
"A required library with BLAS95 API not found. Please specify library location.")
|
||||||
|
else(BLAS_FIND_REQUIRED)
|
||||||
|
message(STATUS
|
||||||
|
"A library with BLAS95 API not found. Please specify library location.")
|
||||||
|
endif(BLAS_FIND_REQUIRED)
|
||||||
|
endif(BLAS95_FOUND)
|
||||||
|
endif(NOT BLAS_FIND_QUIETLY)
|
||||||
|
set(BLAS_FOUND TRUE)
|
||||||
|
set(BLAS_LIBRARIES "${BLAS95_LIBRARIES}")
|
||||||
|
else(BLA_F95)
|
||||||
|
if(BLAS_LIBRARIES)
|
||||||
|
set(BLAS_FOUND TRUE)
|
||||||
|
else(BLAS_LIBRARIES)
|
||||||
|
set(BLAS_FOUND FALSE)
|
||||||
|
endif(BLAS_LIBRARIES)
|
||||||
|
|
||||||
|
if(NOT BLAS_FIND_QUIETLY)
|
||||||
|
if(BLAS_FOUND)
|
||||||
|
message(STATUS "A library with BLAS API found.")
|
||||||
|
else(BLAS_FOUND)
|
||||||
|
if(BLAS_FIND_REQUIRED)
|
||||||
|
message(FATAL_ERROR
|
||||||
|
"A required library with BLAS API not found. Please specify library location."
|
||||||
|
)
|
||||||
|
else(BLAS_FIND_REQUIRED)
|
||||||
|
message(STATUS
|
||||||
|
"A library with BLAS API not found. Please specify library location."
|
||||||
|
)
|
||||||
|
endif(BLAS_FIND_REQUIRED)
|
||||||
|
endif(BLAS_FOUND)
|
||||||
|
endif(NOT BLAS_FIND_QUIETLY)
|
||||||
|
endif(BLA_F95)
|
||||||
|
|
|
@ -1,211 +1,278 @@
|
||||||
# - Find a Fortran LAPACK library
|
# - Find LAPACK library
|
||||||
# N.B. Fortran only. This module cannot be used to find a C LAPACK library.
|
# This module finds an installed fortran library that implements the LAPACK
|
||||||
# This module finds an installed fortran library that implements the LAPACK
|
# linear-algebra interface (see http://www.netlib.org/lapack/).
|
||||||
# linear-algebra interface (see http://www.netlib.org/lapack/).
|
#
|
||||||
#
|
# The approach follows that taken for the autoconf macro file, acx_lapack.m4
|
||||||
# The approach follows that taken for the autoconf macro file, acx_lapack.m4
|
# (distributed at http://ac-archive.sourceforge.net/ac-archive/acx_lapack.html).
|
||||||
# (distributed at http://ac-archive.sourceforge.net/ac-archive/acx_lapack.html).
|
#
|
||||||
#
|
# This module sets the following variables:
|
||||||
# This module sets the following variables:
|
# LAPACK_FOUND - set to true if a library implementing the LAPACK interface
|
||||||
# LAPACK_FOUND - set to true if a library implementing the LAPACK interface
|
# is found
|
||||||
# is found
|
# LAPACK_LINKER_FLAGS - uncached list of required linker flags (excluding -l
|
||||||
# LAPACK_LINKER_FLAGS - uncached list of required linker flags (excluding -l
|
# and -L).
|
||||||
# and -L).
|
# LAPACK_LIBRARIES - uncached list of libraries (using full path name) to
|
||||||
# LAPACK_LIBRARIES - uncached list of libraries (using full path name) to
|
# link against to use LAPACK
|
||||||
# link against to use LAPACK
|
# LAPACK95_LIBRARIES - uncached list of libraries (using full path name) to
|
||||||
# LAPACK95_LIBRARIES - uncached list of libraries (using full path name) to
|
# link against to use LAPACK95
|
||||||
# link against to use LAPACK95
|
# LAPACK95_FOUND - set to true if a library implementing the LAPACK f95
|
||||||
|
# interface is found
|
||||||
#
|
# BLA_STATIC if set on this determines what kind of linkage we do (static)
|
||||||
|
# BLA_VENDOR if set checks only the specified vendor, if not set checks
|
||||||
get_property(_LANGUAGES_ GLOBAL PROPERTY ENABLED_LANGUAGES)
|
# all the posibilities
|
||||||
if(NOT _LANGUAGES_ MATCHES Fortran)
|
# BLA_F95 if set on tries to find the f95 interfaces for BLAS/LAPACK
|
||||||
if(LAPACK_FIND_REQUIRED)
|
### List of vendors (BLA_VENDOR) valid in this module
|
||||||
message(FATAL_ERROR
|
## Intel(mkl), ACML,Apple, NAS, Generic
|
||||||
"FindLAPACK is Fortran-only so Fortran must be enabled.")
|
get_property(_LANGUAGES_ GLOBAL PROPERTY ENABLED_LANGUAGES)
|
||||||
else(LAPACK_FIND_REQUIRED)
|
if(NOT _LANGUAGES_ MATCHES Fortran)
|
||||||
message(STATUS "Looking for LAPACK... - NOT found (Fortran not enabled)")
|
if(LAPACK_FIND_REQUIRED)
|
||||||
return()
|
message(FATAL_ERROR
|
||||||
endif(LAPACK_FIND_REQUIRED)
|
"FindLAPACK is Fortran-only so Fortran must be enabled.")
|
||||||
endif(NOT _LANGUAGES_ MATCHES Fortran)
|
else(LAPACK_FIND_REQUIRED)
|
||||||
|
message(STATUS "Looking for LAPACK... - NOT found (Fortran not enabled)")
|
||||||
include(CheckFortranFunctionExists)
|
return()
|
||||||
set(LAPACK_FOUND FALSE)
|
endif(LAPACK_FIND_REQUIRED)
|
||||||
|
endif(NOT _LANGUAGES_ MATCHES Fortran)
|
||||||
macro(Check_Lapack_Libraries LIBRARIES _prefix _name _flags _list _blas)
|
|
||||||
# This macro checks for the existence of the combination of fortran libraries
|
include(CheckFortranFunctionExists)
|
||||||
# given by _list. If the combination is found, this macro checks (using the
|
set(LAPACK_FOUND FALSE)
|
||||||
# Check_Fortran_Function_Exists macro) whether can link against that library
|
set(LAPACK95_FOUND FALSE)
|
||||||
# combination using the name of a routine given by _name using the linker
|
|
||||||
# flags given by _flags. If the combination of libraries is found and passes
|
macro(Check_Lapack_Libraries LIBRARIES _prefix _name _flags _list _blas _threads)
|
||||||
# the link test, LIBRARIES is set to the list of complete library paths that
|
# This macro checks for the existence of the combination of fortran libraries
|
||||||
# have been found. Otherwise, LIBRARIES is set to FALSE.
|
# given by _list. If the combination is found, this macro checks (using the
|
||||||
|
# Check_Fortran_Function_Exists macro) whether can link against that library
|
||||||
# N.B. _prefix is the prefix applied to the names of all cached variables that
|
# combination using the name of a routine given by _name using the linker
|
||||||
# are generated internally and marked advanced by this macro.
|
# flags given by _flags. If the combination of libraries is found and passes
|
||||||
|
# the link test, LIBRARIES is set to the list of complete library paths that
|
||||||
set(_libraries_work TRUE)
|
# have been found. Otherwise, LIBRARIES is set to FALSE.
|
||||||
set(${LIBRARIES})
|
|
||||||
set(_combined_name)
|
# N.B. _prefix is the prefix applied to the names of all cached variables that
|
||||||
foreach(_library ${_list})
|
# are generated internally and marked advanced by this macro.
|
||||||
set(_combined_name ${_combined_name}_${_library})
|
|
||||||
|
set(_libraries_work TRUE)
|
||||||
if(_libraries_work)
|
set(${LIBRARIES})
|
||||||
IF (WIN32)
|
set(_combined_name)
|
||||||
find_library(${_prefix}_${_library}_LIBRARY
|
foreach(_library ${_list})
|
||||||
NAMES ${_library}
|
set(_combined_name ${_combined_name}_${_library})
|
||||||
PATHS ENV LIB
|
|
||||||
)
|
if(_libraries_work)
|
||||||
ENDIF (WIN32)
|
IF (WIN32)
|
||||||
|
if(BLA_STATIC)
|
||||||
if(APPLE)
|
set(CMAKE_FIND_LIBRARY_SUFFIXES ".lib;.dll")
|
||||||
find_library(${_prefix}_${_library}_LIBRARY
|
endif(BLA_STATIC)
|
||||||
NAMES ${_library}
|
find_library(${_prefix}_${_library}_LIBRARY
|
||||||
PATHS /usr/local/lib /usr/lib /usr/local/lib64 /usr/lib64 ENV DYLD_LIBRARY_PATH
|
NAMES ${_library}
|
||||||
)
|
PATHS ENV LIB
|
||||||
else(APPLE)
|
)
|
||||||
find_library(${_prefix}_${_library}_LIBRARY
|
ENDIF (WIN32)
|
||||||
NAMES ${_library}
|
|
||||||
PATHS /usr/local/lib /usr/lib /usr/local/lib64 /usr/lib64 ENV LD_LIBRARY_PATH
|
if(APPLE)
|
||||||
)
|
if(BLA_STATIC)
|
||||||
endif(APPLE)
|
set(CMAKE_FIND_LIBRARY_SUFFIXES ".a;.so;.dylib")
|
||||||
|
endif(BLA_STATIC)
|
||||||
mark_as_advanced(${_prefix}_${_library}_LIBRARY)
|
find_library(${_prefix}_${_library}_LIBRARY
|
||||||
set(${LIBRARIES} ${${LIBRARIES}} ${${_prefix}_${_library}_LIBRARY})
|
NAMES ${_library}
|
||||||
set(_libraries_work ${${_prefix}_${_library}_LIBRARY})
|
PATHS /usr/local/lib /usr/lib /usr/local/lib64 /usr/lib64 ENV DYLD_LIBRARY_PATH
|
||||||
endif(_libraries_work)
|
)
|
||||||
endforeach(_library ${_list})
|
else(APPLE)
|
||||||
|
if(BLA_STATIC)
|
||||||
if(_libraries_work)
|
set(CMAKE_FIND_LIBRARY_SUFFIXES ".a;.so")
|
||||||
# Test this combination of libraries.
|
endif(BLA_STATIC)
|
||||||
set(CMAKE_REQUIRED_LIBRARIES ${_flags} ${${LIBRARIES}} ${_blas})
|
find_library(${_prefix}_${_library}_LIBRARY
|
||||||
#message("DEBUG: CMAKE_REQUIRED_LIBRARIES = ${CMAKE_REQUIRED_LIBRARIES}")
|
NAMES ${_library}
|
||||||
check_fortran_function_exists(${_name} ${_prefix}${_combined_name}_WORKS)
|
PATHS /usr/local/lib /usr/lib /usr/local/lib64 /usr/lib64 ENV LD_LIBRARY_PATH
|
||||||
set(CMAKE_REQUIRED_LIBRARIES)
|
)
|
||||||
mark_as_advanced(${_prefix}${_combined_name}_WORKS)
|
endif(APPLE)
|
||||||
set(_libraries_work ${${_prefix}${_combined_name}_WORKS})
|
|
||||||
#message("DEBUG: ${LIBRARIES} = ${${LIBRARIES}}")
|
mark_as_advanced(${_prefix}_${_library}_LIBRARY)
|
||||||
endif(_libraries_work)
|
set(${LIBRARIES} ${${LIBRARIES}} ${${_prefix}_${_library}_LIBRARY})
|
||||||
|
set(_libraries_work ${${_prefix}_${_library}_LIBRARY})
|
||||||
|
endif(_libraries_work)
|
||||||
if(_libraries_work)
|
endforeach(_library ${_list})
|
||||||
set(${LIBRARIES} ${${LIBRARIES}} ${_blas})
|
|
||||||
else(_libraries_work)
|
if(_libraries_work)
|
||||||
set(${LIBRARIES} FALSE)
|
# Test this combination of libraries.
|
||||||
endif(_libraries_work)
|
if(UNIX AND BLA_STATIC)
|
||||||
|
set(CMAKE_REQUIRED_LIBRARIES ${_flags} "-Wl,--start-group ${${LIBRARIES}} ${_blas};-Wl,--end-group" ${_threads})
|
||||||
endmacro(Check_Lapack_Libraries)
|
else(UNIX AND BLA_STATIC)
|
||||||
|
set(CMAKE_REQUIRED_LIBRARIES ${_flags} ${${LIBRARIES}} ${_blas} ${_threads})
|
||||||
|
endif(UNIX AND BLA_STATIC)
|
||||||
set(LAPACK_LINKER_FLAGS)
|
# message("DEBUG: CMAKE_REQUIRED_LIBRARIES = ${CMAKE_REQUIRED_LIBRARIES}")
|
||||||
set(LAPACK_LIBRARIES)
|
check_fortran_function_exists(${_name} ${_prefix}${_combined_name}_WORKS)
|
||||||
set(LAPACK95_LIBRARIES)
|
set(CMAKE_REQUIRED_LIBRARIES)
|
||||||
|
mark_as_advanced(${_prefix}${_combined_name}_WORKS)
|
||||||
|
set(_libraries_work ${${_prefix}${_combined_name}_WORKS})
|
||||||
if(LAPACK_FIND_QUIETLY OR NOT LAPACK_FIND_REQUIRED)
|
#message("DEBUG: ${LIBRARIES} = ${${LIBRARIES}}")
|
||||||
find_package(BLAS)
|
endif(_libraries_work)
|
||||||
else(LAPACK_FIND_QUIETLY OR NOT LAPACK_FIND_REQUIRED)
|
|
||||||
find_package(BLAS REQUIRED)
|
if(_libraries_work)
|
||||||
endif(LAPACK_FIND_QUIETLY OR NOT LAPACK_FIND_REQUIRED)
|
set(${LIBRARIES} ${${LIBRARIES}} ${_blas})
|
||||||
|
else(_libraries_work)
|
||||||
if(BLAS_FOUND)
|
set(${LIBRARIES} FALSE)
|
||||||
set(LAPACK_LINKER_FLAGS ${BLAS_LINKER_FLAGS})
|
endif(_libraries_work)
|
||||||
|
|
||||||
#intel lapack
|
endmacro(Check_Lapack_Libraries)
|
||||||
if(NOT LAPACK_LIBRARIES)
|
|
||||||
|
|
||||||
check_lapack_libraries(
|
set(LAPACK_LINKER_FLAGS)
|
||||||
LAPACK_LIBRARIES
|
set(LAPACK_LIBRARIES)
|
||||||
LAPACK
|
set(LAPACK95_LIBRARIES)
|
||||||
cheev
|
|
||||||
""
|
|
||||||
"mkl_lapack"
|
if(LAPACK_FIND_QUIETLY OR NOT LAPACK_FIND_REQUIRED)
|
||||||
"${BLAS_LIBRARIES}"
|
find_package(BLAS)
|
||||||
)
|
else(LAPACK_FIND_QUIETLY OR NOT LAPACK_FIND_REQUIRED)
|
||||||
endif(NOT LAPACK_LIBRARIES)
|
find_package(BLAS REQUIRED)
|
||||||
|
endif(LAPACK_FIND_QUIETLY OR NOT LAPACK_FIND_REQUIRED)
|
||||||
if(NOT LAPACK95_LIBRARIES)
|
|
||||||
check_lapack_libraries(
|
|
||||||
LAPACK95_LIBRARIES
|
if(BLAS_FOUND)
|
||||||
LAPACK
|
set(LAPACK_LINKER_FLAGS ${BLAS_LINKER_FLAGS})
|
||||||
cheev
|
if ($ENV{BLA_VENDOR} MATCHES ".+")
|
||||||
""
|
set(BLA_VENDOR $ENV{BLA_VENDOR})
|
||||||
"mkl_lapack95"
|
else ($ENV{BLA_VENDOR} MATCHES ".+")
|
||||||
"${BLAS_LIBRARIES}"
|
if(NOT BLA_VENDOR)
|
||||||
)
|
set(BLA_VENDOR "All")
|
||||||
endif(NOT LAPACK95_LIBRARIES)
|
endif(NOT BLA_VENDOR)
|
||||||
|
endif ($ENV{BLA_VENDOR} MATCHES ".+")
|
||||||
#acml lapack
|
#acml lapack
|
||||||
if(NOT LAPACK_LIBRARIES)
|
if (BLA_VENDOR STREQUAL "ACML" OR BLA_VENDOR STREQUAL "All")
|
||||||
|
if(NOT LAPACK_LIBRARIES)
|
||||||
check_lapack_libraries(
|
check_lapack_libraries(
|
||||||
LAPACK_LIBRARIES
|
LAPACK_LIBRARIES
|
||||||
LAPACK
|
LAPACK
|
||||||
cheev
|
cheev
|
||||||
""
|
""
|
||||||
"acml"
|
"acml"
|
||||||
"${BLAS_LIBRARIES}"
|
""
|
||||||
)
|
""
|
||||||
endif(NOT LAPACK_LIBRARIES)
|
)
|
||||||
|
endif(NOT LAPACK_LIBRARIES)
|
||||||
|
endif (BLA_VENDOR STREQUAL "ACML" OR BLA_VENDOR STREQUAL "All")
|
||||||
# Apple LAPACK library?
|
|
||||||
if(NOT LAPACK_LIBRARIES)
|
# Apple LAPACK library?
|
||||||
check_lapack_libraries(
|
if (BLA_VENDOR STREQUAL "Apple" OR BLA_VENDOR STREQUAL "All")
|
||||||
LAPACK_LIBRARIES
|
if(NOT LAPACK_LIBRARIES)
|
||||||
LAPACK
|
check_lapack_libraries(
|
||||||
cheev
|
LAPACK_LIBRARIES
|
||||||
""
|
LAPACK
|
||||||
"Accelerate"
|
cheev
|
||||||
"${BLAS_LIBRARIES}"
|
""
|
||||||
)
|
"Accelerate"
|
||||||
endif(NOT LAPACK_LIBRARIES)
|
"${BLAS_LIBRARIES}"
|
||||||
|
""
|
||||||
if ( NOT LAPACK_LIBRARIES )
|
)
|
||||||
check_lapack_libraries(
|
endif(NOT LAPACK_LIBRARIES)
|
||||||
LAPACK_LIBRARIES
|
endif (BLA_VENDOR STREQUAL "Apple" OR BLA_VENDOR STREQUAL "All")
|
||||||
LAPACK
|
if (BLA_VENDOR STREQUAL "NAS" OR BLA_VENDOR STREQUAL "All")
|
||||||
cheev
|
if ( NOT LAPACK_LIBRARIES )
|
||||||
""
|
check_lapack_libraries(
|
||||||
"vecLib"
|
LAPACK_LIBRARIES
|
||||||
"${BLAS_LIBRARIES}"
|
LAPACK
|
||||||
)
|
cheev
|
||||||
endif ( NOT LAPACK_LIBRARIES )
|
""
|
||||||
|
"vecLib"
|
||||||
# Generic LAPACK library?
|
"${BLAS_LIBRARIES}"
|
||||||
if ( NOT LAPACK_LIBRARIES )
|
""
|
||||||
check_lapack_libraries(
|
)
|
||||||
LAPACK_LIBRARIES
|
endif ( NOT LAPACK_LIBRARIES )
|
||||||
LAPACK
|
endif (BLA_VENDOR STREQUAL "NAS" OR BLA_VENDOR STREQUAL "All")
|
||||||
cheev
|
# Generic LAPACK library?
|
||||||
""
|
if (BLA_VENDOR STREQUAL "Generic" OR BLA_VENDOR STREQUAL "All")
|
||||||
"lapack"
|
if ( NOT LAPACK_LIBRARIES )
|
||||||
"${BLAS_LIBRARIES}"
|
check_lapack_libraries(
|
||||||
)
|
LAPACK_LIBRARIES
|
||||||
endif ( NOT LAPACK_LIBRARIES )
|
LAPACK
|
||||||
|
cheev
|
||||||
else(BLAS_FOUND)
|
""
|
||||||
message(STATUS "LAPACK requires BLAS")
|
"lapack"
|
||||||
endif(BLAS_FOUND)
|
"${BLAS_LIBRARIES}"
|
||||||
|
""
|
||||||
if(LAPACK_LIBRARIES)
|
)
|
||||||
set(LAPACK_FOUND TRUE)
|
endif ( NOT LAPACK_LIBRARIES )
|
||||||
else(LAPACK_LIBRARIES)
|
endif (BLA_VENDOR STREQUAL "Generic" OR BLA_VENDOR STREQUAL "All")
|
||||||
set(LAPACK_FOUND FALSE)
|
#intel lapack
|
||||||
endif(LAPACK_LIBRARIES)
|
if (BLA_VENDOR MATCHES "Intel*" OR BLA_VENDOR STREQUAL "All")
|
||||||
|
if (_LANGUAGES_ MATCHES C OR _LANGUAGES_ MATCHES CXX)
|
||||||
if(NOT LAPACK_FIND_QUIETLY)
|
if(LAPACK_FIND_QUIETLY OR NOT LAPACK_FIND_REQUIRED)
|
||||||
if(LAPACK_FOUND)
|
find_PACKAGE(Threads)
|
||||||
message(STATUS "A library with LAPACK API found.")
|
else(LAPACK_FIND_QUIETLY OR NOT LAPACK_FIND_REQUIRED)
|
||||||
else(LAPACK_FOUND)
|
find_package(Threads REQUIRED)
|
||||||
if(LAPACK_FIND_REQUIRED)
|
endif(LAPACK_FIND_QUIETLY OR NOT LAPACK_FIND_REQUIRED)
|
||||||
message(FATAL_ERROR
|
if (BLA_F95)
|
||||||
"A required library with LAPACK API not found. Please specify library location."
|
if(NOT LAPACK95_LIBRARIES)
|
||||||
)
|
check_lapack_libraries(
|
||||||
else(LAPACK_FIND_REQUIRED)
|
LAPACK95_LIBRARIES
|
||||||
message(STATUS
|
LAPACK
|
||||||
"A library with LAPACK API not found. Please specify library location."
|
cheev
|
||||||
)
|
""
|
||||||
endif(LAPACK_FIND_REQUIRED)
|
"mkl_lapack95"
|
||||||
endif(LAPACK_FOUND)
|
"${BLAS95_LIBRARIES}"
|
||||||
endif(NOT LAPACK_FIND_QUIETLY)
|
"${CMAKE_THREAD_LIBS_INIT}"
|
||||||
|
)
|
||||||
|
endif(NOT LAPACK95_LIBRARIES)
|
||||||
|
else(BLA_F95)
|
||||||
|
if(NOT LAPACK_LIBRARIES)
|
||||||
|
check_lapack_libraries(
|
||||||
|
LAPACK_LIBRARIES
|
||||||
|
LAPACK
|
||||||
|
cheev
|
||||||
|
""
|
||||||
|
"mkl_lapack"
|
||||||
|
"${BLAS_LIBRARIES}"
|
||||||
|
"${CMAKE_THREAD_LIBS_INIT}"
|
||||||
|
)
|
||||||
|
endif(NOT LAPACK_LIBRARIES)
|
||||||
|
endif(BLA_F95)
|
||||||
|
endif (_LANGUAGES_ MATCHES C OR _LANGUAGES_ MATCHES CXX)
|
||||||
|
endif(BLA_VENDOR MATCHES "Intel*" OR BLA_VENDOR STREQUAL "All")
|
||||||
|
else(BLAS_FOUND)
|
||||||
|
message(STATUS "LAPACK requires BLAS")
|
||||||
|
endif(BLAS_FOUND)
|
||||||
|
|
||||||
|
if(BLA_F95)
|
||||||
|
if(LAPACK95_LIBRARIES)
|
||||||
|
set(LAPACK95_FOUND TRUE)
|
||||||
|
else(LAPACK95_LIBRARIES)
|
||||||
|
set(LAPACK95_FOUND FALSE)
|
||||||
|
endif(LAPACK95_LIBRARIES)
|
||||||
|
if(NOT LAPACK_FIND_QUIETLY)
|
||||||
|
if(LAPACK95_FOUND)
|
||||||
|
message(STATUS "A library with LAPACK95 API found.")
|
||||||
|
else(LAPACK95_FOUND)
|
||||||
|
if(LAPACK_FIND_REQUIRED)
|
||||||
|
message(FATAL_ERROR
|
||||||
|
"A required library with LAPACK95 API not found. Please specify library location."
|
||||||
|
)
|
||||||
|
else(LAPACK_FIND_REQUIRED)
|
||||||
|
message(STATUS
|
||||||
|
"A library with LAPACK95 API not found. Please specify library location."
|
||||||
|
)
|
||||||
|
endif(LAPACK_FIND_REQUIRED)
|
||||||
|
endif(LAPACK95_FOUND)
|
||||||
|
endif(NOT LAPACK_FIND_QUIETLY)
|
||||||
|
set(LAPACK_FOUND "${LAPACK95_FOUND}")
|
||||||
|
set(LAPACK_LIBRARIES "${LAPACK95_LIBRARIES}")
|
||||||
|
else(BLA_F95)
|
||||||
|
if(LAPACK_LIBRARIES)
|
||||||
|
set(LAPACK_FOUND TRUE)
|
||||||
|
else(LAPACK_LIBRARIES)
|
||||||
|
set(LAPACK_FOUND FALSE)
|
||||||
|
endif(LAPACK_LIBRARIES)
|
||||||
|
|
||||||
|
if(NOT LAPACK_FIND_QUIETLY)
|
||||||
|
if(LAPACK_FOUND)
|
||||||
|
message(STATUS "A library with LAPACK API found.")
|
||||||
|
else(LAPACK_FOUND)
|
||||||
|
if(LAPACK_FIND_REQUIRED)
|
||||||
|
message(FATAL_ERROR
|
||||||
|
"A required library with LAPACK API not found. Please specify library location."
|
||||||
|
)
|
||||||
|
else(LAPACK_FIND_REQUIRED)
|
||||||
|
message(STATUS
|
||||||
|
"A library with LAPACK API not found. Please specify library location."
|
||||||
|
)
|
||||||
|
endif(LAPACK_FIND_REQUIRED)
|
||||||
|
endif(LAPACK_FOUND)
|
||||||
|
endif(NOT LAPACK_FIND_QUIETLY)
|
||||||
|
endif(BLA_F95)
|
||||||
|
|
Loading…
Reference in New Issue