aboutsummaryrefslogtreecommitdiff
path: root/CMAKE
diff options
context:
space:
mode:
authorjulie <julielangou@users.noreply.github.com>2010-12-30 22:14:10 +0000
committerjulie <julielangou@users.noreply.github.com>2010-12-30 22:14:10 +0000
commitc541fcd90981835c8ad1accd9e5e0fbeb1f65f03 (patch)
tree2b5d08b2945bc64f24a1df54060d4cd1a8791edc /CMAKE
parent3e21518c0e33aa5316e5ca4ba64955bc851b78c9 (diff)
1. Adjusted regex checks in CheckLAPACKCompilerFlags.cmake to be more compact
2. Added CheckFortranIntSize.cmake to auto-determine the default integer size 3. Added more auto-detection features using integer size and compiler checks in FindBLAS.cmake - Chuck Atkins (Kitware)
Diffstat (limited to 'CMAKE')
-rw-r--r--CMAKE/CheckFortranIntSize.cmake60
-rw-r--r--CMAKE/CheckLAPACKCompilerFlags.cmake15
-rw-r--r--CMAKE/FindBLAS.cmake342
3 files changed, 288 insertions, 129 deletions
diff --git a/CMAKE/CheckFortranIntSize.cmake b/CMAKE/CheckFortranIntSize.cmake
new file mode 100644
index 00000000..d575e2e8
--- /dev/null
+++ b/CMAKE/CheckFortranIntSize.cmake
@@ -0,0 +1,60 @@
+# This module perdorms several try-compiles to determine the default integer
+# size being used by the fortran compiler
+#
+# After execution, the following variable is set:
+#
+# SIZEOF_INTEGER - Number of bytes used to store the default integer type
+# Will be set to 1, 2, 4, 8 or 16 if successful, otherwise it
+# will be unset
+#
+#=============================================================================
+# Author: Chuck Atkins
+# Copyright 2010
+#=============================================================================
+
+macro( CHECK_FORTRAN_INT_SIZE )
+ if( NOT CMAKE_Fortran_COMPILER_SUPPORTS_F90 )
+ message( FATAL_ERROR "Type size tests require Fortran 90 support" )
+ endif()
+ if( NOT SIZEOF_INTEGER )
+ foreach( _TEST_SIZE 1 2 4 8 16 )
+ message( STATUS "Testing default integer*${_TEST_SIZE} - " )
+ set( _TEST_FILE ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/testFortranInteger${_TEST_SIZE}.f90 )
+ file( WRITE ${_TEST_FILE} "
+ module check_int_size
+ interface int_size
+ function int_size_${_TEST_SIZE}(a) result(int_size)
+ integer*${_TEST_SIZE} a
+ integer int_size
+ end function int_size_${_TEST_SIZE}
+ end interface
+ end module
+
+ program check_int_size_${_TEST_SIZE}
+ use check_int_size
+ integer a, b
+ a = 7
+ b = int_size(a)
+ end program
+
+ function int_size_${_TEST_SIZE}(a) result(int_size)
+ integer*4 a
+ int_size = 7
+ end function
+ ")
+ try_compile( SIZEOF_INTEGER ${CMAKE_BINARY_DIR} ${_TEST_FILE} )
+ if( SIZEOF_INTEGER )
+ message( STATUS "Testing default integer*${_TEST_SIZE} - found" )
+ set( SIZEOF_INTEGER ${_TEST_SIZE} CACHE INTERNAL "Size of the default INTEGER type" FORCE )
+ break()
+ else()
+ message( STATUS "Testing default integer*${_TEST_SIZE} - not found" )
+ endif()
+ endforeach()
+ endif()
+
+ if( NOT SIZEOF_INTEGER )
+ unset( SIZEOF_INTEGER )
+ endif()
+endmacro()
+
diff --git a/CMAKE/CheckLAPACKCompilerFlags.cmake b/CMAKE/CheckLAPACKCompilerFlags.cmake
index 6c5b53fb..b7b584bc 100644
--- a/CMAKE/CheckLAPACKCompilerFlags.cmake
+++ b/CMAKE/CheckLAPACKCompilerFlags.cmake
@@ -6,14 +6,7 @@
#
#=============================================================================
# Author: Chuck Atkins
-# Copyright 2010 Kitware, Inc.
-#
-# Distributed under the OSI-approved BSD License (the "License");
-# see accompanying file Copyright.txt for details.
-#
-# This software is distributed WITHOUT ANY WARRANTY; without even the
-# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
-# See the License for more information.
+# Copyright 2010
#=============================================================================
macro( CheckLAPACKCompilerFlags )
@@ -28,15 +21,14 @@ if( CMAKE_Fortran_COMPILER_ID STREQUAL "GNU" )
# Intel Fortran
elseif( CMAKE_Fortran_COMPILER_ID STREQUAL "Intel" )
- if( ("${CMAKE_Fortran_FLAGS}" MATCHES "[-/]fpe0") OR
- ("${CMAKE_Fortran_FLAGS}" MATCHES "[-/]fpe-all=0") )
+ if( "${CMAKE_Fortran_FLAGS}" MATCHES "[-/]fpe(-all=|)0" )
set( FPE_EXIT TRUE )
endif()
# SunPro F95
elseif( CMAKE_Fortran_COMPILER_ID STREQUAL "SunPro" )
if( ("${CMAKE_Fortran_FLAGS}" MATCHES "-ftrap=") AND
- NOT ("${CMAKE_Fortran_FLAGS}" MATCHES "-ftrap=%none") )
+ NOT ("${CMAKE_Fortran_FLAGS}" MATCHES "-ftrap=(%|)none") )
set( FPE_EXIT TRUE )
elseif( NOT (CMAKE_Fortran_FLAGS MATCHES "-ftrap=") )
message( STATUS "Disabling FPE trap handlers with -ftrap=%none" )
@@ -52,6 +44,7 @@ elseif( (CMAKE_Fortran_COMPILER_ID STREQUAL "VisualAge" ) OR # CMake 2.6
endif()
if( NOT ("${CMAKE_Fortran_FLAGS}" MATCHES "-qfixed") )
+ message( STATUS "Enabling fixed format F90/F95 with -qfixed" )
set( CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -qfixed"
CACHE STRING "Flags for Fortran compiler." FORCE )
endif()
diff --git a/CMAKE/FindBLAS.cmake b/CMAKE/FindBLAS.cmake
index 4c37e222..647abb4d 100644
--- a/CMAKE/FindBLAS.cmake
+++ b/CMAKE/FindBLAS.cmake
@@ -13,40 +13,45 @@
# 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_ACML_LIB_DIR=/opt/acml4.4.0/gfortran64/lib
-# BLAS_MKL_LP64_LIB_DIR=/opt/intel/mkl/lib/intel64
+#
+# Also, if set, will use these to guide it's library search:
+# BLAS_${VENDOR}_LIB_DIRS - An additional library dir to search for:
+# Ex:
+# BLAS_ACML_LIB_DIRS=/opt/acml4.4.0/gfortran64/lib
+# BLAS_MKL_LP64_LIB_DIRS=/opt/intel/mkl/lib/intel64
##########
#
# Valid values for the BLAS_VENDOR setting are:
# 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
-# ESSL6464 - IBM's Engineering and Scientific Subroutine Library (int64)
# ESSLSMP - IBM's Engineering and Scientific Subroutine Library (smp)
-# ESSLSMP6464 - (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
#
-# MKL_IA32 - Intel Math Kernel Library x86
-# MKL_LP64 - Intel Math Kernel Library emt64/ia64
-# MKL_ILP64 - Intel Math Kernel Library (emt64/ia64 + int64)
+# MKL_RT - Intel Math Kernel Library (dynamic runtime interface)
+# MKL_SEQ - Intel Math Kernel Library (sequential interface)
+# MKL - Intel Math Kernel Library (multi-threaded interface)
# See http://software.intel.com/en-us/intel-mkl
+#
# PERFLIB - Oracle Performance Library (formerly Sun Performance Library)
# SUNPERF - Oracle Performance Library (formerly Sun Performance Library)
# See http://www.oracle.com/technetwork/server-storage/solarisstudio
+#
# SCSL - SGI's Scientific Computing Software Library
# See http://www.sgi.com/products/software/irix/scsl.html
#
@@ -58,19 +63,12 @@
# Ex:
# set(BLAS_VENDORS OTHER)
# set(BLAS_OTHER_LIB_NAMES "my_blas;my_blas_support")
-# set(BLAS_OTHER_LIB_DIR /home/chuck/lib)
+# set(BLAS_OTHER_LIB_DIRS /home/chuck/lib)
# find_package(BLAS)
#
#=============================================================================
# Author: Chuck Atkins
-# Copyright 2010 Kitware, Inc.
-#
-# Distributed under the OSI-approved BSD License (the "License");
-# see accompanying file Copyright.txt for details.
-#
-# This software is distributed WITHOUT ANY WARRANTY; without even the
-# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
-# See the License for more information.
+# Copyright 2010
#=============================================================================
#
@@ -81,6 +79,7 @@ endif()
include( CheckFortranFunctionExists )
include( CheckLibraryExists )
+include( CheckFortranIntSize )
# Check the language being used
get_property( _LANGUAGES_ GLOBAL PROPERTY ENABLED_LANGUAGES )
@@ -124,6 +123,13 @@ else()
string( REPLACE ":" ";" _BLAS_EXTRA_LIB_DIRS "$ENV{LD_LIBRARY_PATH}" )
endif()
+# Determine the default integer size
+CHECK_FORTRAN_INT_SIZE()
+if( NOT SIZEOF_INTEGER )
+ message( WARNING "Unable to determine default integer size. Assuming integer*4" )
+ set( SIZEOF_INTEGER 4 )
+endif()
+
# Macro to locate a library and check for a specified symbol
macro( _BLAS_LOCATE_AND_TEST __BLAS_VENDOR __BLAS_LIBNAMES __BLAS_FLAGS )
set( BLAS_${__BLAS_VENDOR}_LIBRARIES )
@@ -131,7 +137,7 @@ macro( _BLAS_LOCATE_AND_TEST __BLAS_VENDOR __BLAS_LIBNAMES __BLAS_FLAGS )
message( STATUS "FindBLAS: Searching for ${__BLAS_VENDOR} ${__BLAS_LIBNAME} - " )
find_library( BLAS_${__BLAS_VENDOR}_${__BLAS_LIBNAME}_LIBRARY
NAMES ${__BLAS_LIBNAME}
- PATHS ${BLAS_${__BLAS_VENDOR}_LIB_DIR} ${_BLAS_EXTRA_LIB_DIRS}
+ PATHS ${BLAS_${__BLAS_VENDOR}_LIB_DIRS} ${_BLAS_EXTRA_LIB_DIRS}
)
message( STATUS "FindBLAS: Searching for ${__BLAS_VENDOR} ${__BLAS_LIBNAME} - ${BLAS_${__BLAS_VENDOR}_${__BLAS_LIBNAME}_LIBRARY}" )
if( NOT BLAS_${__BLAS_VENDOR}_${__BLAS_LIBNAME}_LIBRARY )
@@ -157,7 +163,12 @@ macro( _BLAS_LOCATE_AND_TEST __BLAS_VENDOR __BLAS_LIBNAMES __BLAS_FLAGS )
unset( CMAKE_REQUIRED_LIBRARIES )
if( BLAS_${__BLAS_VENDOR}_DGEMM )
- set( BLAS_${__BLAS_VENDOR}_FOUND TRUE )
+ set( BLAS_${__BLAS_VENDOR}_FOUND TRUE CACHE BOOL "Whether not the ${__BLAS_VENDOR} library was found and is usable" )
+ else()
+ unset( BLAS_${__BLAS_VENDOR}_DGEMM CACHE)
+ foreach( __BLAS_LIBNAME ${__BLAS_LIBNAMES} )
+ unset( BLAS_${__BLAS_VENDOR}_${__BLAS_LIBNAME}_LIBRARY CACHE)
+ endforeach()
endif()
endif()
endmacro()
@@ -165,9 +176,7 @@ endmacro()
# Loop through the BLAS vendors looking for specific libraries
if( NOT BLAS_VENDORS )
# 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 SCSL GENERIC)
+ set( BLAS_VENDORS ACML ACCELERATE ATLAS GOTO VECLIB ESSL MKL_RT SUNPERF SCSL GENERIC)
endif()
set( BLAS_VENDORS_FOUND )
foreach( _BLAS_VENDOR ${BLAS_VENDORS} )
@@ -184,22 +193,86 @@ foreach( _BLAS_VENDOR ${BLAS_VENDORS} )
"${BLAS_${_BLAS_VENDOR}_FLAGS}"
)
- # Single threaded ACML
- 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 "ACML_MP" )
- message( STATUS "FindBLAS: Searching for AMD ACML MP" )
- _BLAS_LOCATE_AND_TEST( ${_BLAS_VENDOR} "acml_mp" "" )
-
+ # AMD ACML
+ elseif( (_BLAS_VENDOR STREQUAL "ACML") OR (_BLAS_VENDOR STREQUAL "ACML_MP") )
+ if( ((_BLAS_VENDOR STREQUAL "ACML") AND (NOT BLAS_ACML_LIB_DIRS)) OR
+ ((_BLAS_VENDOR STREQUAL "ACML_MP") AND (NOT BLAS_ACML_MP_LIB_DIRS)) )
+ if( WIN32 )
+ file( GLOB _ACML_ROOT "C:/AMD/acml*/ACML-EULA.txt" )
+ else()
+ file( GLOB _ACML_ROOT "/opt/acml*/ACML-EULA.txt" )
+ endif()
+ if( _ACML_ROOT )
+ get_filename_component( _ACML_ROOT ${_ACML_ROOT} PATH )
+ if( SIZEOF_INTEGER EQUAL 8 )
+ set( _ACML_PATH_SUFFIX "_int64" )
+ else()
+ set( _ACML_PATH_SUFFIX "" )
+ endif()
+ if( CMAKE_Fortran_COMPILER_ID STREQUAL "Intel" )
+ set( _ACML_COMPILER32 "ifort32" )
+ set( _ACML_COMPILER64 "ifort64" )
+ elseif( CMAKE_Fortran_COMPILER_ID STREQUAL "SunPro" )
+ set( _ACML_COMPILER32 "sun32" )
+ set( _ACML_COMPILER64 "sun64" )
+ elseif( CMAKE_Fortran_COMPILER_ID STREQUAL "PGI" )
+ set( _ACML_COMPILER32 "pgi32" )
+ if( WIN32 )
+ set( _ACML_COMPILER64 "win64" )
+ else()
+ set( _ACML_COMPILER64 "pgi64" )
+ endif()
+ elseif( CMAKE_Fortran_COMPILER_ID STREQUAL "Open64" )
+ # 32 bit builds not supported on Open64 but for code simplicity
+ # We'll just use the same directory twice
+ set( _ACML_COMPILER32 "open64_64" )
+ set( _ACML_COMPILER64 "open64_64" )
+ elseif( CMAKE_Fortran_COMPILER_ID STREQUAL "NAG" )
+ set( _ACML_COMPILER32 "nag32" )
+ set( _ACML_COMPILER64 "nag64" )
+ else() #if( CMAKE_Fortran_COMPILER_ID STREQUAL "GNU" )
+ set( _ACML_COMPILER32 "gfortran32" )
+ set( _ACML_COMPILER64 "gfortran64" )
+ endif()
+
+ if( _BLAS_VENDOR STREQUAL "ACML_MP" )
+ set( _ACML_MP_LIB_DIRS
+ "${_ACML_ROOT}/${_ACML_COMPILER32}_mp${_ACML_PATH_SUFFIX}/lib"
+ "${_ACML_ROOT}/${_ACML_COMPILER64}_mp${_ACML_PATH_SUFFIX}/lib" )
+ else() #if( _BLAS_VENDOR STREQUAL "ACML" )
+ set( _ACML_LIB_DIRS
+ "${_ACML_ROOT}/${_ACML_COMPILER32}${_ACML_PATH_SUFFIX}/lib"
+ "${_ACML_ROOT}/${_ACML_COMPILER64}${_ACML_PATH_SUFFIX}/lib" )
+ endif()
+ endif()
+ endif()
+
+ if( _BLAS_VENDOR STREQUAL "ACML_MP" )
+ message( STATUS "FindBLAS: Searching for AMD ACML MP" )
+ foreach( BLAS_ACML_MP_LIB_DIRS ${_ACML_MP_LIB_DIRS} )
+ _BLAS_LOCATE_AND_TEST( ${_BLAS_VENDOR} "acml_mp" "" )
+ if( BLAS_${_BLAS_VENDOR}_FOUND )
+ break()
+ endif()
+ endforeach()
+ else() #if( _BLAS_VENDOR STREQUAL "ACML" )
+ message( STATUS "FindBLAS: Searching for AMD ACML" )
+ foreach( BLAS_ACML_LIB_DIRS ${_ACML_LIB_DIRS} )
+ _BLAS_LOCATE_AND_TEST( ${_BLAS_VENDOR} "acml" "" )
+ if( BLAS_${_BLAS_VENDOR}_FOUND )
+ break()
+ endif()
+ endforeach()
+ endif()
+
# Apple Accelerate
elseif( _BLAS_VENDOR STREQUAL "ACCELERATE" )
- message( STATUS "FindBLAS: Searching for Apple Accelerate" )
- _BLAS_LOCATE_AND_TEST(
- ${_BLAS_VENDOR} "Accelerate" "-framework Accelerate"
- )
+ if( APPLE )
+ message( STATUS "FindBLAS: Searching for Apple Accelerate" )
+ _BLAS_LOCATE_AND_TEST(
+ ${_BLAS_VENDOR} "Accelerate" "-framework Accelerate"
+ )
+ endif()
# ATLAS
elseif( _BLAS_VENDOR STREQUAL "ATLAS" )
@@ -213,96 +286,120 @@ foreach( _BLAS_VENDOR ${BLAS_VENDORS} )
# VECLIB
elseif( _BLAS_VENDOR STREQUAL "VECLIB" )
- message( STATUS "FindBLAS: Searching for VECLIB" )
- _BLAS_LOCATE_AND_TEST( ${_BLAS_VENDOR} "veclib" "" )
-
- # VECLIB8
- elseif( _BLAS_VENDOR STREQUAL "VECLIB8" )
- message( STATUS "FindBLAS: Searching for VECLIB8" )
- _BLAS_LOCATE_AND_TEST( ${_BLAS_VENDOR} "veclib8" "" )
+ if( NOT APPLE ) # Apple veclib is not what we're looking for here
+ if( SIZEOF_INTEGER EQUAL 4 )
+ message( STATUS "FindBLAS: Searching for VECLIB" )
+ _BLAS_LOCATE_AND_TEST( ${_BLAS_VENDOR} "veclib" "" )
+ elseif( SIZEOF_INTEGER EQUAL 8 )
+ message( STATUS "FindBLAS: Searching for VECLIB (int64)" )
+ _BLAS_LOCATE_AND_TEST( ${_BLAS_VENDOR} "veclib8" "" )
+ endif()
+ endif()
# IBM ESSL
elseif( _BLAS_VENDOR STREQUAL "ESSL" )
- message( STATUS "FindBLAS: Searching for IBM ESSL" )
- _BLAS_LOCATE_AND_TEST( ${_BLAS_VENDOR} "essl;blas" "" )
+ if( SIZEOF_INTEGER EQUAL 4 )
+ message( STATUS "FindBLAS: Searching for IBM ESSL" )
+ _BLAS_LOCATE_AND_TEST( ${_BLAS_VENDOR} "essl;blas" "" )
+ elseif( SIZEOF_INTEGER EQUAL 8 )
+ message( STATUS "FindBLAS: Searching for IBM ESSL (int64)" )
+ _BLAS_LOCATE_AND_TEST( ${_BLAS_VENDOR} "essl6464;blas" "" )
+ endif()
# IBM ESSL (SMP Version)
elseif( _BLAS_VENDOR STREQUAL "ESSLSMP" )
- message( STATUS "FindBLAS: Searching for IBM ESSL (SMP)" )
- _BLAS_LOCATE_AND_TEST( ${_BLAS_VENDOR} "esslsmp;blas" "" )
-
- # IBM ESSL int64
- elseif( _BLAS_VENDOR STREQUAL "ESSL6464" )
- message( STATUS "FindBLAS: Searching for IBM ESSL (int64)" )
- _BLAS_LOCATE_AND_TEST( ${_BLAS_VENDOR} "essl6464" "" )
-
- # IBM ESSL (SMP + int64)
- elseif( _BLAS_VENDOR STREQUAL "ESSLSMP6464" )
- message( STATUS "FindBLAS: Searching for IBM ESSL (SMP + int64)" )
- _BLAS_LOCATE_AND_TEST( ${_BLAS_VENDOR} "esslsmp6464" "" )
+ if( SIZEOF_INTEGER EQUAL 4 )
+ message( STATUS "FindBLAS: Searching for IBM ESSL (SMP)" )
+ _BLAS_LOCATE_AND_TEST( ${_BLAS_VENDOR} "esslsmp;blas" "" )
+ elseif( SIZEOF_INTEGER EQUAL 8 )
+ message( STATUS "FindBLAS: Searching for IBM ESSL (SMP + int64)" )
+ _BLAS_LOCATE_AND_TEST( ${_BLAS_VENDOR} "esslsmp6464;blas" "" )
+ endif()
# Intel MKL (dynamic)
- elseif( _BLAS_VENDOR STREQUAL "MKL" )
- message( STATUS "FindBLAS: Searching for Intel MKL (dynamic)" )
+ elseif( _BLAS_VENDOR STREQUAL "MKL_RT" )
+ message( STATUS "FindBLAS: Searching for Intel MKL (dynamic runtime interface)" )
_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}
- "mkl_intel;mkl_intel_thread;mkl_core;iomp5;pthread"
- ""
- )
- elseif( CMAKE_Fortran_COMPILER_ID STREQUAL "PGI" )
- _BLAS_LOCATE_AND_TEST(
- ${_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_intel_ia32;mkl_gnu_thread;mkl_core" "-fopenmp"
- )
- endif()
-
- # Intel MKL (emt64 / ia64)
- elseif( _BLAS_VENDOR STREQUAL "MKL_LP64" )
- message( STATUS "FindBLAS: Searching for Intel MKL (emt64/ia64)" )
+ # Intel MKL (sequential)
+ elseif( _BLAS_VENDOR STREQUAL "MKL_SEQ" )
+ message( STATUS "FindBLAS: Searching for Intel MKL (sequential interface)" )
+
if( CMAKE_Fortran_COMPILER_ID STREQUAL "Intel" )
- _BLAS_LOCATE_AND_TEST(
- ${_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} "mkl_intel_lp64;mkl_pgi_thread;mkl_core;pgmp" ""
- )
- else() #if( CMAKE_Fortran_COMPILER_ID STREQUAL "GNU" )
- _BLAS_LOCATE_AND_TEST(
- ${_BLAS_VENDOR} "mkl_intel_lp64;mkl_gnu_thread;mkl_core" "-fopenmp"
- )
+ _BLAS_LOCATE_AND_TEST( ${_BLAS_VENDOR} "" "-mkl=sequential" )
+
+ else()
+ if( SIZEOF_INTEGER EQUAL 4 )
+ set( _BLAS_MKL_64_SUFFIX "_lp64" )
+ elseif( SIZEOF_INTEGER EQUAL 8 )
+ set( _BLAS_MKL_64_SUFFIX "_ilp64" )
+ endif()
+
+ foreach( _BLAS_MKL_SUFFIX "" "${_BLAS_MKL_64_SUFFIX}" )
+ _BLAS_LOCATE_AND_TEST(
+ ${_BLAS_VENDOR}
+ "mkl_intel${_BLAS_MKL_SUFFIX};mkl_sequential;mkl_core"
+ ""
+ )
+ if( BLAS_MKL_FOUND )
+ break()
+ endif()
+ endforeach()
endif()
- # Intel MKL (emt64/ia64 + int64)
- elseif( _BLAS_VENDOR STREQUAL "MKL_ILP64" )
- message( STATUS "FindBLAS: Searching for Intel MKL (emt64/ia64 + int64)" )
+ # Intel MKL
+ elseif( _BLAS_VENDOR STREQUAL "MKL" )
+ message( STATUS "FindBLAS: Searching for Intel MKL (multi-threaded interface)" )
+
if( CMAKE_Fortran_COMPILER_ID STREQUAL "Intel" )
- _BLAS_LOCATE_AND_TEST(
- ${_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} "mkl_intel_ilp64;mkl_pgi_thread;mkl_core;pgmp" ""
- )
- else() #if( CMAKE_Fortran_COMPILER_ID STREQUAL "GNU" )
- _BLAS_LOCATE_AND_TEST(
- ${_BLAS_VENDOR} "mkl_intel_ilp64;mkl_gnu_thread;mkl_core" "-fopenmp"
- )
+ _BLAS_LOCATE_AND_TEST( ${_BLAS_VENDOR} "" "-mkl=parallel" )
+
+ else()
+ if( SIZEOF_INTEGER EQUAL 4 )
+ set( _BLAS_MKL_64_SUFFIX "_lp64" )
+ elseif( SIZEOF_INTEGER EQUAL 8 )
+ set( _BLAS_MKL_64_SUFFIX "_ilp64" )
+ endif()
+
+ if( CMAKE_Fortran_COMPILER_ID STREQUAL "GNU" )
+ foreach( _BLAS_MKL_SUFFIX "" "${_BLAS_MKL_64_SUFFIX}" )
+ _BLAS_LOCATE_AND_TEST(
+ ${_BLAS_VENDOR}
+ "mkl_intel${_BLAS_MKL_SUFFIX};mkl_gnu_thread;mkl_core"
+ "-fopenmp"
+ )
+ if( BLAS_MKL_FOUND )
+ break()
+ endif()
+ endforeach()
+
+ elseif( CMAKE_Fortran_COMPILER_ID STREQUAL "PGI" )
+ foreach( _BLAS_MKL_SUFFIX "" "${_BLAS_MKL_64_SUFFIX}" )
+ _BLAS_LOCATE_AND_TEST(
+ ${_BLAS_VENDOR}
+ "mkl_intel${_BLAS_MKL_SUFFIX};mkl_pgi_thread;mkl_core"
+ "-mp"
+ )
+ if( BLAS_MKL_FOUND )
+ break()
+ endif()
+ endforeach()
+
+ # Use the intel thread library but explicitly search for the libraries
+ else()
+ foreach( _BLAS_MKL_SUFFIX "" "${_BLAS_MKL_64_SUFFIX}" )
+ _BLAS_LOCATE_AND_TEST(
+ ${_BLAS_VENDOR}
+ "mkl_intel${_BLAS_MKL_SUFFIX};mkl_intel_thread;mkl_core;iomp5"
+ ""
+ )
+ if( BLAS_MKL_FOUND )
+ break()
+ endif()
+ endforeach()
+ endif()
endif()
-
+
# Generic BLAS
elseif( _BLAS_VENDOR STREQUAL "GENERIC" )
message( STATUS "FindBLAS: Searching for generic BLAS" )
@@ -310,14 +407,23 @@ foreach( _BLAS_VENDOR ${BLAS_VENDORS} )
# SGI
elseif( _BLAS_VENDOR STREQUAL "SCSL" )
- message( STATUS "FindBLAS: Searching for SGI SCSL" )
- _BLAS_LOCATE_AND_TEST( ${_BLAS_VENDOR} "scsl" "" )
+ if( SIZEOF_INTEGER EQUAL 4 )
+ message( STATUS "FindBLAS: Searching for SGI SCSL" )
+ _BLAS_LOCATE_AND_TEST( ${_BLAS_VENDOR} "scs" "" )
+ elseif( SIZEOF_INTEGER EQUAL 8 )
+ message( STATUS "FindBLAS: Searching for SGI SCSL (int64)" )
+ _BLAS_LOCATE_AND_TEST( ${_BLAS_VENDOR} "scs_i8" "" )
+ endif()
# Sun / Oracle PerfLib
elseif( (_BLAS_VENDOR STREQUAL "PERFLIB") OR
(_BLAS_VENDOR STREQUAL "SUNPERF") )
message( STATUS "FindBLAS: Searching for Sun PerfLib" )
- _BLAS_LOCATE_AND_TEST( ${_BLAS_VENDOR} "" "-xlic_lib=sunperf" )
+ if( CMAKE_Fortran_COMPILER_ID STREQUAL "SunPro" )
+ _BLAS_LOCATE_AND_TEST( ${_BLAS_VENDOR} "" "-xlic_lib=sunperf" )
+ else()
+ _BLAS_LOCATE_AND_TEST( ${_BLAS_VENDOR} "sunperf;mtsk" "" )
+ endif()
else()
endif()