summaryrefslogtreecommitdiff
path: root/CMAKE
diff options
context:
space:
mode:
authorjulie <julielangou@users.noreply.github.com>2010-12-16 15:12:27 +0000
committerjulie <julielangou@users.noreply.github.com>2010-12-16 15:12:27 +0000
commit046375a08fef95e3946234f16b0d173199737fb7 (patch)
tree6e29f5e79c791787de7e113fb88d82b89e5bd54b /CMAKE
parent0d5645bfec753a636739e6177515f1b9a5d3da3e (diff)
downloadlapack-046375a08fef95e3946234f16b0d173199737fb7.tar.gz
lapack-046375a08fef95e3946234f16b0d173199737fb7.tar.bz2
lapack-046375a08fef95e3946234f16b0d173199737fb7.zip
1. Corrected the way linker flags from FindBLAS are being used
2. Changed LOOK_FOR_OPTIMIZED_BLAS to USE_OPTIMIZED_BLAS per CMake convention 3. Changed BLAS_VENDORS to use library names instead of manufacturer names: From: BLAS_VENDORS=AMD;IBM;INTEL;HP;SUN etc To: BLAS_VENDORS=ACML;ESSL;MKL;VECLIB;PERFLIB This seems to be a more intuitive interface 4. Added support for Intel MKL single dynamic library - Chuck Atkins (Kitware)
Diffstat (limited to 'CMAKE')
-rw-r--r--CMAKE/FindBLAS.cmake216
1 files changed, 114 insertions, 102 deletions
diff --git a/CMAKE/FindBLAS.cmake b/CMAKE/FindBLAS.cmake
index fd559dbe..6d02244b 100644
--- a/CMAKE/FindBLAS.cmake
+++ b/CMAKE/FindBLAS.cmake
@@ -6,56 +6,59 @@
# included FindBLAS.cmake module
#
# This module sets the following variables:
-# BLAS_FOUND - set to true if an appropriate BLAS library is found.
-# BLAS_LINKER_FLAGS - list of required linker flags for a given BLAS library
-# BLAS_LIBRARIES - list of libraries (using full path name) to link against
-# BLAS_STATIC - if set then static libraries will be searched for.
-# BLAS_VENDORS - A list of specific vendors to check for. if not set,
-# checks all known vendors.
-# BLAS_VENDORS_FOUND - A list of located BLAS vendors
+# BLAS_FOUND - set to true if an appropriate BLAS library is found.
+# BLAS_LINKER_FLAGS - list of required linker flags
+# BLAS_LIBRARIES - list of libraries (with paths) to link against
+# BLAS_STATIC - if set then static libraries will be searched for.
+# BLAS_VENDORS - A list of specific vendors implemented BLAS to check
+# for, if not set, checks all known vendors.
+# BLAS_VENDORS_FOUND - A list of located BLAS vendors
# BLAS_${VENDOR}_LIB_DIR - An additional library dir to search for:
-# Ex: BLAS_AMD_LIB_DIR=/opt/acml4.4.0/gfortran64/lib
-# BLAS_INTEL_LIB_DIR=/opt/intel/mkl/lib/intel64
+# Ex: BLAS_ACML_LIB_DIR=/opt/acml4.4.0/gfortran64/lib
+# BLAS_MKL_LP64_LIB_DIR=/opt/intel/mkl/lib/intel64
##########
#
# Valid values for the BLAS_VENDOR setting are:
-# AMD - Single threaded version of the AMD Core Math Library
-# AMD_MP - Multithreaded version of the AMD Core Math Library using OpenMP
-# See http://developer.amd.com/cpu/Libraries/acml
-# APPLE - Apple's Accelerate library
-# See http://developer.apple.com/performance/accelerateframework.html
-# ATLAS - Automatically Tuned Linear Algebra Software
-# See http://math-atlas.sourceforge.net/
-# GOTO - Goto BLAS v2
-# See http://www.tacc.utexas.edu/tacc-projects/gotoblas2
-# HP - HP's Math Library: VECLIB
-# HP_INT64 - HP's Math Library: VECLIB8 (64 bit integers)
-# See http://www.hp.com/go/mlib
-# IBM - IBM's Engineering and Scientific Subroutine Library
-# See http://www-03.ibm.com/systems/software/essl/
-# INTEL32 - Intel Math Kernel Library x86
-# INTEL64 - Intel Math Kernel Library x86_64
-# INTEL64_INT64 - Intel Math Kernel Library x86_64 (64 bit integers)
-# See http://software.intel.com/en-us/intel-mkl
-# NETLIB - Reference BLAS implementation
-# See http://www.netlib.org/blas
-# ORACLE - Oracle Performance Library (formerly Sun Performance Library)
-# See http://www.oracle.com/technetwork/server-storage/solarisstudio
-# SGI - SGI's Scientific Computing Software Library
-# See http://www.sgi.com/products/software/irix/scsl.html
-# SUN - Sun Performance Library (now Oracle)
-# See http://www.oracle.com/technetwork/server-storage/solarisstudio
+# ACML - Single threaded version of the AMD Core Math Library
+# ACML_MP - Multithreaded version of the AMD Core Math Library using OpenMP
+# See http://developer.amd.com/cpu/Libraries/acml
+# ACCELERATE - Apple's Accelerate library
+# See http://developer.apple.com/performance/accelerateframework
+# ATLAS - Automatically Tuned Linear Algebra Software
+# See http://math-atlas.sourceforge.net/
+# GOTO - Goto BLAS v2
+# See http://www.tacc.utexas.edu/tacc-projects/gotoblas2
+# GENERIC - Search for a generic libblas
+# VECLIB - HP's Math Library: VECLIB
+# VECLIB8 - HP's Math Library: VECLIB8 (64 bit integers)
+# See http://www.hp.com/go/mlib
+# ESSL - IBM's Engineering and Scientific Subroutine Library
+# ESSL_6464 - IBM's Engineering and Scientific Subroutine Library (int64)
+# ESSL_SMP - IBM's Engineering and Scientific Subroutine Library (smp)
+# ESSL_SMP_6464 - (smp + int64)
+# See http://www-03.ibm.com/systems/software/essl/
+# MKL - Intel Math Kernel Library (dynamic interface)
+# Use MKL_THREADING_LAYER and MKL_INTERFACE_LAYER environment vars
#
-# OTHER - Any other unsupported BLAS library
-# In order to specify other BLAS libraries, set the following:
-# BLAS_VENDORS = OTHER
-# BLAS_OTHER_LIB_NAMES = A list of libraries to link to
-# BLAS_OTHER_LIB_DIR = Search path for the libraries
-# Ex:
-# set(BLAS_VENDORS OTHER)
-# set(BLAS_OTHER_LIB_NAMES "my_blas;my_blas_support")
-# set(BLAS_OTHER_LIB_DIR /home/chuck/lib)
-# find_package(BLAS)
+# MKL_IA32 - Intel Math Kernel Library x86
+# MKL_LP64 - Intel Math Kernel Library emt64/ia64
+# MKL_ILP64 - Intel Math Kernel Library (emt64/ia64 + int64)
+# See http://software.intel.com/en-us/intel-mkl
+# PERFLIB - Oracle Performance Library (formerly Sun Performance Library)
+# See http://www.oracle.com/technetwork/server-storage/solarisstudio
+# SCCL - SGI's Scientific Computing Software Library
+# See http://www.sgi.com/products/software/irix/scsl.html
+#
+# OTHER - Any other unsupported BLAS library
+# In order to specify other BLAS libraries, set the following:
+# BLAS_VENDORS = OTHER
+# BLAS_OTHER_LIB_NAMES = A list of libraries to link to
+# BLAS_OTHER_LIB_DIR = Search path for the libraries
+# Ex:
+# set(BLAS_VENDORS OTHER)
+# set(BLAS_OTHER_LIB_NAMES "my_blas;my_blas_support")
+# set(BLAS_OTHER_LIB_DIR /home/chuck/lib)
+# find_package(BLAS)
#
#=============================================================================
# Author: Chuck Atkins
@@ -140,33 +143,18 @@ macro( _BLAS_LOCATE_AND_TEST __BLAS_VENDOR __BLAS_LIBNAMES __BLAS_FLAGS )
)
endforeach()
- if( BLAS_${__BLAS_VENDOR}_LIBRARIES )
+ if( BLAS_${__BLAS_VENDOR}_LIBRARIES OR __BLAS_LIBNAMES STREQUAL "" )
# Check the library as Fortran
set( BLAS_${__BLAS_VENDOR}_LINKER_FLAGS "${__BLAS_FLAGS}" )
- if( _CHECK_FORTRAN )
- set( CMAKE_REQUIRED_LIBRARIES ${BLAS_${__BLAS_VENDOR}_LIBRARIES} )
- set( CMAKE_Fortran_FLAGS_ORIG "${CMAKE_Fortran_FLAGS}" )
- set( CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} ${BLAS_${__BLAS_VENDOR}_LINKER_FLAGS}" )
- CHECK_FORTRAN_FUNCTION_EXISTS( "dgemm" BLAS_${__BLAS_VENDOR}_DGEMM )
- set( CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS_ORIG}" )
- unset( CMAKE_REQUIRED_LIBRARIES )
-
- # Check the library as C
- #else()
- # message( STATUS "Checking ${__BLAS_LIBNAME} for dgemm_" )
- # get_filename_component(
- # __BLAS_${VENDOR}_PATH
- # ${BLAS_${__BLAS_VENDOR}_LIBRARY}
- # PATH
- # )
- # CHECK_LIBRARY_EXISTS(
- # ${__BLAS_LIBNAME}
- # "dgemm_"
- # "${__BLAS_${VENDOR}_PATH}"
- # BLAS_${_BLAS_VENDOR}_DGEMM
- # )
+ set( CMAKE_REQUIRED_LIBRARIES "${BLAS_${__BLAS_VENDOR}_LIBRARIES}")
+ if( BLAS_${__BLAS_VENDOR}_LINKER_FLAGS )
+ set( CMAKE_REQUIRED_LIBRARIES
+ "${BLAS_${__BLAS_VENDOR}_LINKER_FLAGS} ${CMAKE_REQUIRED_LIBRARIES}")
endif()
+ CHECK_FORTRAN_FUNCTION_EXISTS( "dgemm" BLAS_${__BLAS_VENDOR}_DGEMM )
+ unset( CMAKE_REQUIRED_LIBRARIES )
+
if( BLAS_${__BLAS_VENDOR}_DGEMM )
set( BLAS_${__BLAS_VENDOR}_FOUND TRUE )
endif()
@@ -175,7 +163,10 @@ endmacro()
# Loop through the BLAS vendors looking for specific libraries
if( NOT BLAS_VENDORS )
- set( BLAS_VENDORS AMD AMD_MP ACCELERATE ATLAS GOTO VECLIB VECLIB8 IBM INTEL32 INTEL64 INTEL64_INT64 PRE-INSTALLED SGI SUN)
+ # If not specified, we will search through the list of known suppliers
+ # Note that for libs that contains both 4 and 8 byte int versions, only the
+ # 4 byte versions are searched for.
+ set( BLAS_VENDORS ACML ACCELERATE ATLAS GOTO VECLIB ESSL MKL PERFLIB SCCL GENERIC)
endif()
set( BLAS_VENDORS_FOUND )
foreach( _BLAS_VENDOR ${BLAS_VENDORS} )
@@ -193,12 +184,12 @@ foreach( _BLAS_VENDOR ${BLAS_VENDORS} )
)
# Single threaded ACML
- elseif( _BLAS_VENDOR STREQUAL "AMD" )
+ elseif( _BLAS_VENDOR STREQUAL "ACML" )
message( STATUS "FindBLAS: Searching for AMD ACML" )
_BLAS_LOCATE_AND_TEST( ${_BLAS_VENDOR} "acml" "" )
# Multithreaded threaded ACML
- elseif( _BLAS_VENDOR STREQUAL "AMD_MP" )
+ elseif( _BLAS_VENDOR STREQUAL "ACML_MP" )
message( STATUS "FindBLAS: Searching for AMD ACML MP" )
_BLAS_LOCATE_AND_TEST( ${_BLAS_VENDOR} "acml_mp" "" )
@@ -230,78 +221,99 @@ foreach( _BLAS_VENDOR ${BLAS_VENDORS} )
_BLAS_LOCATE_AND_TEST( ${_BLAS_VENDOR} "veclib8" "" )
# IBM ESSL
- elseif( _BLAS_VENDOR STREQUAL "IBM" )
+ elseif( _BLAS_VENDOR STREQUAL "ESSL" )
message( STATUS "FindBLAS: Searching for IBM ESSL" )
_BLAS_LOCATE_AND_TEST( ${_BLAS_VENDOR} "essl" "" )
- # IBM ESSL
- elseif( _BLAS_VENDOR STREQUAL "IBM_INT64" )
- message( STATUS "FindBLAS: Searching for IBM ESSL int64" )
- _BLAS_LOCATE_AND_TEST( ${_BLAS_VENDOR} "essl8" "" )
+ # IBM ESSL (SMP Version)
+ elseif( _BLAS_VENDOR STREQUAL "ESSL_SMP" )
+ message( STATUS "FindBLAS: Searching for IBM ESSL (SMP)" )
+ _BLAS_LOCATE_AND_TEST( ${_BLAS_VENDOR} "esslsmp" "" )
+
+ # IBM ESSL int64
+ elseif( _BLAS_VENDOR STREQUAL "ESSL_6464" )
+ message( STATUS "FindBLAS: Searching for IBM ESSL (int64)" )
+ _BLAS_LOCATE_AND_TEST( ${_BLAS_VENDOR} "essl6464" "" )
- # Intel MKL
- elseif( _BLAS_VENDOR STREQUAL "INTEL32" )
- message( STATUS "FindBLAS: Searching for Intel MKL" )
+ # IBM ESSL (SMP + int64)
+ elseif( _BLAS_VENDOR STREQUAL "ESSL_SMP_6464" )
+ message( STATUS "FindBLAS: Searching for IBM ESSL (SMP + int64)" )
+ _BLAS_LOCATE_AND_TEST( ${_BLAS_VENDOR} "esslsmp6464" "" )
+
+ # Intel MKL (dynamic)
+ elseif( _BLAS_VENDOR STREQUAL "MKL" )
+ message( STATUS "FindBLAS: Searching for Intel MKL (dynamic)" )
+ _BLAS_LOCATE_AND_TEST( ${_BLAS_VENDOR} "mkl_rt" "" )
+
+ # Intel MKL (x86)
+ elseif( _BLAS_VENDOR STREQUAL "MKL_IA32" )
+ message( STATUS "FindBLAS: Searching for Intel MKL (x86)" )
if( CMAKE_Fortran_COMPILER_ID STREQUAL "Intel" )
_BLAS_LOCATE_AND_TEST(
- ${_BLAS_VENDOR} "iomp5;mkl_core;mkl_intel_thread;mkl_intel_ia32" ""
+ ${_BLAS_VENDOR}
+ "mkl_intel;mkl_intel_thread;mkl_core;iomp5;pthread"
+ ""
)
elseif( CMAKE_Fortran_COMPILER_ID STREQUAL "PGI" )
_BLAS_LOCATE_AND_TEST(
- ${_BLAS_VENDOR} "pgmp;mkl_core;mkl_pgi_thread;mkl_intel_ia32" ""
+ ${_BLAS_VENDOR} "mkl_intel_ia32;mkl_pgi_thread;mkl_core;pgmp" ""
)
else() #if( CMAKE_Fortran_COMPILER_ID STREQUAL "GNU" )
_BLAS_LOCATE_AND_TEST(
- ${_BLAS_VENDOR} "mkl_core;mkl_gnu_thread;mkl_intel_ia32" "-fopenmp"
+ ${_BLAS_VENDOR} "mkl_intel_ia32;mkl_gnu_thread;mkl_core" "-fopenmp"
)
endif()
- # Intel MKL
- elseif( _BLAS_VENDOR STREQUAL "INTEL64" )
- message( STATUS "FindBLAS: Searching for Intel MKL" )
+ # Intel MKL (emt64 / ia64)
+ elseif( _BLAS_VENDOR STREQUAL "MKL_LP64" )
+ message( STATUS "FindBLAS: Searching for Intel MKL (emt64/ia64)" )
if( CMAKE_Fortran_COMPILER_ID STREQUAL "Intel" )
_BLAS_LOCATE_AND_TEST(
- ${_BLAS_VENDOR} "iomp5;mkl_core;mkl_intel_thread;mkl_intel_lp64" ""
+ ${_BLAS_VENDOR}
+ "mkl_intel_lp64;mkl_intel_thread;mkl_core;iomp5;pthread"
+ ""
)
elseif( CMAKE_Fortran_COMPILER_ID STREQUAL "PGI" )
_BLAS_LOCATE_AND_TEST(
- ${_BLAS_VENDOR} "pgmp;mkl_core;mkl_pgi_thread;mkl_intel_lp64" ""
- )
+ ${_BLAS_VENDOR} "mkl_intel_lp64;mkl_pgi_thread;mkl_core;pgmp" ""
+ )
else() #if( CMAKE_Fortran_COMPILER_ID STREQUAL "GNU" )
_BLAS_LOCATE_AND_TEST(
- ${_BLAS_VENDOR} "mkl_core;mkl_gnu_thread;mkl_intel_lp64" "-fopenmp"
- )
+ ${_BLAS_VENDOR} "mkl_intel_lp64;mkl_gnu_thread;mkl_core" "-fopenmp"
+ )
endif()
- # Intel MKL
- elseif( _BLAS_VENDOR STREQUAL "INTEL64_INT64" )
- message( STATUS "FindBLAS: Searching for Intel MKL int64" )
+ # Intel MKL (emt64/ia64 + int64)
+ elseif( _BLAS_VENDOR STREQUAL "MKL_ILP64" )
+ message( STATUS "FindBLAS: Searching for Intel MKL (emt64/ia64 + int64)" )
if( CMAKE_Fortran_COMPILER_ID STREQUAL "Intel" )
_BLAS_LOCATE_AND_TEST(
- ${_BLAS_VENDOR} "iomp5;mkl_core;mkl_intel_thread;mkl_intel_ilp64" ""
+ ${_BLAS_VENDOR}
+ "mkl_intel_ilp64;mkl_intel_thread;mkl_core;iomp5;pthread"
+ ""
)
elseif( CMAKE_Fortran_COMPILER_ID STREQUAL "PGI" )
_BLAS_LOCATE_AND_TEST(
- ${_BLAS_VENDOR} "pgmp;mkl_core;mkl_pgi_thread;mkl_intel_ilp64" ""
- )
+ ${_BLAS_VENDOR} "mkl_intel_ilp64;mkl_pgi_thread;mkl_core;pgmp" ""
+ )
else() #if( CMAKE_Fortran_COMPILER_ID STREQUAL "GNU" )
_BLAS_LOCATE_AND_TEST(
- ${_BLAS_VENDOR} "mkl_core;mkl_gnu_thread;mkl_intel_ilp64" "-fopenmp"
+ ${_BLAS_VENDOR} "mkl_intel_ilp64;mkl_gnu_thread;mkl_core" "-fopenmp"
)
endif()
- # Pre-installed BLAS
- elseif( _BLAS_VENDOR STREQUAL "PRE-INSTALLED" )
- message( STATUS "FindBLAS: Searching for pre-installed BLAS" )
+ # Generic BLAS
+ elseif( _BLAS_VENDOR STREQUAL "GENERIC" )
+ message( STATUS "FindBLAS: Searching for generic BLAS" )
_BLAS_LOCATE_AND_TEST( ${_BLAS_VENDOR} "blas" "" )
# SGI
- elseif( _BLAS_VENDOR STREQUAL "SGI" )
+ elseif( _BLAS_VENDOR STREQUAL "SCCL" )
message( STATUS "FindBLAS: Searching for SGI SCCL" )
_BLAS_LOCATE_AND_TEST( ${_BLAS_VENDOR} "sccl" "" )
# Sun / Oracle PerfLib
- elseif( (_BLAS_VENDOR STREQUAL "SUN") OR (_BLAS_VENDOR MATCHES "ORACLE") )
+ elseif( (_BLAS_VENDOR STREQUAL "PERFLIB") )
message( STATUS "FindBLAS: Searching for Sun PerfLib" )
_BLAS_LOCATE_AND_TEST( ${_BLAS_VENDOR} "perflib" "" )