Skip to content

Find{BLAS,LAPACK}: Corrections to Fortran 95 MKL wrappers search

Jakub Benda requested to merge jacob/cmake:blaslapack95 into master

Introduction

The modules FindBLAS and FindLAPACK can, on request (ie. when BLA_F95=1), look also for BLAS95 and LAPACK95 wrappers. These are provided exclusively by Intel MKL package, via the libraries

    libmkl_blas95_lp64    (or _ilp64)
    libmkl_lapack95_lp64  (or _ilp64)

They provide simplified Fortran 95 interfaces to BLAS and LAPACK in the form of subroutines like sgemm_f95 and dgemm_f95, which are specializations of the type-generic interfaces (here gemm) offered by the MKL-specific Fortran 95 modules blas95 and lapack95. Here is, for instance, listing of all GEMM-related F95 symbols from Intel MKL 2015:

# nm $MKLROOT/lib/intel64/libmkl_blas95_lp64.a | grep -i gemm
cgemm.o:
                 U cgemm_
0000000000000000 T cgemm_f95_
cgemm3m.o:
                 U cgemm3m_
0000000000000000 T cgemm3m_f95_
dgemm.o:
                 U dgemm_
0000000000000000 T dgemm_f95_
dzgemm.o:
                 U dzgemm_
0000000000000000 T dzgemm_f95_
scgemm.o:
                 U scgemm_
0000000000000000 T scgemm_f95_
sgemm.o:
                 U sgemm_
0000000000000000 T sgemm_f95_
zgemm.o:
                 U zgemm_
0000000000000000 T zgemm_f95_
zgemm3m.o:
                 U zgemm3m_
0000000000000000 T zgemm3m_f95_

Related information:

https://software.intel.com/en-us/mkl-developer-reference-fortran-gemm

https://software.intel.com/en-us/mkl-linux-developer-guide-interface-libraries-and-modules

Changes in this commit

However, the search for BLAS95 and LAPACK95 wrappers in Find{BLAS,LAPACK} was incorrect:

  • First, in FindLAPACK, the library libmkl_lapack95_lp64 (or _ilp64) was not even added to the list of libraries to search for. (A similar omissions was fixed for FindBLAS as part of !2444 (merged)).
  • Second, the symbols used to test that the libraries provide BLAS95 and LAPACK95 were not chosen correctly: both SGEMM and CHEEV used originaly have nothing to do with Fortran 95. Instead, FindBLAS now uses sgemm_f95 and FindLAPACK uses cheev_f95.
Edited by Jakub Benda

Merge request reports