1. array-morphisms-blas
    1. Description
    2. Requirements
    3. Usage
    4. Which BLAS library is used
    5. Threads
    6. Author
    7. Repository
    8. License
    9. Version History

array-morphisms-blas

A system-BLAS backend for array-morphisms, through the blas egg (OpenBLAS, Intel MKL, reference BLAS, ...).

Description

array-morphisms computes matrix products and convolutions via a pluggable BLAS backend. The default backend is a bundled copy of microBLAS. This egg is separate from array-morphisms, so that array-morphisms does not depend on the blas egg or on a system BLAS library. Install it when you want the performance of a system BLAS library such as OpenBLAS.

Requirements

Usage

(import array-morphisms-blas-exec
        array-morphisms-blas-egg-backend)

(register-blas-backend! (make-blas-egg-backend))

Registering this backend replaces the microBLAS backend that array-morphisms registers by default; the last register-blas-backend! call wins.

[procedure] (make-blas-egg-backend)

Return a blas-backend record (see array-morphisms-blas-exec) with:

Which BLAS library is used

The blas egg does not choose a BLAS implementation itself; it links with -lblas and falls back to other names. On Debian-based systems, what -lblas resolves to is decided by update-alternatives. Installing the OpenBLAS development packages registers OpenBLAS at a higher priority than the reference BLAS, so the blas egg and this egg then run on OpenBLAS.

update-alternatives --display libblas.so.3-x86_64-linux-gnu   # run-time selection
update-alternatives --display libblas.so-x86_64-linux-gnu     # link-time selection
update-alternatives --config libblas.so.3-x86_64-linux-gnu    # switch

Threads

OpenBLAS uses all the processors it finds by default. To limit the number of threads, set OPENBLAS_NUM_THREADS, which works for every OpenBLAS variant; OMP_NUM_THREADS affects only the OpenMP variant.

OPENBLAS_NUM_THREADS=4 csi -s your-script.scm

Author

Ivan Raikov

Repository

https://github.com/iraikov/array-morphisms-blas

License

LGPL-3

Version History

1.1
Offset GEMM and DOT kernels for batched products; the im2col kernels write zeros at padding positions, so convolutions can share a column buffer; links the BLAS library directly; requires array-morphisms 3.0
1.0
Initial release