FindBLAS.cmake
Go to the documentation of this file.
00001 ############################################################################## 00002 # @file FindBLAS.cmake 00003 # @brief Find BLAS library. 00004 # 00005 # This module finds an installed fortran library that implements the BLAS 00006 # linear-algebra interface (see http://www.netlib.org/blas/). 00007 # The list of libraries searched for is taken 00008 # from the autoconf macro file, acx_blas.m4 (distributed at 00009 # http://ac-archive.sourceforge.net/ac-archive/acx_blas.html). 00010 # 00011 # Modified by Andreas Schuh to enable the use at SBIA, where an ATLAS C library 00012 # is installed which contains the symbols without trailing _ character, i.e., 00013 # instead of checking the existence of the cblas_dgemm_ function, the 00014 # existence of the cblas_dgemm function has to be checked. Moreover, added 00015 # code to mark variable as advanced and only show them to the user if 00016 # no required library was found. If the found library is cblas, the corresponding 00017 # header file cblas.h is searched as well. Therefore, added the BLAS_INCLUDE_DIR 00018 # variable which is only defined if required. 00019 # 00020 # This module sets the following variables: 00021 # BLAS_FOUND - set to true if a library implementing the BLAS interface 00022 # is found 00023 # BLAS_LINKER_FLAGS - uncached list of required linker flags (excluding -l 00024 # and -L). 00025 # BLAS_LIBRARIES - uncached list of libraries (using full path name) to 00026 # link against to use BLAS 00027 # BLAS_INCLUDE_DIR - uncached list of include directories for C libraries 00028 # BLAS95_LIBRARIES - uncached list of libraries (using full path name) 00029 # to link against to use BLAS95 interface 00030 # BLAS95_FOUND - set to true if a library implementing the BLAS f95 interface 00031 # is found 00032 # BLA_STATIC if set on this determines what kind of linkage we do (static) 00033 # BLA_VENDOR if set checks only the specified vendor, if not set checks 00034 # all the possibilities 00035 # BLA_F95 if set on tries to find the f95 interfaces for BLAS/LAPACK 00036 # 00037 # List of vendors (BLA_VENDOR) valid in this module 00038 # 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), 00039 # Intel( older versions of mkl 32 and 64 bit), ACML,ACML_MP,Apple, NAS, Generic 00040 # C/CXX should be enabled to use Intel mkl 00041 # 00042 # @verbatim 00043 # Copyright 2007-2009 Kitware, Inc. 00044 # All rights reserved. 00045 # 00046 # Redistribution and use in source and binary forms, with or without 00047 # modification, are permitted provided that the following conditions 00048 # are met: 00049 # 00050 # * Redistributions of source code must retain the above copyright 00051 # notice, this list of conditions and the following disclaimer. 00052 # 00053 # * Redistributions in binary form must reproduce the above copyright 00054 # notice, this list of conditions and the following disclaimer in the 00055 # documentation and/or other materials provided with the distribution. 00056 # 00057 # * Neither the names of Kitware, Inc., the Insight Software Consortium, 00058 # nor the names of their contributors may be used to endorse or promote 00059 # products derived from this software without specific prior written 00060 # permission. 00061 # 00062 # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 00063 # "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 00064 # LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 00065 # A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 00066 # HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 00067 # SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 00068 # LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 00069 # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 00070 # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 00071 # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 00072 # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 00073 # @endverbatim 00074 # 00075 # @ingroup CMakeFindModules 00076 ############################################################################## 00077 00078 set(BLAS_LIBRARIES_VARS) # set by check_fortran_libraries() to a list of 00079 # variable names of each searched library such 00080 # that these libraries can be made non-advanced 00081 # in case no library was found 00082 00083 include(CheckFunctionExists) 00084 include(CheckFortranFunctionExists) 00085 00086 # Check the language being used 00087 get_property( _LANGUAGES_ GLOBAL PROPERTY ENABLED_LANGUAGES ) 00088 if( _LANGUAGES_ MATCHES Fortran ) 00089 set( _CHECK_FORTRAN TRUE ) 00090 elseif( (_LANGUAGES_ MATCHES C) OR (_LANGUAGES_ MATCHES CXX) ) 00091 set( _CHECK_FORTRAN FALSE ) 00092 else() 00093 if(BLAS_FIND_REQUIRED) 00094 message(FATAL_ERROR "FindBLAS requires Fortran, C, or C++ to be enabled.") 00095 else(BLAS_FIND_REQUIRED) 00096 message(STATUS "Looking for BLAS... - NOT found (Unsupported languages)") 00097 return() 00098 endif(BLAS_FIND_REQUIRED) 00099 endif( ) 00100 00101 macro(Check_Fortran_Libraries LIBRARIES _prefix _name _flags _list _threads) 00102 # This macro checks for the existence of the combination of fortran libraries 00103 # given by _list. If the combination is found, this macro checks (using the 00104 # Check_Fortran_Function_Exists macro) whether can link against that library 00105 # combination using the name of a routine given by _name using the linker 00106 # flags given by _flags. If the combination of libraries is found and passes 00107 # the link test, LIBRARIES is set to the list of complete library paths that 00108 # have been found. Otherwise, LIBRARIES is set to FALSE. 00109 00110 # N.B. _prefix is the prefix applied to the names of all cached variables that 00111 # are generated internally and marked advanced by this macro. 00112 00113 set(_libraries_work TRUE) 00114 set(${LIBRARIES}) 00115 set(_combined_name) 00116 foreach(_library ${_list}) 00117 set(_combined_name ${_combined_name}_${_library}) 00118 00119 if(_libraries_work) 00120 if ( WIN32 ) 00121 if(BLA_STATIC) 00122 set(CMAKE_FIND_LIBRARY_SUFFIXES ".lib;.dll") 00123 endif(BLA_STATIC) 00124 find_library(${_prefix}_${_library}_LIBRARY 00125 NAMES ${_library} 00126 PATHS ENV LIB 00127 ) 00128 endif ( WIN32 ) 00129 00130 if ( APPLE ) 00131 if(BLA_STATIC) 00132 set(CMAKE_FIND_LIBRARY_SUFFIXES ".a;.dylib") 00133 endif(BLA_STATIC) 00134 find_library(${_prefix}_${_library}_LIBRARY 00135 NAMES ${_library} 00136 PATHS /usr/local/lib /usr/lib /usr/local/lib64 /usr/lib64 ENV DYLD_LIBRARY_PATH 00137 ) 00138 00139 else ( APPLE ) 00140 if(BLA_STATIC) 00141 set(CMAKE_FIND_LIBRARY_SUFFIXES ".a;.so") 00142 endif(BLA_STATIC) 00143 find_library(${_prefix}_${_library}_LIBRARY 00144 NAMES ${_library} 00145 PATHS /usr/local/lib /usr/lib /usr/local/lib64 /usr/lib64 ENV LD_LIBRARY_PATH 00146 ) 00147 endif( APPLE ) 00148 mark_as_advanced(${_prefix}_${_library}_LIBRARY) 00149 list (APPEND BLAS_LIBRARIES_VARS ${_prefix}_${_library}_LIBRARY) 00150 set(${LIBRARIES} ${${LIBRARIES}} ${${_prefix}_${_library}_LIBRARY}) 00151 set(_libraries_work ${${_prefix}_${_library}_LIBRARY}) 00152 endif(_libraries_work) 00153 endforeach(_library ${_list}) 00154 if(_libraries_work) 00155 # Test this combination of libraries. 00156 set(CMAKE_REQUIRED_LIBRARIES ${_flags} ${${LIBRARIES}} ${_threads}) 00157 # message("DEBUG: CMAKE_REQUIRED_LIBRARIES = ${CMAKE_REQUIRED_LIBRARIES}") 00158 if (_CHECK_FORTRAN) 00159 check_fortran_function_exists("${_name}" ${_prefix}${_combined_name}_WORKS) 00160 else() 00161 check_function_exists("${_name}" ${_prefix}${_combined_name}_WORKS) 00162 if (NOT ${_prefix}${_combined_name}_WORKS) 00163 check_function_exists("${_name}_" ${_prefix}${_combined_name}_WORKS) 00164 endif () 00165 endif() 00166 set(CMAKE_REQUIRED_LIBRARIES) 00167 mark_as_advanced(${_prefix}${_combined_name}_WORKS) 00168 set(_libraries_work ${${_prefix}${_combined_name}_WORKS}) 00169 endif(_libraries_work) 00170 if(NOT _libraries_work) 00171 set(${LIBRARIES} FALSE) 00172 endif(NOT _libraries_work) 00173 #message("DEBUG: ${LIBRARIES} = ${${LIBRARIES}}") 00174 endmacro(Check_Fortran_Libraries) 00175 00176 set(BLAS_LINKER_FLAGS) 00177 set(BLAS_LIBRARIES) 00178 set(BLAS95_LIBRARIES) 00179 if ($ENV{BLA_VENDOR} MATCHES ".+") 00180 set(BLA_VENDOR $ENV{BLA_VENDOR}) 00181 else ($ENV{BLA_VENDOR} MATCHES ".+") 00182 if(NOT BLA_VENDOR) 00183 set(BLA_VENDOR "All") 00184 endif(NOT BLA_VENDOR) 00185 endif ($ENV{BLA_VENDOR} MATCHES ".+") 00186 00187 if (BLA_VENDOR STREQUAL "ATLAS" OR BLA_VENDOR STREQUAL "All") 00188 if(NOT BLAS_LIBRARIES) 00189 # BLAS in ATLAS library? (http://math-atlas.sourceforge.net/) 00190 check_fortran_libraries( 00191 BLAS_LIBRARIES 00192 BLAS 00193 cblas_dgemm 00194 "" 00195 "cblas;f77blas;atlas" 00196 "" 00197 ) 00198 if (BLAS_LIBRARIES_VARS MATCHES "cblas") 00199 find_path (BLAS_INCLUDE_DIR NAMES cblas.h DOC "Include directory of the cblas.h header file.") 00200 endif () 00201 endif(NOT BLAS_LIBRARIES) 00202 endif (BLA_VENDOR STREQUAL "ATLAS" OR BLA_VENDOR STREQUAL "All") 00203 00204 # BLAS in PhiPACK libraries? (requires generic BLAS lib, too) 00205 if (BLA_VENDOR STREQUAL "PhiPACK" OR BLA_VENDOR STREQUAL "All") 00206 if(NOT BLAS_LIBRARIES) 00207 check_fortran_libraries( 00208 BLAS_LIBRARIES 00209 BLAS 00210 sgemm 00211 "" 00212 "sgemm;dgemm;blas" 00213 "" 00214 ) 00215 endif(NOT BLAS_LIBRARIES) 00216 endif (BLA_VENDOR STREQUAL "PhiPACK" OR BLA_VENDOR STREQUAL "All") 00217 00218 # BLAS in Alpha CXML library? 00219 if (BLA_VENDOR STREQUAL "CXML" OR BLA_VENDOR STREQUAL "All") 00220 if(NOT BLAS_LIBRARIES) 00221 check_fortran_libraries( 00222 BLAS_LIBRARIES 00223 BLAS 00224 sgemm 00225 "" 00226 "cxml" 00227 "" 00228 ) 00229 endif(NOT BLAS_LIBRARIES) 00230 endif (BLA_VENDOR STREQUAL "CXML" OR BLA_VENDOR STREQUAL "All") 00231 00232 # BLAS in Alpha DXML library? (now called CXML, see above) 00233 if (BLA_VENDOR STREQUAL "DXML" OR BLA_VENDOR STREQUAL "All") 00234 if(NOT BLAS_LIBRARIES) 00235 check_fortran_libraries( 00236 BLAS_LIBRARIES 00237 BLAS 00238 sgemm 00239 "" 00240 "dxml" 00241 "" 00242 ) 00243 endif(NOT BLAS_LIBRARIES) 00244 endif (BLA_VENDOR STREQUAL "DXML" OR BLA_VENDOR STREQUAL "All") 00245 00246 # BLAS in Sun Performance library? 00247 if (BLA_VENDOR STREQUAL "SunPerf" OR BLA_VENDOR STREQUAL "All") 00248 if(NOT BLAS_LIBRARIES) 00249 check_fortran_libraries( 00250 BLAS_LIBRARIES 00251 BLAS 00252 sgemm 00253 "-xlic_lib=sunperf" 00254 "sunperf;sunmath" 00255 "" 00256 ) 00257 if(BLAS_LIBRARIES) 00258 set(BLAS_LINKER_FLAGS "-xlic_lib=sunperf") 00259 endif(BLAS_LIBRARIES) 00260 endif(NOT BLAS_LIBRARIES) 00261 endif (BLA_VENDOR STREQUAL "SunPerf" OR BLA_VENDOR STREQUAL "All") 00262 00263 # BLAS in SCSL library? (SGI/Cray Scientific Library) 00264 if (BLA_VENDOR STREQUAL "SCSL" OR BLA_VENDOR STREQUAL "All") 00265 if(NOT BLAS_LIBRARIES) 00266 check_fortran_libraries( 00267 BLAS_LIBRARIES 00268 BLAS 00269 sgemm 00270 "" 00271 "scsl" 00272 "" 00273 ) 00274 endif(NOT BLAS_LIBRARIES) 00275 endif (BLA_VENDOR STREQUAL "SCSL" OR BLA_VENDOR STREQUAL "All") 00276 00277 # BLAS in SGIMATH library? 00278 if (BLA_VENDOR STREQUAL "SGIMATH" OR BLA_VENDOR STREQUAL "All") 00279 if(NOT BLAS_LIBRARIES) 00280 check_fortran_libraries( 00281 BLAS_LIBRARIES 00282 BLAS 00283 sgemm 00284 "" 00285 "complib.sgimath" 00286 "" 00287 ) 00288 endif(NOT BLAS_LIBRARIES) 00289 endif (BLA_VENDOR STREQUAL "SGIMATH" OR BLA_VENDOR STREQUAL "All") 00290 00291 # BLAS in IBM ESSL library? (requires generic BLAS lib, too) 00292 if (BLA_VENDOR STREQUAL "IBMESSL" OR BLA_VENDOR STREQUAL "All") 00293 if(NOT BLAS_LIBRARIES) 00294 check_fortran_libraries( 00295 BLAS_LIBRARIES 00296 BLAS 00297 sgemm 00298 "" 00299 "essl;blas" 00300 "" 00301 ) 00302 endif(NOT BLAS_LIBRARIES) 00303 endif (BLA_VENDOR STREQUAL "IBMESSL" OR BLA_VENDOR STREQUAL "All") 00304 00305 #BLAS in acml library? 00306 if (BLA_VENDOR STREQUAL "ACML" OR BLA_VENDOR STREQUAL "ACML_MP" OR BLA_VENDOR STREQUAL "All") 00307 # the patch from Chuck Atkins: 00308 if( ((_BLAS_VENDOR STREQUAL "ACML") AND (NOT BLAS_ACML_LIB_DIRS)) OR 00309 ((_BLAS_VENDOR STREQUAL "ACML_MP") AND (NOT BLAS_ACML_MP_LIB_DIRS)) ) 00310 if( WIN32 ) 00311 file( GLOB _ACML_ROOT "C:/AMD/acml*/ACML-EULA.txt" ) 00312 else() 00313 file( GLOB _ACML_ROOT "/opt/acml*/ACML-EULA.txt" ) 00314 endif() 00315 if( _ACML_ROOT ) 00316 get_filename_component( _ACML_ROOT ${_ACML_ROOT} PATH ) 00317 if( SIZEOF_INTEGER EQUAL 8 ) 00318 set( _ACML_PATH_SUFFIX "_int64" ) 00319 else() 00320 set( _ACML_PATH_SUFFIX "" ) 00321 endif() 00322 if( CMAKE_Fortran_COMPILER_ID STREQUAL "Intel" ) 00323 set( _ACML_COMPILER32 "ifort32" ) 00324 set( _ACML_COMPILER64 "ifort64" ) 00325 elseif( CMAKE_Fortran_COMPILER_ID STREQUAL "SunPro" ) 00326 set( _ACML_COMPILER32 "sun32" ) 00327 set( _ACML_COMPILER64 "sun64" ) 00328 elseif( CMAKE_Fortran_COMPILER_ID STREQUAL "PGI" ) 00329 set( _ACML_COMPILER32 "pgi32" ) 00330 if( WIN32 ) 00331 set( _ACML_COMPILER64 "win64" ) 00332 else() 00333 set( _ACML_COMPILER64 "pgi64" ) 00334 endif() 00335 elseif( CMAKE_Fortran_COMPILER_ID STREQUAL "Open64" ) 00336 # 32 bit builds not supported on Open64 but for code simplicity 00337 # We'll just use the same directory twice 00338 set( _ACML_COMPILER32 "open64_64" ) 00339 set( _ACML_COMPILER64 "open64_64" ) 00340 elseif( CMAKE_Fortran_COMPILER_ID STREQUAL "NAG" ) 00341 set( _ACML_COMPILER32 "nag32" ) 00342 set( _ACML_COMPILER64 "nag64" ) 00343 else() #if( CMAKE_Fortran_COMPILER_ID STREQUAL "GNU" ) 00344 set( _ACML_COMPILER32 "gfortran32" ) 00345 set( _ACML_COMPILER64 "gfortran64" ) 00346 endif() 00347 00348 if( _BLAS_VENDOR STREQUAL "ACML_MP" ) 00349 set(_ACML_MP_LIB_DIRS 00350 "${_ACML_ROOT}/${_ACML_COMPILER32}_mp${_ACML_PATH_SUFFIX}/lib" 00351 "${_ACML_ROOT}/${_ACML_COMPILER64}_mp${_ACML_PATH_SUFFIX}/lib" ) 00352 else() #if( _BLAS_VENDOR STREQUAL "ACML" ) 00353 set(_ACML_LIB_DIRS 00354 "${_ACML_ROOT}/${_ACML_COMPILER32}${_ACML_PATH_SUFFIX}/lib" 00355 "${_ACML_ROOT}/${_ACML_COMPILER64}${_ACML_PATH_SUFFIX}/lib" ) 00356 endif() 00357 endif() 00358 endif() 00359 00360 if( _BLAS_VENDOR STREQUAL "ACML_MP" ) 00361 foreach( BLAS_ACML_MP_LIB_DIRS ${_ACML_MP_LIB_DIRS} ) 00362 _BLAS_LOCATE_AND_TEST( ${_BLAS_VENDOR} "acml_mp;acml_mv" "" ) 00363 if( BLAS_${_BLAS_VENDOR}_FOUND ) 00364 break() 00365 endif() 00366 endforeach() 00367 else() #if( _BLAS_VENDOR STREQUAL "ACML" ) 00368 foreach( BLAS_ACML_LIB_DIRS ${_ACML_LIB_DIRS} ) 00369 _BLAS_LOCATE_AND_TEST( ${_BLAS_VENDOR} "acml;acml_mv" "" ) 00370 if( BLAS_${_BLAS_VENDOR}_FOUND ) 00371 break() 00372 endif() 00373 endforeach() 00374 endif() 00375 00376 # Either acml or acml_mp should be in LD_LIBRARY_PATH but not both 00377 if(NOT BLAS_LIBRARIES) 00378 check_fortran_libraries( 00379 BLAS_LIBRARIES 00380 BLAS 00381 sgemm 00382 "" 00383 "acml;acml_mv" 00384 "" 00385 ) 00386 endif(NOT BLAS_LIBRARIES) 00387 if(NOT BLAS_LIBRARIES) 00388 check_fortran_libraries( 00389 BLAS_LIBRARIES 00390 BLAS 00391 sgemm 00392 "" 00393 "acml_mp;acml_mv" 00394 "" 00395 ) 00396 endif(NOT BLAS_LIBRARIES) 00397 endif () # ACML 00398 00399 # Apple BLAS library? 00400 if (BLA_VENDOR STREQUAL "Apple" OR BLA_VENDOR STREQUAL "All") 00401 if(NOT BLAS_LIBRARIES) 00402 check_fortran_libraries( 00403 BLAS_LIBRARIES 00404 BLAS 00405 cblas_dgemm 00406 "" 00407 "Accelerate" 00408 "" 00409 ) 00410 endif(NOT BLAS_LIBRARIES) 00411 endif (BLA_VENDOR STREQUAL "Apple" OR BLA_VENDOR STREQUAL "All") 00412 00413 if (BLA_VENDOR STREQUAL "NAS" OR BLA_VENDOR STREQUAL "All") 00414 if ( NOT BLAS_LIBRARIES ) 00415 check_fortran_libraries( 00416 BLAS_LIBRARIES 00417 BLAS 00418 cblas_dgemm 00419 "" 00420 "vecLib" 00421 "" 00422 ) 00423 endif ( NOT BLAS_LIBRARIES ) 00424 endif (BLA_VENDOR STREQUAL "NAS" OR BLA_VENDOR STREQUAL "All") 00425 # Generic BLAS library? 00426 if (BLA_VENDOR STREQUAL "Generic" OR BLA_VENDOR STREQUAL "All") 00427 if(NOT BLAS_LIBRARIES) 00428 check_fortran_libraries( 00429 BLAS_LIBRARIES 00430 BLAS 00431 sgemm 00432 "" 00433 "blas" 00434 "" 00435 ) 00436 endif(NOT BLAS_LIBRARIES) 00437 endif (BLA_VENDOR STREQUAL "Generic" OR BLA_VENDOR STREQUAL "All") 00438 00439 #BLAS in intel mkl 10 library? (em64t 64bit) 00440 if (BLA_VENDOR MATCHES "Intel*" OR BLA_VENDOR STREQUAL "All") 00441 if (NOT WIN32) 00442 set(LM "-lm") 00443 endif () 00444 if (_LANGUAGES_ MATCHES C OR _LANGUAGES_ MATCHES CXX) 00445 if(BLAS_FIND_QUIETLY OR NOT BLAS_FIND_REQUIRED) 00446 find_package(Threads) 00447 else(BLAS_FIND_QUIETLY OR NOT BLAS_FIND_REQUIRED) 00448 find_package(Threads REQUIRED) 00449 endif(BLAS_FIND_QUIETLY OR NOT BLAS_FIND_REQUIRED) 00450 if (WIN32) 00451 if(BLA_F95) 00452 if(NOT BLAS95_LIBRARIES) 00453 check_fortran_libraries( 00454 BLAS95_LIBRARIES 00455 BLAS 00456 sgemm 00457 "" 00458 "mkl_blas95;mkl_intel_c;mkl_intel_thread;mkl_core;libguide40" 00459 "" 00460 ) 00461 endif(NOT BLAS95_LIBRARIES) 00462 else(BLA_F95) 00463 if(NOT BLAS_LIBRARIES) 00464 check_fortran_libraries( 00465 BLAS_LIBRARIES 00466 BLAS 00467 SGEMM 00468 "" 00469 "mkl_c_dll;mkl_intel_thread_dll;mkl_core_dll;libguide40" 00470 "" 00471 ) 00472 endif(NOT BLAS_LIBRARIES) 00473 endif(BLA_F95) 00474 else(WIN32) 00475 if (BLA_VENDOR STREQUAL "Intel10_32" OR BLA_VENDOR STREQUAL "All") 00476 if(BLA_F95) 00477 if(NOT BLAS95_LIBRARIES) 00478 check_fortran_libraries( 00479 BLAS95_LIBRARIES 00480 BLAS 00481 sgemm 00482 "" 00483 "mkl_blas95;mkl_intel;mkl_intel_thread;mkl_core;guide" 00484 "${CMAKE_THREAD_LIBS_INIT};${LM}" 00485 ) 00486 endif(NOT BLAS95_LIBRARIES) 00487 else(BLA_F95) 00488 if(NOT BLAS_LIBRARIES) 00489 check_fortran_libraries( 00490 BLAS_LIBRARIES 00491 BLAS 00492 sgemm 00493 "" 00494 "mkl_intel;mkl_intel_thread;mkl_core;guide" 00495 "${CMAKE_THREAD_LIBS_INIT}" 00496 "${LM}" 00497 ) 00498 endif(NOT BLAS_LIBRARIES) 00499 endif(BLA_F95) 00500 endif (BLA_VENDOR STREQUAL "Intel10_32" OR BLA_VENDOR STREQUAL "All") 00501 if (BLA_VENDOR STREQUAL "Intel10_64lp" OR BLA_VENDOR STREQUAL "All") 00502 if(BLA_F95) 00503 if(NOT BLAS95_LIBRARIES) 00504 check_fortran_libraries( 00505 BLAS95_LIBRARIES 00506 BLAS 00507 sgemm 00508 "" 00509 "mkl_blas95;mkl_intel_lp64;mkl_intel_thread;mkl_core;guide" 00510 "${CMAKE_THREAD_LIBS_INIT};${LM}" 00511 ) 00512 endif(NOT BLAS95_LIBRARIES) 00513 else(BLA_F95) 00514 if(NOT BLAS_LIBRARIES) 00515 check_fortran_libraries( 00516 BLAS_LIBRARIES 00517 BLAS 00518 sgemm 00519 "" 00520 "mkl_intel_lp64;mkl_intel_thread;mkl_core;guide" 00521 "${CMAKE_THREAD_LIBS_INIT};${LM}" 00522 ) 00523 endif(NOT BLAS_LIBRARIES) 00524 endif(BLA_F95) 00525 endif (BLA_VENDOR STREQUAL "Intel10_64lp" OR BLA_VENDOR STREQUAL "All") 00526 endif (WIN32) 00527 #older vesions of intel mkl libs 00528 # BLAS in intel mkl library? (shared) 00529 if(NOT BLAS_LIBRARIES) 00530 check_fortran_libraries( 00531 BLAS_LIBRARIES 00532 BLAS 00533 sgemm 00534 "" 00535 "mkl;guide" 00536 "${CMAKE_THREAD_LIBS_INIT};${LM}" 00537 ) 00538 endif(NOT BLAS_LIBRARIES) 00539 #BLAS in intel mkl library? (static, 32bit) 00540 if(NOT BLAS_LIBRARIES) 00541 check_fortran_libraries( 00542 BLAS_LIBRARIES 00543 BLAS 00544 sgemm 00545 "" 00546 "mkl_ia32;guide" 00547 "${CMAKE_THREAD_LIBS_INIT};${LM}" 00548 ) 00549 endif(NOT BLAS_LIBRARIES) 00550 #BLAS in intel mkl library? (static, em64t 64bit) 00551 if(NOT BLAS_LIBRARIES) 00552 check_fortran_libraries( 00553 BLAS_LIBRARIES 00554 BLAS 00555 sgemm 00556 "" 00557 "mkl_em64t;guide" 00558 "${CMAKE_THREAD_LIBS_INIT};${LM}" 00559 ) 00560 endif(NOT BLAS_LIBRARIES) 00561 endif (_LANGUAGES_ MATCHES C OR _LANGUAGES_ MATCHES CXX) 00562 endif (BLA_VENDOR MATCHES "Intel*" OR BLA_VENDOR STREQUAL "All") 00563 00564 if (BLAS_LIBRARIES_VARS) 00565 mark_as_advanced (FORCE ${BLAS_LIBRARIES_VARS}) 00566 endif () 00567 if (BLAS95_LIBRARIES) 00568 mark_as_advanced (FORCE ${BLAS95_LIBRARIES}) 00569 endif () 00570 if (BLAS_INCLUDE_DIR) 00571 mark_as_advanced (FORCE BLAS_INCLUDE_DIR) 00572 endif () 00573 00574 if(BLA_F95) 00575 if(BLAS95_LIBRARIES) 00576 set(BLAS95_FOUND TRUE) 00577 else(BLAS95_LIBRARIES) 00578 set(BLAS95_FOUND FALSE) 00579 endif(BLAS95_LIBRARIES) 00580 00581 if(NOT BLAS_FIND_QUIETLY) 00582 if(BLAS95_FOUND) 00583 mark_as_advanced (${BLAS95_LIBRARIES}) 00584 message(STATUS "A library with BLAS95 API found.") 00585 else(BLAS95_FOUND) 00586 if(BLAS_FIND_REQUIRED) 00587 mark_as_advanced (CLEAR ${BLAS95_LIBRARIES}) 00588 message(FATAL_ERROR 00589 "A required library with BLAS95 API not found. Please specify library location.") 00590 else(BLAS_FIND_REQUIRED) 00591 message(STATUS 00592 "A library with BLAS95 API not found. Please specify library location.") 00593 endif(BLAS_FIND_REQUIRED) 00594 endif(BLAS95_FOUND) 00595 endif(NOT BLAS_FIND_QUIETLY) 00596 set(BLAS_FOUND TRUE) 00597 set(BLAS_LIBRARIES "${BLAS95_LIBRARIES}") 00598 else(BLA_F95) 00599 if(BLAS_LIBRARIES) 00600 if(BLAS_LIBRARIES_VARS MATCHES "cblas" AND NOT BLAS_INCLUDE_DIR) 00601 set(BLAS_FOUND FALSE) 00602 else() 00603 set(BLAS_FOUND TRUE) 00604 endif() 00605 else(BLAS_LIBRARIES) 00606 set(BLAS_FOUND FALSE) 00607 endif(BLAS_LIBRARIES) 00608 00609 if(NOT BLAS_FIND_QUIETLY) 00610 if(BLAS_FOUND) 00611 message(STATUS "A library with BLAS API found.") 00612 else(BLAS_FOUND) 00613 if(BLAS_LIBRARIES AND BLAS_cblas_LIBRARY AND NOT BLAS_INCLUDE_DIR) 00614 if(BLAS_FIND_REQUIRED) 00615 mark_as_advanced (CLEAR BLAS_INCLUDE_DIR) 00616 message(FATAL_ERROR 00617 "Location of cblas.h header file for C BLAS library not found!" 00618 " Please specify the directory containing this file for library ${BLAS_cblas_LIBRARY}" 00619 " using the BLAS_INCLUDE_DIR variable." 00620 ) 00621 else(BLAS_FIND_REQUIRED) 00622 message(STATUS 00623 "Location of cblas.h header file for C BLAS library not found! Please specify header location." 00624 ) 00625 endif(BLAS_FIND_REQUIRED) 00626 else() 00627 if(BLAS_FIND_REQUIRED) 00628 mark_as_advanced (CLEAR ${BLAS_LIBRARIES_VARS}) 00629 message(FATAL_ERROR 00630 "A required library with BLAS API not found. Please specify library location" 00631 " by setting the following variables: [${BLAS_LIBRARIES_VARS}]." 00632 ) 00633 else(BLAS_FIND_REQUIRED) 00634 message(STATUS 00635 "A library with BLAS API not found. Please specify library location." 00636 ) 00637 endif(BLAS_FIND_REQUIRED) 00638 endif() 00639 endif(BLAS_FOUND) 00640 endif(NOT BLAS_FIND_QUIETLY) 00641 endif(BLA_F95) 00642 00643 unset(BLAS_LIBRARIES_VARS)