FindBLAS.cmake 31 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094
  1. # Distributed under the OSI-approved BSD 3-Clause License. See accompanying
  2. # file Copyright.txt or https://cmake.org/licensing for details.
  3. #[=======================================================================[.rst:
  4. FindBLAS
  5. --------
  6. Find Basic Linear Algebra Subprograms (BLAS) library
  7. This module finds an installed Fortran library that implements the
  8. BLAS linear-algebra interface (see http://www.netlib.org/blas/).
  9. The approach follows that taken for the ``autoconf`` macro file,
  10. ``acx_blas.m4`` (distributed at
  11. http://ac-archive.sourceforge.net/ac-archive/acx_blas.html).
  12. Input Variables
  13. ^^^^^^^^^^^^^^^
  14. The following variables may be set to influence this module's behavior:
  15. ``BLA_STATIC``
  16. if ``ON`` use static linkage
  17. ``BLA_VENDOR``
  18. If set, checks only the specified vendor, if not set checks all the
  19. possibilities. List of vendors valid in this module:
  20. * ``Goto``
  21. * ``FlexiBLAS``
  22. * ``OpenBLAS``
  23. * ``FLAME``
  24. * ``ATLAS PhiPACK``
  25. * ``CXML``
  26. * ``DXML``
  27. * ``SunPerf``
  28. * ``SCSL``
  29. * ``SGIMATH``
  30. * ``IBMESSL``
  31. * ``Intel10_32`` (intel mkl v10 32 bit, threaded code)
  32. * ``Intel10_64lp`` (intel mkl v10+ 64 bit, threaded code, lp64 model)
  33. * ``Intel10_64lp_seq`` (intel mkl v10+ 64 bit, sequential code, lp64 model)
  34. * ``Intel10_64ilp`` (intel mkl v10+ 64 bit, threaded code, ilp64 model)
  35. * ``Intel10_64ilp_seq`` (intel mkl v10+ 64 bit, sequential code, ilp64 model)
  36. * ``Intel10_64_dyn`` (intel mkl v10+ 64 bit, single dynamic library)
  37. * ``Intel`` (obsolete versions of mkl 32 and 64 bit)
  38. * ``ACML``
  39. * ``ACML_MP``
  40. * ``ACML_GPU``
  41. * ``Apple``
  42. * ``NAS``
  43. * ``Arm``
  44. * ``Arm_mp``
  45. * ``Arm_ilp64``
  46. * ``Arm_ilp64_mp``
  47. * ``EML``
  48. * ``EML_mt``
  49. * ``Fujitsu_SSL2`` (Fujitsu serial blas / lapack)
  50. * ``Fujitsu_SSL2BLAMP`` (Fujitsu parallel blas / lapack)
  51. * ``Generic``
  52. .. versionadded:: 3.6
  53. ``OpenBLAS`` support.
  54. .. versionadded:: 3.11
  55. ``FLAME`` support.
  56. .. versionadded:: 3.13
  57. Added ILP64 MKL variants (``Intel10_64ilp``, ``Intel10_64ilp_seq``).
  58. .. versionadded:: 3.17
  59. Added single dynamic library MKL variant (``Intel10_64_dyn``).
  60. .. versionadded:: 3.18
  61. Arm Performance Libraries support (``Arm``, ``Arm_mp``, ``Arm_ilp64``,
  62. ``Arm_ilp64_mp``).
  63. .. versionadded:: 3.19
  64. ``FlexiBLAS`` support.
  65. .. versionadded:: 3.20
  66. Elbrus Math Library support (``EML``, ``EML_mt``).
  67. Fujitsu SSL2 Library support (``Fujitsu_SSL2``, ``Fujitsu_SSL2BLAMP``)
  68. ``BLA_F95``
  69. if ``ON`` tries to find the BLAS95 interfaces
  70. ``BLA_PREFER_PKGCONFIG``
  71. .. versionadded:: 3.11
  72. if set ``pkg-config`` will be used to search for a BLAS library first
  73. and if one is found that is preferred
  74. Imported targets
  75. ^^^^^^^^^^^^^^^^
  76. .. versionadded:: 3.18
  77. This module defines the following :prop_tgt:`IMPORTED` target:
  78. ``BLAS::BLAS``
  79. The libraries to use for BLAS, if found.
  80. Result Variables
  81. ^^^^^^^^^^^^^^^^
  82. This module defines the following variables:
  83. ``BLAS_FOUND``
  84. library implementing the BLAS interface is found
  85. ``BLAS_LINKER_FLAGS``
  86. uncached list of required linker flags (excluding ``-l`` and ``-L``).
  87. ``BLAS_LIBRARIES``
  88. uncached list of libraries (using full path name) to link against
  89. to use BLAS (may be empty if compiler implicitly links BLAS)
  90. ``BLAS95_LIBRARIES``
  91. uncached list of libraries (using full path name) to link against
  92. to use BLAS95 interface
  93. ``BLAS95_FOUND``
  94. library implementing the BLAS95 interface is found
  95. .. note::
  96. C, CXX or Fortran must be enabled to detect a BLAS library.
  97. C or CXX must be enabled to use Intel Math Kernel Library (MKL).
  98. For example, to use Intel MKL libraries and/or Intel compiler:
  99. .. code-block:: cmake
  100. set(BLA_VENDOR Intel10_64lp)
  101. find_package(BLAS)
  102. Hints
  103. ^^^^^
  104. ``MKLROOT``
  105. .. versionadded:: 3.15
  106. Set this environment variable to a directory that contains an MKL
  107. installation, or add the directory to the dynamic library loader environment
  108. variable for your platform (``LIB``, ``DYLD_LIBRARY_PATH`` or
  109. ``LD_LIBRARY_PATH``).
  110. #]=======================================================================]
  111. # Check the language being used
  112. if(NOT (CMAKE_C_COMPILER_LOADED OR CMAKE_CXX_COMPILER_LOADED OR CMAKE_Fortran_COMPILER_LOADED))
  113. if(BLAS_FIND_REQUIRED)
  114. message(FATAL_ERROR "FindBLAS requires Fortran, C, or C++ to be enabled.")
  115. else()
  116. message(STATUS "Looking for BLAS... - NOT found (Unsupported languages)")
  117. return()
  118. endif()
  119. endif()
  120. function(_add_blas_target)
  121. if(BLAS_FOUND AND NOT TARGET BLAS::BLAS)
  122. add_library(BLAS::BLAS INTERFACE IMPORTED)
  123. if(BLAS_LIBRARIES)
  124. set_target_properties(BLAS::BLAS PROPERTIES
  125. INTERFACE_LINK_LIBRARIES "${BLAS_LIBRARIES}"
  126. )
  127. endif()
  128. if(BLAS_LINKER_FLAGS)
  129. set_target_properties(BLAS::BLAS PROPERTIES
  130. INTERFACE_LINK_OPTIONS "${BLAS_LINKER_FLAGS}"
  131. )
  132. endif()
  133. endif()
  134. endfunction()
  135. if(CMAKE_Fortran_COMPILER_LOADED)
  136. include(${CMAKE_CURRENT_LIST_DIR}/CheckFortranFunctionExists.cmake)
  137. else()
  138. include(${CMAKE_CURRENT_LIST_DIR}/CheckFunctionExists.cmake)
  139. endif()
  140. include(${CMAKE_CURRENT_LIST_DIR}/CMakePushCheckState.cmake)
  141. include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake)
  142. cmake_push_check_state()
  143. set(CMAKE_REQUIRED_QUIET ${BLAS_FIND_QUIETLY})
  144. if(BLA_PREFER_PKGCONFIG)
  145. find_package(PkgConfig)
  146. pkg_check_modules(PKGC_BLAS blas)
  147. if(PKGC_BLAS_FOUND)
  148. set(BLAS_FOUND ${PKGC_BLAS_FOUND})
  149. set(BLAS_LIBRARIES "${PKGC_BLAS_LINK_LIBRARIES}")
  150. _add_blas_target()
  151. return()
  152. endif()
  153. endif()
  154. set(_blas_ORIG_CMAKE_FIND_LIBRARY_SUFFIXES ${CMAKE_FIND_LIBRARY_SUFFIXES})
  155. if(BLA_STATIC)
  156. if(WIN32)
  157. set(CMAKE_FIND_LIBRARY_SUFFIXES .lib ${CMAKE_FIND_LIBRARY_SUFFIXES})
  158. else()
  159. set(CMAKE_FIND_LIBRARY_SUFFIXES .a ${CMAKE_FIND_LIBRARY_SUFFIXES})
  160. endif()
  161. else()
  162. if(CMAKE_SYSTEM_NAME STREQUAL "Linux")
  163. # for ubuntu's libblas3gf and liblapack3gf packages
  164. set(CMAKE_FIND_LIBRARY_SUFFIXES ${CMAKE_FIND_LIBRARY_SUFFIXES} .so.3gf)
  165. endif()
  166. endif()
  167. # TODO: move this stuff to a separate module
  168. macro(CHECK_BLAS_LIBRARIES LIBRARIES _prefix _name _flags _list _deps _addlibdir _subdirs)
  169. # This macro checks for the existence of the combination of fortran libraries
  170. # given by _list. If the combination is found, this macro checks (using the
  171. # Check_Fortran_Function_Exists macro) whether can link against that library
  172. # combination using the name of a routine given by _name using the linker
  173. # flags given by _flags. If the combination of libraries is found and passes
  174. # the link test, LIBRARIES is set to the list of complete library paths that
  175. # have been found. Otherwise, LIBRARIES is set to FALSE.
  176. # N.B. _prefix is the prefix applied to the names of all cached variables that
  177. # are generated internally and marked advanced by this macro.
  178. # _addlibdir is a list of additional search paths. _subdirs is a list of path
  179. # suffixes to be used by find_library().
  180. set(_libraries_work TRUE)
  181. set(${LIBRARIES})
  182. set(_combined_name)
  183. set(_extaddlibdir "${_addlibdir}")
  184. if(WIN32)
  185. list(APPEND _extaddlibdir ENV LIB)
  186. elseif(APPLE)
  187. list(APPEND _extaddlibdir ENV DYLD_LIBRARY_PATH)
  188. else()
  189. list(APPEND _extaddlibdir ENV LD_LIBRARY_PATH)
  190. endif()
  191. list(APPEND _extaddlibdir "${CMAKE_C_IMPLICIT_LINK_DIRECTORIES}")
  192. foreach(_library ${_list})
  193. if(_library MATCHES "^-Wl,--(start|end)-group$")
  194. # Respect linker flags like --start/end-group (required by MKL)
  195. list(APPEND ${LIBRARIES} "${_library}")
  196. else()
  197. set(_combined_name ${_combined_name}_${_library})
  198. if(NOT "${_deps}" STREQUAL "")
  199. set(_combined_name ${_combined_name}_deps)
  200. endif()
  201. if(_libraries_work)
  202. find_library(${_prefix}_${_library}_LIBRARY
  203. NAMES ${_library}
  204. NAMES_PER_DIR
  205. PATHS ${_extaddlibdir}
  206. PATH_SUFFIXES ${_subdirs}
  207. )
  208. mark_as_advanced(${_prefix}_${_library}_LIBRARY)
  209. list(APPEND ${LIBRARIES} ${${_prefix}_${_library}_LIBRARY})
  210. set(_libraries_work ${${_prefix}_${_library}_LIBRARY})
  211. endif()
  212. endif()
  213. endforeach()
  214. foreach(_flag ${_flags})
  215. string(REGEX REPLACE "[^A-Za-z0-9]" "_" _flag_var "${_flag}")
  216. set(_combined_name ${_combined_name}_${_flag_var})
  217. endforeach()
  218. if(_libraries_work)
  219. # Test this combination of libraries.
  220. set(CMAKE_REQUIRED_LIBRARIES ${_flags} ${${LIBRARIES}} ${_deps})
  221. if(CMAKE_Fortran_COMPILER_LOADED)
  222. check_fortran_function_exists("${_name}" ${_prefix}${_combined_name}_WORKS)
  223. else()
  224. check_function_exists("${_name}_" ${_prefix}${_combined_name}_WORKS)
  225. endif()
  226. set(CMAKE_REQUIRED_LIBRARIES)
  227. set(_libraries_work ${${_prefix}${_combined_name}_WORKS})
  228. endif()
  229. if(_libraries_work)
  230. if("${_list}" STREQUAL "")
  231. set(${LIBRARIES} "${LIBRARIES}-PLACEHOLDER-FOR-EMPTY-LIBRARIES")
  232. else()
  233. list(APPEND ${LIBRARIES} ${_deps})
  234. endif()
  235. else()
  236. set(${LIBRARIES} FALSE)
  237. endif()
  238. endmacro()
  239. set(BLAS_LINKER_FLAGS)
  240. set(BLAS_LIBRARIES)
  241. set(BLAS95_LIBRARIES)
  242. set(_blas_fphsa_req_var BLAS_LIBRARIES)
  243. if(NOT $ENV{BLA_VENDOR} STREQUAL "")
  244. set(BLA_VENDOR $ENV{BLA_VENDOR})
  245. else()
  246. if(NOT BLA_VENDOR)
  247. set(BLA_VENDOR "All")
  248. endif()
  249. endif()
  250. # Implicitly linked BLAS libraries?
  251. if(BLA_VENDOR STREQUAL "All")
  252. if(NOT BLAS_LIBRARIES)
  253. check_blas_libraries(
  254. BLAS_LIBRARIES
  255. BLAS
  256. sgemm
  257. ""
  258. ""
  259. ""
  260. ""
  261. ""
  262. )
  263. endif()
  264. if(BLAS_WORKS)
  265. set(_blas_fphsa_req_var BLAS_WORKS)
  266. endif()
  267. endif()
  268. # BLAS in the Intel MKL 10+ library?
  269. if(BLA_VENDOR MATCHES "Intel" OR BLA_VENDOR STREQUAL "All")
  270. if(NOT BLAS_LIBRARIES)
  271. if(CMAKE_C_COMPILER_LOADED OR CMAKE_CXX_COMPILER_LOADED)
  272. # System-specific settings
  273. if(WIN32)
  274. if(BLA_STATIC)
  275. set(BLAS_mkl_DLL_SUFFIX "")
  276. else()
  277. set(BLAS_mkl_DLL_SUFFIX "_dll")
  278. endif()
  279. else()
  280. if(BLA_STATIC)
  281. set(BLAS_mkl_START_GROUP "-Wl,--start-group")
  282. set(BLAS_mkl_END_GROUP "-Wl,--end-group")
  283. else()
  284. set(BLAS_mkl_START_GROUP "")
  285. set(BLAS_mkl_END_GROUP "")
  286. endif()
  287. # Switch to GNU Fortran support layer if needed (but not on Apple, where MKL does not provide it)
  288. if(CMAKE_Fortran_COMPILER_LOADED AND CMAKE_Fortran_COMPILER_ID STREQUAL "GNU" AND NOT APPLE)
  289. set(BLAS_mkl_INTFACE "gf")
  290. set(BLAS_mkl_THREADING "gnu")
  291. set(BLAS_mkl_OMP "gomp")
  292. else()
  293. set(BLAS_mkl_INTFACE "intel")
  294. set(BLAS_mkl_THREADING "intel")
  295. set(BLAS_mkl_OMP "iomp5")
  296. endif()
  297. set(BLAS_mkl_LM "-lm")
  298. set(BLAS_mkl_LDL "-ldl")
  299. endif()
  300. if(BLAS_FIND_QUIETLY OR NOT BLAS_FIND_REQUIRED)
  301. find_package(Threads)
  302. else()
  303. find_package(Threads REQUIRED)
  304. endif()
  305. if(BLA_VENDOR MATCHES "_64ilp")
  306. set(BLAS_mkl_ILP_MODE "ilp64")
  307. else()
  308. set(BLAS_mkl_ILP_MODE "lp64")
  309. endif()
  310. set(BLAS_SEARCH_LIBS "")
  311. if(BLA_F95)
  312. set(BLAS_mkl_SEARCH_SYMBOL "sgemm_f95")
  313. set(_LIBRARIES BLAS95_LIBRARIES)
  314. if(WIN32)
  315. # Find the main file (32-bit or 64-bit)
  316. set(BLAS_SEARCH_LIBS_WIN_MAIN "")
  317. if(BLA_VENDOR STREQUAL "Intel10_32" OR BLA_VENDOR STREQUAL "All")
  318. list(APPEND BLAS_SEARCH_LIBS_WIN_MAIN
  319. "mkl_blas95${BLAS_mkl_DLL_SUFFIX} mkl_intel_c${BLAS_mkl_DLL_SUFFIX}")
  320. endif()
  321. if(BLA_VENDOR MATCHES "^Intel10_64i?lp" OR BLA_VENDOR STREQUAL "All")
  322. list(APPEND BLAS_SEARCH_LIBS_WIN_MAIN
  323. "mkl_blas95_${BLAS_mkl_ILP_MODE}${BLAS_mkl_DLL_SUFFIX} mkl_intel_${BLAS_mkl_ILP_MODE}${BLAS_mkl_DLL_SUFFIX}")
  324. endif()
  325. # Add threading/sequential libs
  326. set(BLAS_SEARCH_LIBS_WIN_THREAD "")
  327. if(BLA_VENDOR MATCHES "^Intel10_64i?lp$" OR BLA_VENDOR STREQUAL "All")
  328. # old version
  329. list(APPEND BLAS_SEARCH_LIBS_WIN_THREAD
  330. "libguide40 mkl_intel_thread${BLAS_mkl_DLL_SUFFIX}")
  331. # mkl >= 10.3
  332. list(APPEND BLAS_SEARCH_LIBS_WIN_THREAD
  333. "libiomp5md mkl_intel_thread${BLAS_mkl_DLL_SUFFIX}")
  334. endif()
  335. if(BLA_VENDOR MATCHES "^Intel10_64i?lp_seq$" OR BLA_VENDOR STREQUAL "All")
  336. list(APPEND BLAS_SEARCH_LIBS_WIN_THREAD
  337. "mkl_sequential${BLAS_mkl_DLL_SUFFIX}")
  338. endif()
  339. # Cartesian product of the above
  340. foreach(MAIN ${BLAS_SEARCH_LIBS_WIN_MAIN})
  341. foreach(THREAD ${BLAS_SEARCH_LIBS_WIN_THREAD})
  342. list(APPEND BLAS_SEARCH_LIBS
  343. "${MAIN} ${THREAD} mkl_core${BLAS_mkl_DLL_SUFFIX}")
  344. endforeach()
  345. endforeach()
  346. else()
  347. if(BLA_VENDOR STREQUAL "Intel10_32" OR BLA_VENDOR STREQUAL "All")
  348. # old version
  349. list(APPEND BLAS_SEARCH_LIBS
  350. "mkl_blas95 mkl_${BLAS_mkl_INTFACE} mkl_${BLAS_mkl_THREADING}_thread mkl_core guide")
  351. # mkl >= 10.3
  352. list(APPEND BLAS_SEARCH_LIBS
  353. "${BLAS_mkl_START_GROUP} mkl_blas95 mkl_${BLAS_mkl_INTFACE} mkl_${BLAS_mkl_THREADING}_thread mkl_core ${BLAS_mkl_END_GROUP} ${BLAS_mkl_OMP}")
  354. endif()
  355. if(BLA_VENDOR MATCHES "^Intel10_64i?lp$" OR BLA_VENDOR STREQUAL "All")
  356. # old version
  357. list(APPEND BLAS_SEARCH_LIBS
  358. "mkl_blas95 mkl_${BLAS_mkl_INTFACE}_${BLAS_mkl_ILP_MODE} mkl_${BLAS_mkl_THREADING}_thread mkl_core guide")
  359. # mkl >= 10.3
  360. list(APPEND BLAS_SEARCH_LIBS
  361. "${BLAS_mkl_START_GROUP} mkl_blas95_${BLAS_mkl_ILP_MODE} mkl_${BLAS_mkl_INTFACE}_${BLAS_mkl_ILP_MODE} mkl_${BLAS_mkl_THREADING}_thread mkl_core ${BLAS_mkl_END_GROUP} ${BLAS_mkl_OMP}")
  362. endif()
  363. if(BLA_VENDOR MATCHES "^Intel10_64i?lp_seq$" OR BLA_VENDOR STREQUAL "All")
  364. list(APPEND BLAS_SEARCH_LIBS
  365. "${BLAS_mkl_START_GROUP} mkl_blas95_${BLAS_mkl_ILP_MODE} mkl_${BLAS_mkl_INTFACE}_${BLAS_mkl_ILP_MODE} mkl_sequential mkl_core ${BLAS_mkl_END_GROUP}")
  366. endif()
  367. endif()
  368. else()
  369. set(BLAS_mkl_SEARCH_SYMBOL sgemm)
  370. set(_LIBRARIES BLAS_LIBRARIES)
  371. if(WIN32)
  372. # Find the main file (32-bit or 64-bit)
  373. set(BLAS_SEARCH_LIBS_WIN_MAIN "")
  374. if(BLA_VENDOR STREQUAL "Intel10_32" OR BLA_VENDOR STREQUAL "All")
  375. list(APPEND BLAS_SEARCH_LIBS_WIN_MAIN
  376. "mkl_intel_c${BLAS_mkl_DLL_SUFFIX}")
  377. endif()
  378. if(BLA_VENDOR MATCHES "^Intel10_64i?lp" OR BLA_VENDOR STREQUAL "All")
  379. list(APPEND BLAS_SEARCH_LIBS_WIN_MAIN
  380. "mkl_intel_${BLAS_mkl_ILP_MODE}${BLAS_mkl_DLL_SUFFIX}")
  381. endif()
  382. # Add threading/sequential libs
  383. set(BLAS_SEARCH_LIBS_WIN_THREAD "")
  384. if(BLA_VENDOR STREQUAL "Intel10_32" OR BLA_VENDOR STREQUAL "All")
  385. list(APPEND BLAS_SEARCH_LIBS_WIN_THREAD
  386. "libiomp5md mkl_intel_thread${BLAS_mkl_DLL_SUFFIX}")
  387. endif()
  388. if(BLA_VENDOR MATCHES "^Intel10_64i?lp$" OR BLA_VENDOR STREQUAL "All")
  389. # old version
  390. list(APPEND BLAS_SEARCH_LIBS_WIN_THREAD
  391. "libguide40 mkl_intel_thread${BLAS_mkl_DLL_SUFFIX}")
  392. # mkl >= 10.3
  393. list(APPEND BLAS_SEARCH_LIBS_WIN_THREAD
  394. "libiomp5md mkl_intel_thread${BLAS_mkl_DLL_SUFFIX}")
  395. endif()
  396. if(BLA_VENDOR MATCHES "^Intel10_64i?lp_seq$" OR BLA_VENDOR STREQUAL "All")
  397. list(APPEND BLAS_SEARCH_LIBS_WIN_THREAD
  398. "mkl_sequential${BLAS_mkl_DLL_SUFFIX}")
  399. endif()
  400. # Cartesian product of the above
  401. foreach(MAIN ${BLAS_SEARCH_LIBS_WIN_MAIN})
  402. foreach(THREAD ${BLAS_SEARCH_LIBS_WIN_THREAD})
  403. list(APPEND BLAS_SEARCH_LIBS
  404. "${MAIN} ${THREAD} mkl_core${BLAS_mkl_DLL_SUFFIX}")
  405. endforeach()
  406. endforeach()
  407. else()
  408. if(BLA_VENDOR STREQUAL "Intel10_32" OR BLA_VENDOR STREQUAL "All")
  409. # old version
  410. list(APPEND BLAS_SEARCH_LIBS
  411. "mkl_${BLAS_mkl_INTFACE} mkl_${BLAS_mkl_THREADING}_thread mkl_core guide")
  412. # mkl >= 10.3
  413. list(APPEND BLAS_SEARCH_LIBS
  414. "${BLAS_mkl_START_GROUP} mkl_${BLAS_mkl_INTFACE} mkl_${BLAS_mkl_THREADING}_thread mkl_core ${BLAS_mkl_END_GROUP} ${BLAS_mkl_OMP}")
  415. endif()
  416. if(BLA_VENDOR MATCHES "^Intel10_64i?lp$" OR BLA_VENDOR STREQUAL "All")
  417. # old version
  418. list(APPEND BLAS_SEARCH_LIBS
  419. "mkl_${BLAS_mkl_INTFACE}_${BLAS_mkl_ILP_MODE} mkl_${BLAS_mkl_THREADING}_thread mkl_core guide")
  420. # mkl >= 10.3
  421. list(APPEND BLAS_SEARCH_LIBS
  422. "${BLAS_mkl_START_GROUP} mkl_${BLAS_mkl_INTFACE}_${BLAS_mkl_ILP_MODE} mkl_${BLAS_mkl_THREADING}_thread mkl_core ${BLAS_mkl_END_GROUP} ${BLAS_mkl_OMP}")
  423. endif()
  424. if(BLA_VENDOR MATCHES "^Intel10_64i?lp_seq$" OR BLA_VENDOR STREQUAL "All")
  425. list(APPEND BLAS_SEARCH_LIBS
  426. "${BLAS_mkl_START_GROUP} mkl_${BLAS_mkl_INTFACE}_${BLAS_mkl_ILP_MODE} mkl_sequential mkl_core ${BLAS_mkl_END_GROUP}")
  427. endif()
  428. #older versions of intel mkl libs
  429. if(BLA_VENDOR STREQUAL "Intel" OR BLA_VENDOR STREQUAL "All")
  430. list(APPEND BLAS_SEARCH_LIBS
  431. "mkl")
  432. list(APPEND BLAS_SEARCH_LIBS
  433. "mkl_ia32")
  434. list(APPEND BLAS_SEARCH_LIBS
  435. "mkl_em64t")
  436. endif()
  437. endif()
  438. endif()
  439. if(BLA_VENDOR MATCHES "^Intel10_64_dyn$" OR BLA_VENDOR STREQUAL "All")
  440. # mkl >= 10.3 with single dynamic library
  441. list(APPEND BLAS_SEARCH_LIBS
  442. "mkl_rt")
  443. endif()
  444. # MKL uses a multitude of partially platform-specific subdirectories:
  445. if(BLA_VENDOR STREQUAL "Intel10_32")
  446. set(BLAS_mkl_ARCH_NAME "ia32")
  447. else()
  448. set(BLAS_mkl_ARCH_NAME "intel64")
  449. endif()
  450. if(WIN32)
  451. set(BLAS_mkl_OS_NAME "win")
  452. elseif(APPLE)
  453. set(BLAS_mkl_OS_NAME "mac")
  454. else()
  455. set(BLAS_mkl_OS_NAME "lin")
  456. endif()
  457. if(DEFINED ENV{MKLROOT})
  458. file(TO_CMAKE_PATH "$ENV{MKLROOT}" BLAS_mkl_MKLROOT)
  459. # If MKLROOT points to the subdirectory 'mkl', use the parent directory instead
  460. # so we can better detect other relevant libraries in 'compiler' or 'tbb':
  461. get_filename_component(BLAS_mkl_MKLROOT_LAST_DIR "${BLAS_mkl_MKLROOT}" NAME)
  462. if(BLAS_mkl_MKLROOT_LAST_DIR STREQUAL "mkl")
  463. get_filename_component(BLAS_mkl_MKLROOT "${BLAS_mkl_MKLROOT}" DIRECTORY)
  464. endif()
  465. endif()
  466. set(BLAS_mkl_LIB_PATH_SUFFIXES
  467. "compiler/lib" "compiler/lib/${BLAS_mkl_ARCH_NAME}_${BLAS_mkl_OS_NAME}"
  468. "compiler/lib/${BLAS_mkl_ARCH_NAME}"
  469. "mkl/lib" "mkl/lib/${BLAS_mkl_ARCH_NAME}_${BLAS_mkl_OS_NAME}"
  470. "mkl/lib/${BLAS_mkl_ARCH_NAME}"
  471. "lib/${BLAS_mkl_ARCH_NAME}_${BLAS_mkl_OS_NAME}")
  472. foreach(IT ${BLAS_SEARCH_LIBS})
  473. string(REPLACE " " ";" SEARCH_LIBS ${IT})
  474. if(NOT ${_LIBRARIES})
  475. check_blas_libraries(
  476. ${_LIBRARIES}
  477. BLAS
  478. ${BLAS_mkl_SEARCH_SYMBOL}
  479. ""
  480. "${SEARCH_LIBS}"
  481. "${CMAKE_THREAD_LIBS_INIT};${BLAS_mkl_LM};${BLAS_mkl_LDL}"
  482. "${BLAS_mkl_MKLROOT}"
  483. "${BLAS_mkl_LIB_PATH_SUFFIXES}"
  484. )
  485. endif()
  486. endforeach()
  487. unset(BLAS_mkl_ILP_MODE)
  488. unset(BLAS_mkl_INTFACE)
  489. unset(BLAS_mkl_THREADING)
  490. unset(BLAS_mkl_OMP)
  491. unset(BLAS_mkl_DLL_SUFFIX)
  492. unset(BLAS_mkl_LM)
  493. unset(BLAS_mkl_LDL)
  494. unset(BLAS_mkl_MKLROOT)
  495. unset(BLAS_mkl_MKLROOT_LAST_DIR)
  496. unset(BLAS_mkl_ARCH_NAME)
  497. unset(BLAS_mkl_OS_NAME)
  498. unset(BLAS_mkl_LIB_PATH_SUFFIXES)
  499. endif()
  500. endif()
  501. endif()
  502. if(BLA_F95)
  503. find_package_handle_standard_args(BLAS REQUIRED_VARS BLAS95_LIBRARIES)
  504. set(BLAS95_FOUND ${BLAS_FOUND})
  505. if(BLAS_FOUND)
  506. set(BLAS_LIBRARIES "${BLAS95_LIBRARIES}")
  507. endif()
  508. endif()
  509. # gotoblas? (http://www.tacc.utexas.edu/tacc-projects/gotoblas2)
  510. if(BLA_VENDOR STREQUAL "Goto" OR BLA_VENDOR STREQUAL "All")
  511. if(NOT BLAS_LIBRARIES)
  512. check_blas_libraries(
  513. BLAS_LIBRARIES
  514. BLAS
  515. sgemm
  516. ""
  517. "goto2"
  518. ""
  519. ""
  520. ""
  521. )
  522. endif()
  523. endif()
  524. # FlexiBLAS? (http://www.mpi-magdeburg.mpg.de/mpcsc/software/FlexiBLAS/)
  525. if(BLA_VENDOR STREQUAL "FlexiBLAS" OR BLA_VENDOR STREQUAL "All")
  526. if(NOT BLAS_LIBRARIES)
  527. check_blas_libraries(
  528. BLAS_LIBRARIES
  529. BLAS
  530. sgemm
  531. ""
  532. "flexiblas"
  533. ""
  534. ""
  535. ""
  536. )
  537. endif()
  538. endif()
  539. # OpenBLAS? (http://www.openblas.net)
  540. if(BLA_VENDOR STREQUAL "OpenBLAS" OR BLA_VENDOR STREQUAL "All")
  541. if(NOT BLAS_LIBRARIES)
  542. check_blas_libraries(
  543. BLAS_LIBRARIES
  544. BLAS
  545. sgemm
  546. ""
  547. "openblas"
  548. ""
  549. ""
  550. ""
  551. )
  552. endif()
  553. if(NOT BLAS_LIBRARIES AND (CMAKE_C_COMPILER_LOADED OR CMAKE_CXX_COMPILER_LOADED))
  554. if(BLAS_FIND_QUIETLY OR NOT BLAS_FIND_REQUIRED)
  555. find_package(Threads)
  556. else()
  557. find_package(Threads REQUIRED)
  558. endif()
  559. set(_threadlibs "${CMAKE_THREAD_LIBS_INIT}")
  560. if(BLA_STATIC)
  561. set(_blas_STATIC_CMAKE_FIND_LIBRARY_SUFFIXES "${CMAKE_FIND_LIBRARY_SUFFIXES}")
  562. set(CMAKE_FIND_LIBRARY_SUFFIXES "${_blas_ORIG_CMAKE_FIND_LIBRARY_SUFFIXES}")
  563. if (CMAKE_C_COMPILER_LOADED)
  564. find_package(OpenMP COMPONENTS C)
  565. list(PREPEND _threadlibs "${OpenMP_C_LIBRARIES}")
  566. elseif(CMAKE_CXX_COMPILER_LOADED)
  567. find_package(OpenMP COMPONENTS CXX)
  568. list(PREPEND _threadlibs "${OpenMP_CXX_LIBRARIES}")
  569. endif()
  570. set(CMAKE_FIND_LIBRARY_SUFFIXES "${_blas_STATIC_CMAKE_FIND_LIBRARY_SUFFIXES}")
  571. unset(_blas_STATIC_CMAKE_FIND_LIBRARY_SUFFIXES)
  572. endif()
  573. check_blas_libraries(
  574. BLAS_LIBRARIES
  575. BLAS
  576. sgemm
  577. ""
  578. "openblas"
  579. "${_threadlibs}"
  580. ""
  581. ""
  582. )
  583. unset(_threadlibs)
  584. endif()
  585. endif()
  586. # ArmPL blas library? (https://developer.arm.com/tools-and-software/server-and-hpc/compile/arm-compiler-for-linux/arm-performance-libraries)
  587. if(BLA_VENDOR MATCHES "Arm" OR BLA_VENDOR STREQUAL "All")
  588. # Check for 64bit Integer support
  589. if(BLA_VENDOR MATCHES "_ilp64")
  590. set(BLAS_armpl_LIB "armpl_ilp64")
  591. else()
  592. set(BLAS_armpl_LIB "armpl_lp64")
  593. endif()
  594. # Check for OpenMP support, VIA BLA_VENDOR of Arm_mp or Arm_ipl64_mp
  595. if(BLA_VENDOR MATCHES "_mp")
  596. set(BLAS_armpl_LIB "${BLAS_armpl_LIB}_mp")
  597. endif()
  598. if(NOT BLAS_LIBRARIES)
  599. check_blas_libraries(
  600. BLAS_LIBRARIES
  601. BLAS
  602. sgemm
  603. ""
  604. "${BLAS_armpl_LIB}"
  605. ""
  606. ""
  607. ""
  608. )
  609. endif()
  610. endif()
  611. # FLAME's blis library? (https://github.com/flame/blis)
  612. if(BLA_VENDOR STREQUAL "FLAME" OR BLA_VENDOR STREQUAL "All")
  613. if(NOT BLAS_LIBRARIES)
  614. check_blas_libraries(
  615. BLAS_LIBRARIES
  616. BLAS
  617. sgemm
  618. ""
  619. "blis"
  620. ""
  621. ""
  622. ""
  623. )
  624. endif()
  625. endif()
  626. # BLAS in the ATLAS library? (http://math-atlas.sourceforge.net/)
  627. if(BLA_VENDOR STREQUAL "ATLAS" OR BLA_VENDOR STREQUAL "All")
  628. if(NOT BLAS_LIBRARIES)
  629. check_blas_libraries(
  630. BLAS_LIBRARIES
  631. BLAS
  632. dgemm
  633. ""
  634. "blas;f77blas;atlas"
  635. ""
  636. ""
  637. ""
  638. )
  639. endif()
  640. endif()
  641. # BLAS in PhiPACK libraries? (requires generic BLAS lib, too)
  642. if(BLA_VENDOR STREQUAL "PhiPACK" OR BLA_VENDOR STREQUAL "All")
  643. if(NOT BLAS_LIBRARIES)
  644. check_blas_libraries(
  645. BLAS_LIBRARIES
  646. BLAS
  647. sgemm
  648. ""
  649. "sgemm;dgemm;blas"
  650. ""
  651. ""
  652. ""
  653. )
  654. endif()
  655. endif()
  656. # BLAS in Alpha CXML library?
  657. if(BLA_VENDOR STREQUAL "CXML" OR BLA_VENDOR STREQUAL "All")
  658. if(NOT BLAS_LIBRARIES)
  659. check_blas_libraries(
  660. BLAS_LIBRARIES
  661. BLAS
  662. sgemm
  663. ""
  664. "cxml"
  665. ""
  666. ""
  667. ""
  668. )
  669. endif()
  670. endif()
  671. # BLAS in Alpha DXML library? (now called CXML, see above)
  672. if(BLA_VENDOR STREQUAL "DXML" OR BLA_VENDOR STREQUAL "All")
  673. if(NOT BLAS_LIBRARIES)
  674. check_blas_libraries(
  675. BLAS_LIBRARIES
  676. BLAS
  677. sgemm
  678. ""
  679. "dxml"
  680. ""
  681. ""
  682. ""
  683. )
  684. endif()
  685. endif()
  686. # BLAS in Sun Performance library?
  687. if(BLA_VENDOR STREQUAL "SunPerf" OR BLA_VENDOR STREQUAL "All")
  688. if(NOT BLAS_LIBRARIES)
  689. check_blas_libraries(
  690. BLAS_LIBRARIES
  691. BLAS
  692. sgemm
  693. "-xlic_lib=sunperf"
  694. "sunperf;sunmath"
  695. ""
  696. ""
  697. ""
  698. )
  699. if(BLAS_LIBRARIES)
  700. set(BLAS_LINKER_FLAGS "-xlic_lib=sunperf")
  701. endif()
  702. endif()
  703. endif()
  704. # BLAS in SCSL library? (SGI/Cray Scientific Library)
  705. if(BLA_VENDOR STREQUAL "SCSL" OR BLA_VENDOR STREQUAL "All")
  706. if(NOT BLAS_LIBRARIES)
  707. check_blas_libraries(
  708. BLAS_LIBRARIES
  709. BLAS
  710. sgemm
  711. ""
  712. "scsl"
  713. ""
  714. ""
  715. ""
  716. )
  717. endif()
  718. endif()
  719. # BLAS in SGIMATH library?
  720. if(BLA_VENDOR STREQUAL "SGIMATH" OR BLA_VENDOR STREQUAL "All")
  721. if(NOT BLAS_LIBRARIES)
  722. check_blas_libraries(
  723. BLAS_LIBRARIES
  724. BLAS
  725. sgemm
  726. ""
  727. "complib.sgimath"
  728. ""
  729. ""
  730. ""
  731. )
  732. endif()
  733. endif()
  734. # BLAS in IBM ESSL library? (requires generic BLAS lib, too)
  735. if(BLA_VENDOR STREQUAL "IBMESSL" OR BLA_VENDOR STREQUAL "All")
  736. if(NOT BLAS_LIBRARIES)
  737. check_blas_libraries(
  738. BLAS_LIBRARIES
  739. BLAS
  740. sgemm
  741. ""
  742. "essl;blas"
  743. ""
  744. ""
  745. ""
  746. )
  747. endif()
  748. endif()
  749. # BLAS in acml library?
  750. if(BLA_VENDOR MATCHES "ACML" OR BLA_VENDOR STREQUAL "All")
  751. if(((BLA_VENDOR STREQUAL "ACML") AND (NOT BLAS_ACML_LIB_DIRS)) OR
  752. ((BLA_VENDOR STREQUAL "ACML_MP") AND (NOT BLAS_ACML_MP_LIB_DIRS)) OR
  753. ((BLA_VENDOR STREQUAL "ACML_GPU") AND (NOT BLAS_ACML_GPU_LIB_DIRS))
  754. )
  755. # try to find acml in "standard" paths
  756. if(WIN32)
  757. file(GLOB _ACML_ROOT "C:/AMD/acml*/ACML-EULA.txt")
  758. else()
  759. file(GLOB _ACML_ROOT "/opt/acml*/ACML-EULA.txt")
  760. endif()
  761. if(WIN32)
  762. file(GLOB _ACML_GPU_ROOT "C:/AMD/acml*/GPGPUexamples")
  763. else()
  764. file(GLOB _ACML_GPU_ROOT "/opt/acml*/GPGPUexamples")
  765. endif()
  766. list(GET _ACML_ROOT 0 _ACML_ROOT)
  767. list(GET _ACML_GPU_ROOT 0 _ACML_GPU_ROOT)
  768. if(_ACML_ROOT)
  769. get_filename_component(_ACML_ROOT ${_ACML_ROOT} PATH)
  770. if(SIZEOF_INTEGER EQUAL 8)
  771. set(_ACML_PATH_SUFFIX "_int64")
  772. else()
  773. set(_ACML_PATH_SUFFIX "")
  774. endif()
  775. if(CMAKE_Fortran_COMPILER_ID STREQUAL "Intel")
  776. set(_ACML_COMPILER32 "ifort32")
  777. set(_ACML_COMPILER64 "ifort64")
  778. elseif(CMAKE_Fortran_COMPILER_ID STREQUAL "IntelLLVM")
  779. # 32-bit not supported
  780. set(_ACML_COMPILER64 "ifx")
  781. elseif(CMAKE_Fortran_COMPILER_ID STREQUAL "SunPro")
  782. set(_ACML_COMPILER32 "sun32")
  783. set(_ACML_COMPILER64 "sun64")
  784. elseif(CMAKE_Fortran_COMPILER_ID STREQUAL "PGI")
  785. set(_ACML_COMPILER32 "pgi32")
  786. if(WIN32)
  787. set(_ACML_COMPILER64 "win64")
  788. else()
  789. set(_ACML_COMPILER64 "pgi64")
  790. endif()
  791. elseif(CMAKE_Fortran_COMPILER_ID STREQUAL "Open64")
  792. # 32 bit builds not supported on Open64 but for code simplicity
  793. # We'll just use the same directory twice
  794. set(_ACML_COMPILER32 "open64_64")
  795. set(_ACML_COMPILER64 "open64_64")
  796. elseif(CMAKE_Fortran_COMPILER_ID STREQUAL "NAG")
  797. set(_ACML_COMPILER32 "nag32")
  798. set(_ACML_COMPILER64 "nag64")
  799. else()
  800. set(_ACML_COMPILER32 "gfortran32")
  801. set(_ACML_COMPILER64 "gfortran64")
  802. endif()
  803. if(BLA_VENDOR STREQUAL "ACML_MP")
  804. set(_ACML_MP_LIB_DIRS
  805. "${_ACML_ROOT}/${_ACML_COMPILER32}_mp${_ACML_PATH_SUFFIX}/lib"
  806. "${_ACML_ROOT}/${_ACML_COMPILER64}_mp${_ACML_PATH_SUFFIX}/lib")
  807. else()
  808. set(_ACML_LIB_DIRS
  809. "${_ACML_ROOT}/${_ACML_COMPILER32}${_ACML_PATH_SUFFIX}/lib"
  810. "${_ACML_ROOT}/${_ACML_COMPILER64}${_ACML_PATH_SUFFIX}/lib")
  811. endif()
  812. endif()
  813. elseif(BLAS_${BLA_VENDOR}_LIB_DIRS)
  814. set(_${BLA_VENDOR}_LIB_DIRS ${BLAS_${BLA_VENDOR}_LIB_DIRS})
  815. endif()
  816. if(BLA_VENDOR STREQUAL "ACML_MP")
  817. foreach(BLAS_ACML_MP_LIB_DIRS ${_ACML_MP_LIB_DIRS})
  818. check_blas_libraries(
  819. BLAS_LIBRARIES
  820. BLAS
  821. sgemm
  822. "" "acml_mp;acml_mv" "" ${BLAS_ACML_MP_LIB_DIRS} ""
  823. )
  824. if(BLAS_LIBRARIES)
  825. break()
  826. endif()
  827. endforeach()
  828. elseif(BLA_VENDOR STREQUAL "ACML_GPU")
  829. foreach(BLAS_ACML_GPU_LIB_DIRS ${_ACML_GPU_LIB_DIRS})
  830. check_blas_libraries(
  831. BLAS_LIBRARIES
  832. BLAS
  833. sgemm
  834. "" "acml;acml_mv;CALBLAS" "" ${BLAS_ACML_GPU_LIB_DIRS} ""
  835. )
  836. if(BLAS_LIBRARIES)
  837. break()
  838. endif()
  839. endforeach()
  840. else()
  841. foreach(BLAS_ACML_LIB_DIRS ${_ACML_LIB_DIRS})
  842. check_blas_libraries(
  843. BLAS_LIBRARIES
  844. BLAS
  845. sgemm
  846. "" "acml;acml_mv" "" ${BLAS_ACML_LIB_DIRS} ""
  847. )
  848. if(BLAS_LIBRARIES)
  849. break()
  850. endif()
  851. endforeach()
  852. endif()
  853. # Either acml or acml_mp should be in LD_LIBRARY_PATH but not both
  854. if(NOT BLAS_LIBRARIES)
  855. check_blas_libraries(
  856. BLAS_LIBRARIES
  857. BLAS
  858. sgemm
  859. ""
  860. "acml;acml_mv"
  861. ""
  862. ""
  863. ""
  864. )
  865. endif()
  866. if(NOT BLAS_LIBRARIES)
  867. check_blas_libraries(
  868. BLAS_LIBRARIES
  869. BLAS
  870. sgemm
  871. ""
  872. "acml_mp;acml_mv"
  873. ""
  874. ""
  875. ""
  876. )
  877. endif()
  878. if(NOT BLAS_LIBRARIES)
  879. check_blas_libraries(
  880. BLAS_LIBRARIES
  881. BLAS
  882. sgemm
  883. ""
  884. "acml;acml_mv;CALBLAS"
  885. ""
  886. ""
  887. ""
  888. )
  889. endif()
  890. endif() # ACML
  891. # Apple BLAS library?
  892. if(BLA_VENDOR STREQUAL "Apple" OR BLA_VENDOR STREQUAL "All")
  893. if(NOT BLAS_LIBRARIES)
  894. check_blas_libraries(
  895. BLAS_LIBRARIES
  896. BLAS
  897. dgemm
  898. ""
  899. "Accelerate"
  900. ""
  901. ""
  902. ""
  903. )
  904. endif()
  905. endif()
  906. # Apple NAS (vecLib) library?
  907. if(BLA_VENDOR STREQUAL "NAS" OR BLA_VENDOR STREQUAL "All")
  908. if(NOT BLAS_LIBRARIES)
  909. check_blas_libraries(
  910. BLAS_LIBRARIES
  911. BLAS
  912. dgemm
  913. ""
  914. "vecLib"
  915. ""
  916. ""
  917. ""
  918. )
  919. endif()
  920. endif()
  921. # Elbrus Math Library?
  922. if(BLA_VENDOR MATCHES "EML" OR BLA_VENDOR STREQUAL "All")
  923. set(BLAS_EML_LIB "eml")
  924. # Check for OpenMP support, VIA BLA_VENDOR of eml_mt
  925. if(BLA_VENDOR MATCHES "_mt")
  926. set(BLAS_EML_LIB "${BLAS_EML_LIB}_mt")
  927. endif()
  928. if(NOT BLAS_LIBRARIES)
  929. check_blas_libraries(
  930. BLAS_LIBRARIES
  931. BLAS
  932. sgemm
  933. ""
  934. "${BLAS_EML_LIB}"
  935. ""
  936. ""
  937. ""
  938. )
  939. endif()
  940. endif()
  941. # Fujitsu SSL2 Library?
  942. if(NOT BLAS_LIBRARIES AND
  943. BLA_VENDOR MATCHES "Fujitsu_SSL2" OR BLA_VENDOR STREQUAL "All")
  944. if(BLA_VENDOR STREQUAL "Fujitsu_SSL2BLAMP")
  945. set(_ssl2_suffix BLAMP)
  946. else()
  947. set(_ssl2_suffix)
  948. endif()
  949. check_blas_libraries(
  950. BLAS_LIBRARIES
  951. BLAS
  952. sgemm
  953. "-SSL2${_ssl2_suffix}"
  954. ""
  955. ""
  956. ""
  957. ""
  958. )
  959. if(BLAS_LIBRARIES)
  960. set(BLAS_LINKER_FLAGS "-SSL2${_ssl2_suffix}")
  961. set(_blas_fphsa_req_var BLAS_LINKER_FLAGS)
  962. endif()
  963. unset(_ssl2_suffix)
  964. endif()
  965. # Generic BLAS library?
  966. if(BLA_VENDOR STREQUAL "Generic" OR BLA_VENDOR STREQUAL "All")
  967. if(NOT BLAS_LIBRARIES)
  968. check_blas_libraries(
  969. BLAS_LIBRARIES
  970. BLAS
  971. sgemm
  972. ""
  973. "blas"
  974. ""
  975. ""
  976. ""
  977. )
  978. endif()
  979. endif()
  980. # On compilers that implicitly link BLAS (i.e. CrayPrgEnv) we used a
  981. # placeholder for empty BLAS_LIBRARIES to get through our logic above.
  982. if(BLAS_LIBRARIES STREQUAL "BLAS_LIBRARIES-PLACEHOLDER-FOR-EMPTY-LIBRARIES")
  983. set(BLAS_LIBRARIES "")
  984. endif()
  985. if(NOT BLA_F95)
  986. find_package_handle_standard_args(BLAS REQUIRED_VARS ${_blas_fphsa_req_var})
  987. endif()
  988. _add_blas_target()
  989. cmake_pop_check_state()
  990. set(CMAKE_FIND_LIBRARY_SUFFIXES ${_blas_ORIG_CMAKE_FIND_LIBRARY_SUFFIXES})