GithubHelp home page GithubHelp logo

scivision / lapack-cmake-meson Goto Github PK

View Code? Open in Web Editor NEW
15.0 4.0 2.0 97 KB

CMake FindLAPACK.cmake that works with Intel MKL, Atlas, OpenBLAS, Netlib, LAPACK95 for C / C++ / Fortran

License: BSD 3-Clause "New" or "Revised" License

CMake 42.62% C 12.40% Fortran 7.13% Shell 1.99% Meson 7.63% Batchfile 2.14% Python 26.08%
cmake-modules lapacke lapack openblas netlib lapack95 atlas

lapack-cmake-meson's Introduction

Lapack with Meson or CMake

Actions Status Actions Status

A clean, modern FindLAPACK.cmake with verified compatibility across a wide range of compilers, operating systems and Lapack vendors. Optionally, uses PkgConfig in CMake to make finding Lapack / LapackE more robust.

CMake

Here is a brief listing of known working configurations:

Windows:

Compiler Lapack
MSVC 15 2017 Intel MKL
PGI Intel MKL

Linux:

Compiler Lapack
gcc + gfortran Netlib Lapack
gcc + gfortran Intel MKL
gcc + gfortran Atlas
gcc + gfortran OpenBLAS
Clang + gfortran Netlib Lapack
Clang + gfortran Intel MKL
Clang + gfortran Atlas
Clang + gfortran OpenBLAS
Clang + Flang Netlib Lapack
Clang + Flang Intel MKL
Clang + Flang Atlas
Clang + Flang OpenBLAS

Example

This example is for SVD computation using LapackE from C.

For most non-MSVC compilers (e.g. GNU, PGI, Clang, etc.):

ctest -S setup.cmake -VV

If you have a Fortran compiler, a Fortran Lapack example will also be built and tested.

For MSVC compilers, only the C example is built, and requires Intel MKL:

cmake -G "Visual Studio 16 2019" -B build

cmake --build build

Meson

Lapack with Meson works with similar compiler configurations as CMake.

meson build

meson test -C build

to use MKL with Meson, do like

meson build -DMKL_ROOT=$MKLROOT  # linux

prereq

Intel MKL

Intel MKL is automatically detected by if MKLROOT environment variable is set. This variable should be set BEFORE using CMake as proscribed by Intel for your operating system, typically by running mklvars script. Here I assume you've installed MKL as appropriate for the MKL directory structure.

The command used to activate Intel MKL for each Terminal / Command Prompt session is like:

  • Linux: source ~/intel/mkl/bin/mklvars.sh intel64
  • Mac: source ~/intel/mkl/bin/mklvars.sh intel64
  • Windows: c:\"Program Files (x86)"\IntelSWTools\compilers_and_libraries\windows\mkl\bin\mklvars.bat intel64

You need to do this EVERY TIME you want to use MKL for the Terminal / Command Prompt, or run it automatically at startup. What we usually do is create a script in the home directory that simply runs that command when called.

To verify Intel MKL was used, run a program with MKL_VERBOSE=1 like:

  • Mac / Linux: MKL_VERBOSE=1 ./build/svd_c

  • Windows:

    set MKL_VERBOSE=1
    
    build\c_src\Debug\svd_c

Windows

  • On Windows, MinGW is not supported with MKL at least through MKL 2019--you will get all kinds of errors.
  • Windows CMake systems that don't want to use MSVC must in general include cmake -G "MinGW Makefiles" along with their other options. This is true for anything CMake is used for on Windows where Visual Studio is not wanted.

lapack-cmake-meson's People

Contributors

scivision avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.