Merge topic 'FindLAPACK_FindBLAS'

cfad24a fixed: search of ATLAS library for C/C++-only projects
d5e6030 ACML-GPU supportede
af4c58b ACML-GPU supported
91b76e2 gotoblas supported
66a4bd0 fixed: search of acml libraries
This commit is contained in:
David Cole 2011-08-25 15:39:00 -04:00 committed by CMake Topic Stage
commit d2b90e4c68
2 changed files with 118 additions and 67 deletions

View File

@ -22,8 +22,8 @@
# BLA_F95 if set on tries to find the f95 interfaces for BLAS/LAPACK # BLA_F95 if set on tries to find the f95 interfaces for BLAS/LAPACK
########## ##########
### List of vendors (BLA_VENDOR) valid in this module ### List of vendors (BLA_VENDOR) valid in this module
## 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), ## Goto,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),
## Intel( older versions of mkl 32 and 64 bit), ACML,ACML_MP,Apple, NAS, Generic ## Intel( older versions of mkl 32 and 64 bit), ACML,ACML_MP,ACML_GPU,Apple, NAS, Generic
# C/CXX should be enabled to use Intel mkl # C/CXX should be enabled to use Intel mkl
#============================================================================= #=============================================================================
@ -57,7 +57,7 @@ else()
endif(BLAS_FIND_REQUIRED) endif(BLAS_FIND_REQUIRED)
endif( ) endif( )
macro(Check_Fortran_Libraries LIBRARIES _prefix _name _flags _list _threads) macro(Check_Fortran_Libraries LIBRARIES _prefix _name _flags _list _thread)
# This macro checks for the existence of the combination of fortran libraries # 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 # given by _list. If the combination is found, this macro checks (using the
# Check_Fortran_Function_Exists macro) whether can link against that library # Check_Fortran_Function_Exists macro) whether can link against that library
@ -69,41 +69,38 @@ macro(Check_Fortran_Libraries LIBRARIES _prefix _name _flags _list _threads)
# N.B. _prefix is the prefix applied to the names of all cached variables that # N.B. _prefix is the prefix applied to the names of all cached variables that
# are generated internally and marked advanced by this macro. # are generated internally and marked advanced by this macro.
set(_libdir ${ARGN})
set(_libraries_work TRUE) set(_libraries_work TRUE)
set(${LIBRARIES}) set(${LIBRARIES})
set(_combined_name) set(_combined_name)
if (NOT _libdir)
if (WIN32)
set(_libdir ENV LIB)
elseif (APPLE)
set(_libdir /usr/local/lib /usr/lib /usr/local/lib64 /usr/lib64 ENV DYLD_LIBRARY_PATH)
else ()
set(_libdir /usr/local/lib /usr/lib /usr/local/lib64 /usr/lib64 ENV LD_LIBRARY_PATH)
endif ()
endif ()
foreach(_library ${_list}) foreach(_library ${_list})
set(_combined_name ${_combined_name}_${_library}) set(_combined_name ${_combined_name}_${_library})
if(_libraries_work) if(_libraries_work)
if ( WIN32 ) if (BLA_STATIC)
if(BLA_STATIC) if (WIN32)
set(CMAKE_FIND_LIBRARY_SUFFIXES ".lib;.dll") set(CMAKE_FIND_LIBRARY_SUFFIXES ".lib;.dll")
endif(BLA_STATIC) endif ( WIN32 )
if (APPLE)
set(CMAKE_FIND_LIBRARY_SUFFIXES ".lib;.dll")
else (APPLE)
set(CMAKE_FIND_LIBRARY_SUFFIXES ".a;.so")
endif (APPLE)
endif (BLA_STATIC)
find_library(${_prefix}_${_library}_LIBRARY find_library(${_prefix}_${_library}_LIBRARY
NAMES ${_library} NAMES ${_library}
PATHS ENV LIB PATHS ${_libdir}
) )
endif ( WIN32 )
if ( APPLE )
if(BLA_STATIC)
set(CMAKE_FIND_LIBRARY_SUFFIXES ".lib;.dll")
endif(BLA_STATIC)
find_library(${_prefix}_${_library}_LIBRARY
NAMES ${_library}
PATHS /usr/local/lib /usr/lib /usr/local/lib64 /usr/lib64 ENV DYLD_LIBRARY_PATH
)
else ( APPLE )
if(BLA_STATIC)
set(CMAKE_FIND_LIBRARY_SUFFIXES ".a;.so")
endif(BLA_STATIC)
find_library(${_prefix}_${_library}_LIBRARY
NAMES ${_library}
PATHS /usr/local/lib /usr/lib /usr/local/lib64 /usr/lib64 ENV LD_LIBRARY_PATH
)
endif( APPLE )
mark_as_advanced(${_prefix}_${_library}_LIBRARY) mark_as_advanced(${_prefix}_${_library}_LIBRARY)
set(${LIBRARIES} ${${LIBRARIES}} ${${_prefix}_${_library}_LIBRARY}) set(${LIBRARIES} ${${LIBRARIES}} ${${_prefix}_${_library}_LIBRARY})
set(_libraries_work ${${_prefix}_${_library}_LIBRARY}) set(_libraries_work ${${_prefix}_${_library}_LIBRARY})
@ -139,15 +136,29 @@ else ($ENV{BLA_VENDOR} MATCHES ".+")
endif(NOT BLA_VENDOR) endif(NOT BLA_VENDOR)
endif ($ENV{BLA_VENDOR} MATCHES ".+") endif ($ENV{BLA_VENDOR} MATCHES ".+")
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"
""
)
endif(NOT BLAS_LIBRARIES)
endif (BLA_VENDOR STREQUAL "Goto" 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) if(NOT BLAS_LIBRARIES)
# BLAS in ATLAS library? (http://math-atlas.sourceforge.net/) # BLAS in ATLAS library? (http://math-atlas.sourceforge.net/)
check_fortran_libraries( check_fortran_libraries(
BLAS_LIBRARIES BLAS_LIBRARIES
BLAS BLAS
cblas_dgemm dgemm
"" ""
"cblas;f77blas;atlas" "f77blas;atlas"
"" ""
) )
endif(NOT BLAS_LIBRARIES) endif(NOT BLAS_LIBRARIES)
@ -255,15 +266,24 @@ if (BLA_VENDOR STREQUAL "IBMESSL" OR BLA_VENDOR STREQUAL "All")
endif (BLA_VENDOR STREQUAL "IBMESSL" OR BLA_VENDOR STREQUAL "All") endif (BLA_VENDOR STREQUAL "IBMESSL" OR BLA_VENDOR STREQUAL "All")
#BLAS in acml library? #BLAS in acml library?
if (BLA_VENDOR STREQUAL "ACML" OR BLA_VENDOR STREQUAL "ACML_MP" OR BLA_VENDOR STREQUAL "All") if (BLA_VENDOR MATCHES "ACML.*" OR BLA_VENDOR STREQUAL "All")
# the patch from Chuck Atkins: if( ((BLA_VENDOR STREQUAL "ACML") AND (NOT BLAS_ACML_LIB_DIRS)) OR
if( ((_BLAS_VENDOR STREQUAL "ACML") AND (NOT BLAS_ACML_LIB_DIRS)) OR ((BLA_VENDOR STREQUAL "ACML_MP") AND (NOT BLAS_ACML_MP_LIB_DIRS)) OR
((_BLAS_VENDOR STREQUAL "ACML_MP") AND (NOT BLAS_ACML_MP_LIB_DIRS)) ) ((BLA_VENDOR STREQUAL "ACML_GPU") AND (NOT BLAS_ACML_GPU_LIB_DIRS))
)
# try to find acml in "standard" paths
if( WIN32 ) if( WIN32 )
file( GLOB _ACML_ROOT "C:/AMD/acml*/ACML-EULA.txt" ) file( GLOB _ACML_ROOT "C:/AMD/acml*/ACML-EULA.txt" )
else() else()
file( GLOB _ACML_ROOT "/opt/acml*/ACML-EULA.txt" ) file( GLOB _ACML_ROOT "/opt/acml*/ACML-EULA.txt" )
endif() endif()
if( WIN32 )
file( GLOB _ACML_GPU_ROOT "C:/AMD/acml*/GPGPUexamples" )
else()
file( GLOB _ACML_GPU_ROOT "/opt/acml*/GPGPUexamples" )
endif()
list(GET _ACML_ROOT 0 _ACML_ROOT)
list(GET _ACML_GPU_ROOT 0 _ACML_GPU_ROOT)
if( _ACML_ROOT ) if( _ACML_ROOT )
get_filename_component( _ACML_ROOT ${_ACML_ROOT} PATH ) get_filename_component( _ACML_ROOT ${_ACML_ROOT} PATH )
if( SIZEOF_INTEGER EQUAL 8 ) if( SIZEOF_INTEGER EQUAL 8 )
@ -297,7 +317,7 @@ if (BLA_VENDOR STREQUAL "ACML" OR BLA_VENDOR STREQUAL "ACML_MP" OR BLA_VENDOR ST
set( _ACML_COMPILER64 "gfortran64" ) set( _ACML_COMPILER64 "gfortran64" )
endif() endif()
if( _BLAS_VENDOR STREQUAL "ACML_MP" ) if( BLA_VENDOR STREQUAL "ACML_MP" )
set(_ACML_MP_LIB_DIRS set(_ACML_MP_LIB_DIRS
"${_ACML_ROOT}/${_ACML_COMPILER32}_mp${_ACML_PATH_SUFFIX}/lib" "${_ACML_ROOT}/${_ACML_COMPILER32}_mp${_ACML_PATH_SUFFIX}/lib"
"${_ACML_ROOT}/${_ACML_COMPILER64}_mp${_ACML_PATH_SUFFIX}/lib" ) "${_ACML_ROOT}/${_ACML_COMPILER64}_mp${_ACML_PATH_SUFFIX}/lib" )
@ -307,19 +327,43 @@ if (BLA_VENDOR STREQUAL "ACML" OR BLA_VENDOR STREQUAL "ACML_MP" OR BLA_VENDOR ST
"${_ACML_ROOT}/${_ACML_COMPILER64}${_ACML_PATH_SUFFIX}/lib" ) "${_ACML_ROOT}/${_ACML_COMPILER64}${_ACML_PATH_SUFFIX}/lib" )
endif() endif()
endif() endif()
elseif(BLAS_${BLA_VENDOR}_LIB_DIRS)
set(_${BLA_VENDOR}_LIB_DIRS ${BLAS_${BLA_VENDOR}_LIB_DIRS})
endif() endif()
if( _BLAS_VENDOR STREQUAL "ACML_MP" ) if( BLA_VENDOR STREQUAL "ACML_MP" )
foreach( BLAS_ACML_MP_LIB_DIRS ${_ACML_MP_LIB_DIRS} ) foreach( BLAS_ACML_MP_LIB_DIRS ${_ACML_MP_LIB_DIRS})
_BLAS_LOCATE_AND_TEST( ${_BLAS_VENDOR} "acml_mp;acml_mv" "" ) check_fortran_libraries (
if( BLAS_${_BLAS_VENDOR}_FOUND ) BLAS_LIBRARIES
BLAS
sgemm
"" "acml_mp;acml_mv" "" ${BLAS_ACML_MP_LIB_DIRS}
)
if( BLAS_LIBRARIES )
break()
endif()
endforeach()
elseif( BLA_VENDOR STREQUAL "ACML_GPU" )
foreach( BLAS_ACML_GPU_LIB_DIRS ${_ACML_GPU_LIB_DIRS})
check_fortran_libraries (
BLAS_LIBRARIES
BLAS
sgemm
"" "acml_mp;acml_mv;CALBLAS" "" ${BLAS_ACML_GPU_LIB_DIRS}
)
if( BLAS_LIBRARIES )
break() break()
endif() endif()
endforeach() endforeach()
else() #if( _BLAS_VENDOR STREQUAL "ACML" ) else() #if( _BLAS_VENDOR STREQUAL "ACML" )
foreach( BLAS_ACML_LIB_DIRS ${_ACML_LIB_DIRS} ) foreach( BLAS_ACML_LIB_DIRS ${_ACML_LIB_DIRS} )
_BLAS_LOCATE_AND_TEST( ${_BLAS_VENDOR} "acml;acml_mv" "" ) check_fortran_libraries (
if( BLAS_${_BLAS_VENDOR}_FOUND ) BLAS_LIBRARIES
BLAS
sgemm
"" "acml_mp;acml_mv" "" ${BLAS_ACML_LIB_DIRS}
)
if( BLAS_LIBRARIES )
break() break()
endif() endif()
endforeach() endforeach()
@ -346,6 +390,16 @@ if (BLA_VENDOR STREQUAL "ACML" OR BLA_VENDOR STREQUAL "ACML_MP" OR BLA_VENDOR ST
"" ""
) )
endif(NOT BLAS_LIBRARIES) endif(NOT BLAS_LIBRARIES)
if(NOT BLAS_LIBRARIES)
check_fortran_libraries(
BLAS_LIBRARIES
BLAS
sgemm
""
"acml;acml_mv;CALBLAS"
""
)
endif(NOT BLAS_LIBRARIES)
endif () # ACML endif () # ACML
# Apple BLAS library? # Apple BLAS library?

View File

@ -148,31 +148,28 @@ if(BLAS_FOUND)
set(BLA_VENDOR "All") set(BLA_VENDOR "All")
endif(NOT BLA_VENDOR) endif(NOT BLA_VENDOR)
endif ($ENV{BLA_VENDOR} MATCHES ".+") endif ($ENV{BLA_VENDOR} MATCHES ".+")
if (BLA_VENDOR STREQUAL "Goto" OR BLA_VENDOR STREQUAL "All")
if(NOT LAPACK_LIBRARIES)
check_lapack_libraries(
LAPACK_LIBRARIES
LAPACK
cheev
""
"goto2"
"${BLAS_LIBRARIES}"
""
)
endif(NOT LAPACK_LIBRARIES)
endif (BLA_VENDOR STREQUAL "Goto" OR BLA_VENDOR STREQUAL "All")
#acml lapack #acml lapack
if (BLA_VENDOR STREQUAL "ACML" OR BLA_VENDOR STREQUAL "All") if (BLA_VENDOR STREQUAL "ACML.*" OR BLA_VENDOR STREQUAL "All")
if(NOT LAPACK_LIBRARIES) if (BLAS_LIBRARIES MATCHES ".+acml.+")
check_lapack_libraries( set (LAPACK_LIBRARIES ${BLAS_LIBRARIES})
LAPACK_LIBRARIES endif ()
LAPACK endif ()
cheev
""
"acml;acml_mv"
""
""
)
endif(NOT LAPACK_LIBRARIES)
if(NOT LAPACK_LIBRARIES)
check_lapack_libraries(
LAPACK_LIBRARIES
LAPACK
cheev
""
"acml_mp;acml_mv"
""
""
)
endif(NOT LAPACK_LIBRARIES)
endif (BLA_VENDOR STREQUAL "ACML" OR BLA_VENDOR STREQUAL "All")
# Apple LAPACK library? # Apple LAPACK library?
if (BLA_VENDOR STREQUAL "Apple" OR BLA_VENDOR STREQUAL "All") if (BLA_VENDOR STREQUAL "Apple" OR BLA_VENDOR STREQUAL "All")