FindBLAS.cmake 30 KB

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