Commit Graph

68 Commits

Author SHA1 Message Date
Alexander Neumann
276b56f01c FindBLAS: Add second try for OpenBLAS with thread libraries.
Issue: #16221
2019-06-17 08:03:07 -04:00
Jakub Benda
89ab54c112 FindBLAS: Choose MKL arch based on BLA_VENDOR
Recently, FindBLAS has been extended with additional library search
path based on the environment variable MKLROOT. However, the choice
of the Intel MKL architecture (IA-32 vs Intel64) was based on
unrelated (and possibly undefined) size of integer.

This commit changes the selection of the Intel MKL architecture to
instead consider the variable BLA_VENDOR, if available.

So, if the environment variable MKLROOT is defined and
BLA_VENDOR=Intel10_32, then $ENV{MKLROOT}/lib/ia32_<OS> will be added
to the search path (OS = lin, win, or mac).

Similarly, if MKLROOT is defined and BLA_VENDOR=Intel10_64lp or
BLA_VENDOR=Intel10_64ilp, then the path $ENV{MKLROOT}/intel64_<OS>
will be used.

If either MKLROOT or BLA_VENDOR is undefined, no additional search
path on top of LD_LIBRARY_PATH / DYLD_LIBRARY_PATH / LIB is be added.
2019-05-16 10:35:37 +01:00
Jakub Benda
8527dbbf44 FindBLAS: Use Intel fortran interface on OS X even with GNU Fortran
According to Intel MKL Link Line Advisor, there is no GNU Fortran
interface library provided for OS X variant of Intel MKL. Because of
this missing library, FindBLAS was failing on OS X, looking for
nonexistent library libmkl_gf_[i]lp64.

To prevent this, FindBLAS will now always use Intel Fortran interface
for MKL on OS X (libmkl_intel_[i]lp64), even with GNU Fortran.
2019-05-04 10:38:02 +01:00
Bartosz Kosiorek
cb33befe2d Modules: Update documentation formatting 2019-04-08 14:55:56 +02:00
Mario Emmenlauer
90b7758489 FindBLAS: respect MKLROOT and MKL_ROOT if available
Fixes: #19052
2019-03-15 20:13:35 +01:00
Brad King
74cba6a3fd Merge topic 'lapack-docs'
be7b30f67e Find{BLAS,LAPACK}: Add note and example for using Intel MKL
b323407235 Find{BLAS,LAPACK}: Update docs to use modern conventions
ba30b94435 FindLAPACK: Remove extra indentation from a line

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !2880
2019-01-31 11:08:19 -05:00
Brad King
bb735025de Find{BLAS,LAPACK}: Drop unnecessary mark_as_advanced calls
Cache entries created by `try_compile` are already `INTERNAL`.
2019-01-31 09:11:03 -05:00
Michael Hirsch, Ph.D
be7b30f67e Find{BLAS,LAPACK}: Add note and example for using Intel MKL 2019-01-30 10:16:08 -05:00
Michael Hirsch, Ph.D
b323407235 Find{BLAS,LAPACK}: Update docs to use modern conventions 2019-01-30 10:15:00 -05:00
Brad King
2a6e8644dd Merge topic 'blaslapack_mkl_gfortran'
c259912b14 FindBLAS: Do not look for BLAS once BLAS95 has been found
d5f691be0b FindLAPACK: Additional libraries for MKL+gfortran combination
8b63265ea5 FindLAPACK: Unify internal variables related to MKL
ede1715c1d FindLAPACK: Remove MKL components already provided by MKL BLAS
03879b11af FindLAPACK: Prioritize Intel MKL
b4edf7b5d2 FindBLAS: Support 32bit Intel MKL 10.3+
fc149a72f7 FindBLAS: Support combination of gfortran and Intel MKL
f0d52f55f1 FindBLAS: Consolidate duplicated code related to MKL on Windows

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !2633
2018-11-27 08:48:08 -05:00
Jakub Benda
c259912b14 FindBLAS: Do not look for BLAS once BLAS95 has been found
When BLA_F95 is ON, FindBLAS looks for BLAS95_LIBRARIES (in Intel MKL).
As this is a superset of BLAS_LIBRARIES, if they are found, no further
search in other vendors is necessary.
2018-11-24 12:14:32 +00:00
Brad King
e653f46677 Merge topic 'blas-pkgcfg'
a3c31effed FindBLAS: Restore BLAS_FOUND when found using pkgconfig

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !2631
2018-11-20 09:26:31 -05:00
Martin von Gagern
a3c31effed FindBLAS: Restore BLAS_FOUND when found using pkgconfig
Refactoring in commit v3.12.0-rc1~92^2 (FindPkgConfig: export the list
of found libraries also as variable, 2018-05-11) dropped use of FPHSA
to set `BLAS_FOUND`.  Set it explicitly instead.
2018-11-19 15:47:20 -05:00
Jakub Benda
b4edf7b5d2 FindBLAS: Support 32bit Intel MKL 10.3+
The module FindBLAS now correctly finds Intel MKL distributions that do
not have the (long deprecated) library "libguide", but use "libiomp5"
instead.
2018-11-18 17:00:37 +00:00
Jakub Benda
fc149a72f7 FindBLAS: Support combination of gfortran and Intel MKL
The module FindBLAS now correctly chooses MKL BLAS libraries to search,
based on the compiler ID. The MKL libraries needed for BLAS functionality
are the following:

  libmkl_{gf|intel}_{lp64|ilp64}.{a|so}
  libmkl_{gnu|intel}_thread.{a|so}       (or libmkl_sequential.{a|so})
  libmkl_core.{a|so}
  libm
  libdl
  lib{gomp|iomp5}.{a|so}                 (only with libmkl_*_thread.*)

To achieve the goal, the following internal variables are defined and used:

  BLAS_mkl_INTFACE   = "gf" or "intel"   (based on compiler ID)
  BLAS_mkl_THREADING = "gnu" or "intel"  (based on compiler ID)
  BLAS_mkl_OMP       = "gomp" or "iomp5" (based on compiler ID)
  BLAS_mkl_LM        = "-lm"             (not set on Windows)
  BLAS_mkl_DL        = "-ldl"            (not set on Windows)

The default values for the first three of them are "intel" and "iomp5",
unless a Fortran compiler is loaded with CMAKE_Fortran_COMPILER_ID
equal to "GNU"; in such case the "gf", "gnu" and "gomp" values are used.

In non-Windows systems, the thread library as well as libm and libdl are
now added to the linker line to allow static linking of libgomp.
2018-11-18 16:59:03 +00:00
Jakub Benda
f0d52f55f1 FindBLAS: Consolidate duplicated code related to MKL on Windows
The code that decides which library suffix to use for MKL libraries
in Windows was in two places. This commit consolidates it in one place.
2018-11-18 14:52:13 +00:00
Brad King
c752edfcb3 Merge topic 'blaslapack95'
f1a3e4eca8 FindLAPACK: Correct library name and symbol searched in LAPACK95 wrapper
970b18e9a5 FindBLAS: Correct symbol searched in BLAS95 wrapper

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !2560
2018-11-06 11:29:42 -05:00
Jakub Benda
970b18e9a5 FindBLAS: Correct symbol searched in BLAS95 wrapper
The symbol "SGEMM", originally used to determine if a library provides
Fortran 95 wrappers for BLAS, has been replaced by "sgemm_f95". "SGEMM"
is provided by libmkl_intel_(i)lp64, which does not provide the generic
Fortran 95 wrappers. Instead, libmkl_blas95_(i)lp does; one of the
specializations of the type-generic interfaces contained in that library
is "sgemm_f95".
2018-11-05 08:00:02 -05:00
Kitware Robot
df4ed1e9ff Help: Convert remaining modules to block-style comments 2018-10-22 11:09:34 -04:00
Jakub Benda
d0fb3e6c52 Find{BLAS,LAPACK}: Find also ILP64 MKL BLAS and LAPACK
Modern Intel MKL packages offer 64-bit BLAS and LAPACK libraries in any
of the eight combinations of the following three binary options:

  - sequential or threaded
  - LP64 or ILP64
  - static or shared

The modules FindBLAS and FindLAPACK did not allow full selection of
arbitrary combination; in particular, only LP64 variant was used.

The original list of possible BLA_VENDOR values related to MKL,

  Intel10_64lp
  Intel10_64lp_seq

is thus extended by another pair of "vendors",

  Intel10_64ilp
  Intel10_64ilp_seq

Depending on the selection, either "_lp64", or "_ilp64" MKL libraries
are searched for. Some comments in the two CMake modules were modified
to indicate that even though the "vendors" contain the number "10",
they also apply to all further versions of MKL.
2018-10-08 13:21:08 -04:00
Hubertus van Dam
8cdff15ef7 FindBLAS: Make Intel MKL the most preferred explicit BLAS library again
By adding the "if (NOT BLAS_LIBRARIES)" statement to the Intel MKL
detection code block we have unintentionally turned Intel MKL from
the most preferred into the least preferred BLAS library. To fix
this issue the Intel MKL detection code block needs to be moved
forward to make it the first explicit BLAS library we test for.
This is change does just that and re-instates Intel MKL as the
most preferred explicit BLAS library.
2018-08-30 10:52:59 -04:00
Hubertus van Dam
608de88f29 FindBLAS: Make Intel MKL code block respect prior found BLAS libraries
All non-Intel BLAS library detection blocks have an if-statement
"if (NOT BLAS_LIBRARIES)" to ensure that if a BLAS library was
found we are not going to try and find another one. This causes
a problem when we have already found that we do not need to specify
a BLAS library, as the Intel MKL library takes precedence over
everything. Introducing the "if (NOT BLAS_LIBRARIES)" if-statement
fixes this problem.
2018-08-30 10:52:59 -04:00
Hubertus van Dam
5b8f69ebe9 FindBLAS: Detect implicitly linked BLAS library
Run the Check_Fortran_Libraries macro with an *empty* list of libraries
to detect whether the compiler implicitly links BLAS.  If this works,
set `BLAS_LIBRARIES` to a placeholder value to get through the rest of
our logic.  At the end replace the placeholder by a real empty string
again to report to callers.
2018-08-30 10:51:20 -04:00
Kitware Robot
2c807b75f3 FindBLAS: Re-indent module source code to use normal conventions 2018-08-30 10:42:09 -04:00
Rolf Eike Beer
92ac721a44 FindPkgConfig: export the list of found libraries also as variable 2018-05-11 19:35:53 +02:00
Rolf Eike Beer
7d756f37cc FindBLAS: do not write an imported target name into BLAS_LIBRARIES
Since commit v3.11.0-rc1~177^2 (FindBLAS: optionally query pkg-config
for a library, 2017-12-15) the `BLAS_LIBRARIES` result variable may
incorrectly contain the name of an imported target.  Instead store the
list of libraries in the variable.  Unfortunately pkg_check_modules does
not provide a way to get this so we need to use a (temporary) hack of
reading `INTERFACE_LINK_LIBRARIES` from the interface library target.

Fixes: #17934
2018-04-24 13:49:20 -04:00
Rolf Eike Beer
a9c42e3ec0 FindBLAS: optionally query pkg-config for a library
This is more or less what Gentoo implements for years, but in a more
sophisticated version that uses the target mode now offered by
pkg_check_modules().
2017-12-15 21:24:25 +01:00
Rolf Eike Beer
c095e2ad54 FindBLAS: simplify if() 2017-12-15 21:10:25 +01:00
Rolf Eike Beer
fcf3264594 FindBLAS: use FPHSA 2017-12-15 21:10:25 +01:00
J M Dieterich
f5bc78263e Find{BLAS,LAPACK}: Add support for FLAME blis and libflame
FLAME (github.com/flame) provides a variety of numerical libraries.
`blis` and `libflame` can be setup to expose BLAS/LAPACK interfaces.

Fixes: #17470
2017-11-16 11:43:15 -05:00
Gregor Jasny
ded9859c92 FindBLAS/LAPACK: Format documentation
Closes #16624
2017-03-22 09:10:28 -04:00
Brad King
86578eccf2 Simplify CMake per-source license notices
Per-source copyright/license notice headers that spell out copyright holder
names and years are hard to maintain and often out-of-date or plain wrong.
Precise contributor information is already maintained automatically by the
version control tool.  Ultimately it is the receiver of a file who is
responsible for determining its licensing status, and per-source notices are
merely a convenience.  Therefore it is simpler and more accurate for
each source to have a generic notice of the license name and references to
more detailed information on copyright holders and full license terms.

Our `Copyright.txt` file now contains a list of Contributors whose names
appeared source-level copyright notices.  It also references version control
history for more precise information.  Therefore we no longer need to spell
out the list of Contributors in each source file notice.

Replace CMake per-source copyright/license notice headers with a short
description of the license and links to `Copyright.txt` and online information
available from "https://cmake.org/licensing".  The online URL also handles
cases of modules being copied out of our source into other projects, so we
can drop our notices about replacing links with full license text.

Run the `Utilities/Scripts/filter-notices.bash` script to perform the majority
of the replacements mechanically.  Manually fix up shebang lines and trailing
newlines in a few files.  Manually update the notices in a few files that the
script does not handle.
2016-09-27 15:14:44 -04:00
Melven Roehrig-Zoellner
1694112dfa Find{BLAS,LAPACK}: Fix when used in pure Fortran projects (#16039)
Use `CMAKE_<LANG>_COMPILER_LOADED` to detect enabled languages because
`if( _LANGUAGES_ MATCHES C )` is always true on Windows as the RC
language is activated automatically and matches C.
2016-04-05 09:03:23 -04:00
J M Dieterich
5f6b4f690a Find{BLAS,LAPACK}: Add support for OpenBLAS (#16024)
OpenBLAS (www.openblas.net) is the successor to GotoBLAS.
2016-03-18 11:23:36 -04:00
Brad King
2b48f63ce3 FindBLAS: Fix pattern matching on BLAS vendor name
The if(STREQUAL) expressions do not support globbing expressions.
Use regular experssions with MATCHES instead.

Reported-by: Yahui Wang <youngqv@foxmail.com>
2016-01-08 11:48:02 -05:00
Rolf Eike Beer
7eacbaed4d Replace MATCHES ".+" tests with NOT STREQUAL "" 2014-04-14 18:17:23 +02:00
Rolf Eike Beer
b0b4b4602f Remove .* expressions from beginning and end of MATCHES regexs
All these expressions work the same:
  "foo"
  ".*foo.*"
  "^.*foo.*$"

This assumes that the "Intel*" expressions were meant to be "Intel.*".
2014-04-14 18:17:11 +02:00
Clinton Stimpson
83934757c9 Find*: Make find_package(.. QUIET) affect Check* modules.
Fixes issues #14812 and #14813 where find_package(OpenMP QUIET) and
find_package(Qt4 QUIET) would still print out messages when calling
check*() functions.

Also a partial fix for  #14445 where building CMake
(without cmake-gui) when Qt5 is installed and Qt4 is not installed
and warnings come out of FindQt4.cmake.
2014-03-29 20:22:54 -06:00
Kitware Robot
f051814ed0 Convert builtin help to reStructuredText source files
Run the convert-help.bash script to convert documentation:

 ./convert-help.bash "/path/to/CMake-build/bin"

Then remove it.
2013-10-15 14:12:03 -04:00
Leszek Swirski
46c7bcaf96 FindBLAS: Fixes for Windows MKL support 2013-10-08 15:00:12 +01:00
Rolf Eike Beer
8ebf74b02f Find* (and some other): use ${CMAKE_CURRENT_LIST_DIR} in include()
This solves a lots of warnings, e.g. in the FindModulesExecuteAll test. If the
installed version on the system is rather old this may even lead to bugs, e.g.
https://bugs.gentoo.org/show_bug.cgi?id=436540
2012-11-04 05:55:37 +01:00
Kitware Robot
9db3116226 Remove CMake-language block-end command arguments
Ancient versions of CMake required else(), endif(), and similar block
termination commands to have arguments matching the command starting the
block.  This is no longer the preferred style.

Run the following shell code:

for c in else endif endforeach endfunction endmacro endwhile; do
    echo 's/\b'"$c"'\(\s*\)(.\+)/'"$c"'\1()/'
done >convert.sed &&
git ls-files -z -- bootstrap '*.cmake' '*.cmake.in' '*CMakeLists.txt' |
egrep -z -v '^(Utilities/cm|Source/kwsys/)' |
egrep -z -v 'Tests/CMakeTests/While-Endwhile-' |
xargs -0 sed -i -f convert.sed &&
rm convert.sed
2012-08-13 14:19:16 -04:00
David Cole
85f843a7b4 Merge topic 'mixed-lib-to-lib64'
af80da3 remove lib64 Unix paths if the respective lib path is also given
733726e find_library: Fix mixed lib->lib64 (non-)conversion cases (#13419)
54add62 find_library: Simplify lib->lib<arch> expansion
6ca2f82 find_library: Refactor lib->lib64 conversion
1fe4b82 find_library: Add test covering lib->lib64 cases
2012-08-13 13:26:57 -04:00
Rolf Eike Beer
af80da349b remove lib64 Unix paths if the respective lib path is also given
If FIND_LIBRARY_USE_LIB64_PATHS is set both will be searched anyway.
2012-07-21 10:15:52 +02:00
Alexey Ozeritsky
79a4e2bbdd Fixed: FindLAPACK does not find MKL 10.3 when using gcc 4.x 2012-07-18 11:17:45 +04:00
Alexey Ozeritsky
4585e573b8 FindBLAS/FindLAPACK: Work with MKL version 10.3 (#12924, #12925) 2012-02-16 18:03:08 -05:00
Alexey Ozeritsky
0cc8f05ce5 FindBLAS/LAPACK fixes
fixed: CMAKE_FIND_LIBRRAY_SUFFIXES misprint
 added: ATLAS vendor to FindLAPACK module
2011-09-01 10:54:48 +04:00
Alexey Ozeritsky
145de0a058 FindBLAS/LAPACK fixes
fixed: saving/changing/restoring CMAKE_FIND_LIBRARY_SUFFIXES variable.
fixed: BLA_VENDORs "Apple" (Accelerate Framework) and
      "NAS" (vecLib Framework) fail as 'cblas_dgemm_' doesn't exist.
fixed: improve "Generic" detection on Ubuntu (and I assume Debian)
      (work with libblas3gf and liblapack3gf packages).
2011-08-31 22:10:13 +04:00
Alexey Ozeritsky
cfad24a36b fixed: search of ATLAS library for C/C++-only projects 2011-08-15 17:54:28 +04:00
Alexey Ozeritsky
af4c58b3bd ACML-GPU supported 2011-08-13 17:03:58 +04:00