Skip to content

Link with CBLAS & LAPACK

Ilya edited this page Jul 8, 2018 · 7 revisions

mir-blas requires a library with CBLAS ABI. mir-lapack requires a library with LAPACK ABI. Almost all LAPACK and CBLAS implementations requires BLAS ABI.

The default library that combines all ABIs is OpenBLAS.

Note, that OpenBLAS may be compiled without CBLAS and/or LAPACK API. Check that arguments for make contains NO_CBLAS=0 and NO_LAPACK=0.

The following instruction uses SDL format for dub configurations.

Ubuntu

$ sudo apt install libopenblas-dev

The default configution for mir-blas and mir-lapack is "openblas"

Note: Ubuntu Trusty and previous has deprecated OpenBLAS that may not have all required for you ABI. For deprecated ubuntu use liblapack-dev instead and add the following sub configuration in your project

# in dub.sdl
subConfiguraiton "mir-lapack" "blas"

or, if mir-lapack is not used

# in dub.sdl
subConfiguraiton "mir-blas" "blas"

Linux with separate libcblas

If your linux distribution setup has both libblas and libcblas then use

# in dub.sdl
subConfiguraiton "mir-lapack" "threelib"

or, if mir-lapack is not used

# in dub.sdl
subConfiguraiton "mir-blas" "twolib"

macOS

Install OpenBLAS using brew package manager.

$ brew install openblas
$ brew link openblas

O†r link with Apple Accelerate:

# in dub.sdl
subConfiguraiton "mir-lapack" "blas"

or, if mir-lapack is not used

# in dub.sdl
subConfiguraiton "mir-blas" "blas"

Windows + Intel MKL

There is predefined single thread configuration for Intel MKL:

# in dub.sdl
subConfiguraiton "mir-lapack" "mkl-sequential"

or, if mir-lapack is not used

# in dub.sdl
subConfiguraiton "mir-blas" "mkl-sequential"

Library path may need to be specified for MSVC linker.

# in dub.sdl
lflags "/LIBPATH:<PATH_TO_REQUIRED_LIBS>"

Custom configuration

To specify your own libraries use:

# in dub.sdl
subConfiguraiton "mir-lapack" "zerolib"
libs "<YOUR_LIB1>" "<YOUR_LIB2>" ...

or, if mir-lapack is not used

# in dub.sdl
subConfiguraiton "mir-blas" "zerolib"
libs "<YOUR_LIB1>" "<YOUR_LIB2>" ...
Clone this wiki locally