Intel Math Kernel Library bindings for Common Lisp
Explore the docs »
Report Bug
·
Request Feature
·
Reference Manual
MKL provides Common Lisp bindings for Intel's Math Kernel Library, offering access to performance-optimized mathematical functions.
-
Direct MKL integration: Provide bindings to Intel MKL functions with minimal overhead and direct access to optimized mathematical operations.
-
Performance optimization: Enable Common Lisp applications to benefit from Intel MKL's hardware-specific optimizations and vectorized operations.
-
Vector mathematics: Implement efficient vector mathematical operations through the VML (Vector Math Library) component.
-
Library compatibility: Maintain compatibility with existing Common Lisp mathematical libraries and development workflows.
MKL requires Intel Math Kernel Library to be installed on your system before loading. The library provides bindings to MKL functions and does not include the MKL libraries themselves.
MKL requires Intel Math Kernel Library shared libraries to be available on your system. You can install MKL through:
- Intel oneAPI Base Toolkit (includes MKL)
- Standalone Intel MKL installation
- Package managers on Linux distributions that provide MKL packages
Ensure that the MKL libraries are accessible through your system's library search path or configure the library locations as described in the installation section.
The recommended installation method is through Quicklisp. Load specific MKL subsystems as needed:
(ql:quickload :mkl/vml) ; Vector Math Library
(ql:quickload :mkl/fft) ; Fast Fourier Transform (if available)
(ql:quickload :mkl/dnn) ; Deep Neural Networks (if available)Note: Quicklisp distributions are not updated frequently. If MKL subsystems are not available through Quicklisp, use the manual installation method described below.
To make the system accessible to ASDF (a build facility, similar to make in the C world), clone the repository in a directory ASDF knows about. By default the common-lisp directory in your home directory is known. Create this if it doesn't already exist and then:
- Clone the repository
cd ~/common-lisp && \
git clone https://github.com/lisp-stat/mkl.git- Reset the ASDF source-registry to find the new system (from the REPL)
(asdf:clear-source-registry) - Load the desired MKL subsystems
(asdf:load-system :mkl/vml) ; Vector Math Library (asdf:load-system :mkl/fft) ; Fast Fourier Transform (if available) (asdf:load-system :mkl/dnn) ; Deep Neural Networks (if available)
If you have installed the slime ASDF extensions, you can invoke this with a comma (',') from the slime REPL.
To get the third party systems that MKL depends on, you can use a dependency manager, such as Quicklisp or CLPM Once installed, get the dependencies with either of:
(clpm-client:sync :sources "clpi") ;sources may vary(ql:quickload :mkl/vml) ; This will also install dependenciesYou need do this only once. After obtaining the dependencies, you can load the subsystems with ASDF as described above without first syncing sources.
The VML system provides bindings to Intel MKL's Vector Math Library, which implements optimized mathematical functions for arrays and vectors. VML operations process multiple data elements in parallel, providing significant performance improvements over scalar implementations.
The VML system includes:
- Vectorized mathematical functions (trigonometric, exponential, logarithmic, power functions)
- Element-wise array operations
- Configurable accuracy modes and error handling
- Support for single and double precision floating-point data
Load the VML system with:
(asdf:load-system :mkl/vml)or
(ql:quickload :mkl/vml)Contributions are what make the open source community such an amazing place to be learn, inspire, and create. Any contributions you make are greatly appreciated. Please see CONTRIBUTING for details on the code of conduct, and the process for submitting pull requests.
Distributed under the MS-PL License. See LICENSE for more information.
Project Link: https://github.com/lisp-stat/mkl