FindBLAS.cmake 17 KB

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