FindBLAS.cmake 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606
  1. # - Find BLAS library
  2. # This module finds an installed fortran library that implements the BLAS
  3. # linear-algebra interface (see http://www.netlib.org/blas/).
  4. # The list of libraries searched for is taken
  5. # from the autoconf macro file, acx_blas.m4 (distributed at
  6. # http://ac-archive.sourceforge.net/ac-archive/acx_blas.html).
  7. #
  8. # This module sets the following variables:
  9. # BLAS_FOUND - set to true if a library implementing the BLAS interface
  10. # is found
  11. # BLAS_LINKER_FLAGS - uncached list of required linker flags (excluding -l
  12. # and -L).
  13. # BLAS_LIBRARIES - uncached list of libraries (using full path name) to
  14. # link against to use BLAS
  15. # BLAS95_LIBRARIES - uncached list of libraries (using full path name)
  16. # to link against to use BLAS95 interface
  17. # BLAS95_FOUND - set to true if a library implementing the BLAS f95 interface
  18. # is found
  19. # BLA_STATIC if set on this determines what kind of linkage we do (static)
  20. # BLA_VENDOR if set checks only the specified vendor, if not set checks
  21. # all the possibilities
  22. # BLA_F95 if set on tries to find the f95 interfaces for BLAS/LAPACK
  23. ##########
  24. ### List of vendors (BLA_VENDOR) valid in this module
  25. ## 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),
  26. ## Intel10_64lp_seq (intel mkl v10 64 bit,sequential code, lp64 model),
  27. ## Intel( older versions of mkl 32 and 64 bit), ACML,ACML_MP,ACML_GPU,Apple, NAS, Generic
  28. # C/CXX should be enabled to use Intel mkl
  29. #=============================================================================
  30. # Copyright 2007-2009 Kitware, Inc.
  31. #
  32. # Distributed under the OSI-approved BSD License (the "License");
  33. # see accompanying file Copyright.txt for details.
  34. #
  35. # This software is distributed WITHOUT ANY WARRANTY; without even the
  36. # implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  37. # See the License for more information.
  38. #=============================================================================
  39. # (To distribute this file outside of CMake, substitute the full
  40. # License text for the above reference.)
  41. include(CheckFunctionExists)
  42. include(CheckFortranFunctionExists)
  43. set(_blas_ORIG_CMAKE_FIND_LIBRARY_SUFFIXES ${CMAKE_FIND_LIBRARY_SUFFIXES})
  44. # Check the language being used
  45. get_property( _LANGUAGES_ GLOBAL PROPERTY ENABLED_LANGUAGES )
  46. if( _LANGUAGES_ MATCHES Fortran )
  47. set( _CHECK_FORTRAN TRUE )
  48. elseif( (_LANGUAGES_ MATCHES C) OR (_LANGUAGES_ MATCHES CXX) )
  49. set( _CHECK_FORTRAN FALSE )
  50. else()
  51. if(BLAS_FIND_REQUIRED)
  52. message(FATAL_ERROR "FindBLAS requires Fortran, C, or C++ to be enabled.")
  53. else()
  54. message(STATUS "Looking for BLAS... - NOT found (Unsupported languages)")
  55. return()
  56. endif()
  57. endif()
  58. macro(Check_Fortran_Libraries LIBRARIES _prefix _name _flags _list _thread)
  59. # This macro checks for the existence of the combination of fortran libraries
  60. # given by _list. If the combination is found, this macro checks (using the
  61. # Check_Fortran_Function_Exists macro) whether can link against that library
  62. # combination using the name of a routine given by _name using the linker
  63. # flags given by _flags. If the combination of libraries is found and passes
  64. # the link test, LIBRARIES is set to the list of complete library paths that
  65. # have been found. Otherwise, LIBRARIES is set to FALSE.
  66. # N.B. _prefix is the prefix applied to the names of all cached variables that
  67. # are generated internally and marked advanced by this macro.
  68. set(_libdir ${ARGN})
  69. set(_libraries_work TRUE)
  70. set(${LIBRARIES})
  71. set(_combined_name)
  72. if (NOT _libdir)
  73. if (WIN32)
  74. set(_libdir ENV LIB)
  75. elseif (APPLE)
  76. set(_libdir ENV DYLD_LIBRARY_PATH)
  77. else ()
  78. set(_libdir ENV LD_LIBRARY_PATH)
  79. endif ()
  80. endif ()
  81. foreach(_library ${_list})
  82. set(_combined_name ${_combined_name}_${_library})
  83. if(_libraries_work)
  84. if (BLA_STATIC)
  85. if (WIN32)
  86. set(CMAKE_FIND_LIBRARY_SUFFIXES .lib ${CMAKE_FIND_LIBRARY_SUFFIXES})
  87. endif ()
  88. if (APPLE)
  89. set(CMAKE_FIND_LIBRARY_SUFFIXES .lib ${CMAKE_FIND_LIBRARY_SUFFIXES})
  90. else ()
  91. set(CMAKE_FIND_LIBRARY_SUFFIXES .a ${CMAKE_FIND_LIBRARY_SUFFIXES})
  92. endif ()
  93. else ()
  94. if (CMAKE_SYSTEM_NAME STREQUAL "Linux")
  95. # for ubuntu's libblas3gf and liblapack3gf packages
  96. set(CMAKE_FIND_LIBRARY_SUFFIXES ${CMAKE_FIND_LIBRARY_SUFFIXES} .so.3gf)
  97. endif ()
  98. endif ()
  99. find_library(${_prefix}_${_library}_LIBRARY
  100. NAMES ${_library}
  101. PATHS ${_libdir}
  102. )
  103. mark_as_advanced(${_prefix}_${_library}_LIBRARY)
  104. set(${LIBRARIES} ${${LIBRARIES}} ${${_prefix}_${_library}_LIBRARY})
  105. set(_libraries_work ${${_prefix}_${_library}_LIBRARY})
  106. endif()
  107. endforeach()
  108. if(_libraries_work)
  109. # Test this combination of libraries.
  110. set(CMAKE_REQUIRED_LIBRARIES ${_flags} ${${LIBRARIES}} ${_thread})
  111. # message("DEBUG: CMAKE_REQUIRED_LIBRARIES = ${CMAKE_REQUIRED_LIBRARIES}")
  112. if (_CHECK_FORTRAN)
  113. check_fortran_function_exists("${_name}" ${_prefix}${_combined_name}_WORKS)
  114. else()
  115. check_function_exists("${_name}_" ${_prefix}${_combined_name}_WORKS)
  116. endif()
  117. set(CMAKE_REQUIRED_LIBRARIES)
  118. mark_as_advanced(${_prefix}${_combined_name}_WORKS)
  119. set(_libraries_work ${${_prefix}${_combined_name}_WORKS})
  120. endif()
  121. if(NOT _libraries_work)
  122. set(${LIBRARIES} FALSE)
  123. endif()
  124. #message("DEBUG: ${LIBRARIES} = ${${LIBRARIES}}")
  125. endmacro()
  126. set(BLAS_LINKER_FLAGS)
  127. set(BLAS_LIBRARIES)
  128. set(BLAS95_LIBRARIES)
  129. if ($ENV{BLA_VENDOR} MATCHES ".+")
  130. set(BLA_VENDOR $ENV{BLA_VENDOR})
  131. else ()
  132. if(NOT BLA_VENDOR)
  133. set(BLA_VENDOR "All")
  134. endif()
  135. endif ()
  136. if (BLA_VENDOR STREQUAL "Goto" OR BLA_VENDOR STREQUAL "All")
  137. if(NOT BLAS_LIBRARIES)
  138. # gotoblas (http://www.tacc.utexas.edu/tacc-projects/gotoblas2)
  139. check_fortran_libraries(
  140. BLAS_LIBRARIES
  141. BLAS
  142. sgemm
  143. ""
  144. "goto2"
  145. ""
  146. )
  147. endif()
  148. endif ()
  149. if (BLA_VENDOR STREQUAL "ATLAS" OR BLA_VENDOR STREQUAL "All")
  150. if(NOT BLAS_LIBRARIES)
  151. # BLAS in ATLAS library? (http://math-atlas.sourceforge.net/)
  152. check_fortran_libraries(
  153. BLAS_LIBRARIES
  154. BLAS
  155. dgemm
  156. ""
  157. "f77blas;atlas"
  158. ""
  159. )
  160. endif()
  161. endif ()
  162. # BLAS in PhiPACK libraries? (requires generic BLAS lib, too)
  163. if (BLA_VENDOR STREQUAL "PhiPACK" OR BLA_VENDOR STREQUAL "All")
  164. if(NOT BLAS_LIBRARIES)
  165. check_fortran_libraries(
  166. BLAS_LIBRARIES
  167. BLAS
  168. sgemm
  169. ""
  170. "sgemm;dgemm;blas"
  171. ""
  172. )
  173. endif()
  174. endif ()
  175. # BLAS in Alpha CXML library?
  176. if (BLA_VENDOR STREQUAL "CXML" OR BLA_VENDOR STREQUAL "All")
  177. if(NOT BLAS_LIBRARIES)
  178. check_fortran_libraries(
  179. BLAS_LIBRARIES
  180. BLAS
  181. sgemm
  182. ""
  183. "cxml"
  184. ""
  185. )
  186. endif()
  187. endif ()
  188. # BLAS in Alpha DXML library? (now called CXML, see above)
  189. if (BLA_VENDOR STREQUAL "DXML" OR BLA_VENDOR STREQUAL "All")
  190. if(NOT BLAS_LIBRARIES)
  191. check_fortran_libraries(
  192. BLAS_LIBRARIES
  193. BLAS
  194. sgemm
  195. ""
  196. "dxml"
  197. ""
  198. )
  199. endif()
  200. endif ()
  201. # BLAS in Sun Performance library?
  202. if (BLA_VENDOR STREQUAL "SunPerf" OR BLA_VENDOR STREQUAL "All")
  203. if(NOT BLAS_LIBRARIES)
  204. check_fortran_libraries(
  205. BLAS_LIBRARIES
  206. BLAS
  207. sgemm
  208. "-xlic_lib=sunperf"
  209. "sunperf;sunmath"
  210. ""
  211. )
  212. if(BLAS_LIBRARIES)
  213. set(BLAS_LINKER_FLAGS "-xlic_lib=sunperf")
  214. endif()
  215. endif()
  216. endif ()
  217. # BLAS in SCSL library? (SGI/Cray Scientific Library)
  218. if (BLA_VENDOR STREQUAL "SCSL" OR BLA_VENDOR STREQUAL "All")
  219. if(NOT BLAS_LIBRARIES)
  220. check_fortran_libraries(
  221. BLAS_LIBRARIES
  222. BLAS
  223. sgemm
  224. ""
  225. "scsl"
  226. ""
  227. )
  228. endif()
  229. endif ()
  230. # BLAS in SGIMATH library?
  231. if (BLA_VENDOR STREQUAL "SGIMATH" OR BLA_VENDOR STREQUAL "All")
  232. if(NOT BLAS_LIBRARIES)
  233. check_fortran_libraries(
  234. BLAS_LIBRARIES
  235. BLAS
  236. sgemm
  237. ""
  238. "complib.sgimath"
  239. ""
  240. )
  241. endif()
  242. endif ()
  243. # BLAS in IBM ESSL library? (requires generic BLAS lib, too)
  244. if (BLA_VENDOR STREQUAL "IBMESSL" OR BLA_VENDOR STREQUAL "All")
  245. if(NOT BLAS_LIBRARIES)
  246. check_fortran_libraries(
  247. BLAS_LIBRARIES
  248. BLAS
  249. sgemm
  250. ""
  251. "essl;blas"
  252. ""
  253. )
  254. endif()
  255. endif ()
  256. #BLAS in acml library?
  257. if (BLA_VENDOR MATCHES "ACML.*" OR BLA_VENDOR STREQUAL "All")
  258. if( ((BLA_VENDOR STREQUAL "ACML") AND (NOT BLAS_ACML_LIB_DIRS)) OR
  259. ((BLA_VENDOR STREQUAL "ACML_MP") AND (NOT BLAS_ACML_MP_LIB_DIRS)) OR
  260. ((BLA_VENDOR STREQUAL "ACML_GPU") AND (NOT BLAS_ACML_GPU_LIB_DIRS))
  261. )
  262. # try to find acml in "standard" paths
  263. if( WIN32 )
  264. file( GLOB _ACML_ROOT "C:/AMD/acml*/ACML-EULA.txt" )
  265. else()
  266. file( GLOB _ACML_ROOT "/opt/acml*/ACML-EULA.txt" )
  267. endif()
  268. if( WIN32 )
  269. file( GLOB _ACML_GPU_ROOT "C:/AMD/acml*/GPGPUexamples" )
  270. else()
  271. file( GLOB _ACML_GPU_ROOT "/opt/acml*/GPGPUexamples" )
  272. endif()
  273. list(GET _ACML_ROOT 0 _ACML_ROOT)
  274. list(GET _ACML_GPU_ROOT 0 _ACML_GPU_ROOT)
  275. if( _ACML_ROOT )
  276. get_filename_component( _ACML_ROOT ${_ACML_ROOT} PATH )
  277. if( SIZEOF_INTEGER EQUAL 8 )
  278. set( _ACML_PATH_SUFFIX "_int64" )
  279. else()
  280. set( _ACML_PATH_SUFFIX "" )
  281. endif()
  282. if( CMAKE_Fortran_COMPILER_ID STREQUAL "Intel" )
  283. set( _ACML_COMPILER32 "ifort32" )
  284. set( _ACML_COMPILER64 "ifort64" )
  285. elseif( CMAKE_Fortran_COMPILER_ID STREQUAL "SunPro" )
  286. set( _ACML_COMPILER32 "sun32" )
  287. set( _ACML_COMPILER64 "sun64" )
  288. elseif( CMAKE_Fortran_COMPILER_ID STREQUAL "PGI" )
  289. set( _ACML_COMPILER32 "pgi32" )
  290. if( WIN32 )
  291. set( _ACML_COMPILER64 "win64" )
  292. else()
  293. set( _ACML_COMPILER64 "pgi64" )
  294. endif()
  295. elseif( CMAKE_Fortran_COMPILER_ID STREQUAL "Open64" )
  296. # 32 bit builds not supported on Open64 but for code simplicity
  297. # We'll just use the same directory twice
  298. set( _ACML_COMPILER32 "open64_64" )
  299. set( _ACML_COMPILER64 "open64_64" )
  300. elseif( CMAKE_Fortran_COMPILER_ID STREQUAL "NAG" )
  301. set( _ACML_COMPILER32 "nag32" )
  302. set( _ACML_COMPILER64 "nag64" )
  303. else()
  304. set( _ACML_COMPILER32 "gfortran32" )
  305. set( _ACML_COMPILER64 "gfortran64" )
  306. endif()
  307. if( BLA_VENDOR STREQUAL "ACML_MP" )
  308. set(_ACML_MP_LIB_DIRS
  309. "${_ACML_ROOT}/${_ACML_COMPILER32}_mp${_ACML_PATH_SUFFIX}/lib"
  310. "${_ACML_ROOT}/${_ACML_COMPILER64}_mp${_ACML_PATH_SUFFIX}/lib" )
  311. else()
  312. set(_ACML_LIB_DIRS
  313. "${_ACML_ROOT}/${_ACML_COMPILER32}${_ACML_PATH_SUFFIX}/lib"
  314. "${_ACML_ROOT}/${_ACML_COMPILER64}${_ACML_PATH_SUFFIX}/lib" )
  315. endif()
  316. endif()
  317. elseif(BLAS_${BLA_VENDOR}_LIB_DIRS)
  318. set(_${BLA_VENDOR}_LIB_DIRS ${BLAS_${BLA_VENDOR}_LIB_DIRS})
  319. endif()
  320. if( BLA_VENDOR STREQUAL "ACML_MP" )
  321. foreach( BLAS_ACML_MP_LIB_DIRS ${_ACML_MP_LIB_DIRS})
  322. check_fortran_libraries (
  323. BLAS_LIBRARIES
  324. BLAS
  325. sgemm
  326. "" "acml_mp;acml_mv" "" ${BLAS_ACML_MP_LIB_DIRS}
  327. )
  328. if( BLAS_LIBRARIES )
  329. break()
  330. endif()
  331. endforeach()
  332. elseif( BLA_VENDOR STREQUAL "ACML_GPU" )
  333. foreach( BLAS_ACML_GPU_LIB_DIRS ${_ACML_GPU_LIB_DIRS})
  334. check_fortran_libraries (
  335. BLAS_LIBRARIES
  336. BLAS
  337. sgemm
  338. "" "acml;acml_mv;CALBLAS" "" ${BLAS_ACML_GPU_LIB_DIRS}
  339. )
  340. if( BLAS_LIBRARIES )
  341. break()
  342. endif()
  343. endforeach()
  344. else()
  345. foreach( BLAS_ACML_LIB_DIRS ${_ACML_LIB_DIRS} )
  346. check_fortran_libraries (
  347. BLAS_LIBRARIES
  348. BLAS
  349. sgemm
  350. "" "acml;acml_mv" "" ${BLAS_ACML_LIB_DIRS}
  351. )
  352. if( BLAS_LIBRARIES )
  353. break()
  354. endif()
  355. endforeach()
  356. endif()
  357. # Either acml or acml_mp should be in LD_LIBRARY_PATH but not both
  358. if(NOT BLAS_LIBRARIES)
  359. check_fortran_libraries(
  360. BLAS_LIBRARIES
  361. BLAS
  362. sgemm
  363. ""
  364. "acml;acml_mv"
  365. ""
  366. )
  367. endif()
  368. if(NOT BLAS_LIBRARIES)
  369. check_fortran_libraries(
  370. BLAS_LIBRARIES
  371. BLAS
  372. sgemm
  373. ""
  374. "acml_mp;acml_mv"
  375. ""
  376. )
  377. endif()
  378. if(NOT BLAS_LIBRARIES)
  379. check_fortran_libraries(
  380. BLAS_LIBRARIES
  381. BLAS
  382. sgemm
  383. ""
  384. "acml;acml_mv;CALBLAS"
  385. ""
  386. )
  387. endif()
  388. endif () # ACML
  389. # Apple BLAS library?
  390. if (BLA_VENDOR STREQUAL "Apple" OR BLA_VENDOR STREQUAL "All")
  391. if(NOT BLAS_LIBRARIES)
  392. check_fortran_libraries(
  393. BLAS_LIBRARIES
  394. BLAS
  395. dgemm
  396. ""
  397. "Accelerate"
  398. ""
  399. )
  400. endif()
  401. endif ()
  402. if (BLA_VENDOR STREQUAL "NAS" OR BLA_VENDOR STREQUAL "All")
  403. if ( NOT BLAS_LIBRARIES )
  404. check_fortran_libraries(
  405. BLAS_LIBRARIES
  406. BLAS
  407. dgemm
  408. ""
  409. "vecLib"
  410. ""
  411. )
  412. endif ()
  413. endif ()
  414. # Generic BLAS library?
  415. if (BLA_VENDOR STREQUAL "Generic" OR BLA_VENDOR STREQUAL "All")
  416. if(NOT BLAS_LIBRARIES)
  417. check_fortran_libraries(
  418. BLAS_LIBRARIES
  419. BLAS
  420. sgemm
  421. ""
  422. "blas"
  423. ""
  424. )
  425. endif()
  426. endif ()
  427. #BLAS in intel mkl 10 library? (em64t 64bit)
  428. if (BLA_VENDOR MATCHES "Intel*" OR BLA_VENDOR STREQUAL "All")
  429. if (NOT WIN32)
  430. set(LM "-lm")
  431. endif ()
  432. if (_LANGUAGES_ MATCHES C OR _LANGUAGES_ MATCHES CXX)
  433. if(BLAS_FIND_QUIETLY OR NOT BLAS_FIND_REQUIRED)
  434. find_package(Threads)
  435. else()
  436. find_package(Threads REQUIRED)
  437. endif()
  438. set(BLAS_SEARCH_LIBS "")
  439. if(BLA_F95)
  440. set(BLAS_mkl_SEARCH_SYMBOL SGEMM)
  441. set(_LIBRARIES BLAS95_LIBRARIES)
  442. if (WIN32)
  443. list(APPEND BLAS_SEARCH_LIBS
  444. "mkl_blas95 mkl_intel_c mkl_intel_thread mkl_core libguide40")
  445. else ()
  446. if (BLA_VENDOR STREQUAL "Intel10_32" OR BLA_VENDOR STREQUAL "All")
  447. list(APPEND BLAS_SEARCH_LIBS
  448. "mkl_blas95 mkl_intel mkl_intel_thread mkl_core guide")
  449. endif ()
  450. if (BLA_VENDOR STREQUAL "Intel10_64lp" OR BLA_VENDOR STREQUAL "All")
  451. # old version
  452. list(APPEND BLAS_SEARCH_LIBS
  453. "mkl_blas95 mkl_intel_lp64 mkl_intel_thread mkl_core guide")
  454. # mkl >= 10.3
  455. if (CMAKE_C_COMPILER MATCHES ".+gcc.*")
  456. list(APPEND BLAS_SEARCH_LIBS
  457. "mkl_blas95_lp64 mkl_intel_lp64 mkl_gnu_thread mkl_core gomp")
  458. else ()
  459. list(APPEND BLAS_SEARCH_LIBS
  460. "mkl_blas95_lp64 mkl_intel_lp64 mkl_intel_thread mkl_core iomp5")
  461. endif ()
  462. endif ()
  463. endif ()
  464. if (BLA_VENDOR STREQUAL "Intel10_64lp_seq" OR BLA_VENDOR STREQUAL "All")
  465. list(APPEND BLAS_SEARCH_LIBS
  466. "mkl_blas95_lp64 mkl_intel_lp64 mkl_sequential mkl_core")
  467. endif ()
  468. else ()
  469. set(BLAS_mkl_SEARCH_SYMBOL sgemm)
  470. set(_LIBRARIES BLAS_LIBRARIES)
  471. if (WIN32)
  472. list(APPEND BLAS_SEARCH_LIBS
  473. "mkl_c_dll mkl_intel_thread_dll mkl_core_dll libguide40")
  474. else ()
  475. if (BLA_VENDOR STREQUAL "Intel10_32" OR BLA_VENDOR STREQUAL "All")
  476. list(APPEND BLAS_SEARCH_LIBS
  477. "mkl_intel mkl_intel_thread mkl_core guide")
  478. endif ()
  479. if (BLA_VENDOR STREQUAL "Intel10_64lp" OR BLA_VENDOR STREQUAL "All")
  480. # old version
  481. list(APPEND BLAS_SEARCH_LIBS
  482. "mkl_intel_lp64 mkl_intel_thread mkl_core guide")
  483. # mkl >= 10.3
  484. if (CMAKE_C_COMPILER MATCHES ".+gcc.*")
  485. list(APPEND BLAS_SEARCH_LIBS
  486. "mkl_intel_lp64 mkl_gnu_thread mkl_core gomp")
  487. else ()
  488. list(APPEND BLAS_SEARCH_LIBS
  489. "mkl_intel_lp64 mkl_intel_thread mkl_core iomp5")
  490. endif ()
  491. endif ()
  492. #older vesions of intel mkl libs
  493. if (BLA_VENDOR STREQUAL "Intel" OR BLA_VENDOR STREQUAL "All")
  494. list(APPEND BLAS_SEARCH_LIBS
  495. "mkl")
  496. list(APPEND BLAS_SEARCH_LIBS
  497. "mkl_ia32")
  498. list(APPEND BLAS_SEARCH_LIBS
  499. "mkl_em64t")
  500. endif ()
  501. endif ()
  502. if (BLA_VENDOR STREQUAL "Intel10_64lp_seq" OR BLA_VENDOR STREQUAL "All")
  503. list(APPEND BLAS_SEARCH_LIBS
  504. "mkl_intel_lp64 mkl_sequential mkl_core")
  505. endif ()
  506. endif ()
  507. foreach (IT ${BLAS_SEARCH_LIBS})
  508. string(REPLACE " " ";" SEARCH_LIBS ${IT})
  509. if (${_LIBRARIES})
  510. else ()
  511. check_fortran_libraries(
  512. ${_LIBRARIES}
  513. BLAS
  514. ${BLAS_mkl_SEARCH_SYMBOL}
  515. ""
  516. "${SEARCH_LIBS}"
  517. "${CMAKE_THREAD_LIBS_INIT};${LM}"
  518. )
  519. endif ()
  520. endforeach ()
  521. endif ()
  522. endif ()
  523. if(BLA_F95)
  524. if(BLAS95_LIBRARIES)
  525. set(BLAS95_FOUND TRUE)
  526. else()
  527. set(BLAS95_FOUND FALSE)
  528. endif()
  529. if(NOT BLAS_FIND_QUIETLY)
  530. if(BLAS95_FOUND)
  531. message(STATUS "A library with BLAS95 API found.")
  532. else()
  533. if(BLAS_FIND_REQUIRED)
  534. message(FATAL_ERROR
  535. "A required library with BLAS95 API not found. Please specify library location.")
  536. else()
  537. message(STATUS
  538. "A library with BLAS95 API not found. Please specify library location.")
  539. endif()
  540. endif()
  541. endif()
  542. set(BLAS_FOUND TRUE)
  543. set(BLAS_LIBRARIES "${BLAS95_LIBRARIES}")
  544. else()
  545. if(BLAS_LIBRARIES)
  546. set(BLAS_FOUND TRUE)
  547. else()
  548. set(BLAS_FOUND FALSE)
  549. endif()
  550. if(NOT BLAS_FIND_QUIETLY)
  551. if(BLAS_FOUND)
  552. message(STATUS "A library with BLAS API found.")
  553. else()
  554. if(BLAS_FIND_REQUIRED)
  555. message(FATAL_ERROR
  556. "A required library with BLAS API not found. Please specify library location."
  557. )
  558. else()
  559. message(STATUS
  560. "A library with BLAS API not found. Please specify library location."
  561. )
  562. endif()
  563. endif()
  564. endif()
  565. endif()
  566. set(CMAKE_FIND_LIBRARY_SUFFIXES ${_blas_ORIG_CMAKE_FIND_LIBRARY_SUFFIXES})