mkl_fft -- a NumPy-based Python interface to Intel® oneAPI Math Kernel Library (oneMKL) Fourier Transform Functions
Introduction
mkl_fft is part of Intel® Distribution for Python* optimizations to NumPy.
It offers a thin layered python interface to the Intel® oneAPI Math Kernel Library (oneMKL) Fourier Transform Functions that allows efficient access to computing a discrete Fourier transform through the fast Fourier transform (FFT) algorithm. As a result, its performance is close to the performance of native C/Intel® oneMKL. The optimizations are provided for real and complex data types in both single and double precisions for in-place and out-of-place modes of operation. For analyzing the performance use FFT benchmarks.
Thanks to Intel® oneMKL’s flexibility in its supports for arbitrarily strided input and output arrays both one-dimensional and multi-dimensional FFTs along distinct axes can be performed directly, without the need to copy the input into a contiguous array first. Furthermore, input strides can be arbitrary, including negative or zero, as long as strides remain an integer multiple of array’s item size, otherwise a copy will be made.
More details can be found in "Accelerating Scientific Python with Intel Optimizations" from Proceedings of the 16th Python in Science Conference (SciPy 2017).
Installation
mkl_fft can be installed into conda environment from Intel's channel using:
conda install -c https://software.repos.intel.com/python/conda mkl_fft
or from conda-forge channel:
conda install -c conda-forge mkl_fft
To install mkl_fft PyPI package please use the following command:
python -m pip install --index-url https://software.repos.intel.com/python/pypi --extra-index-url https://pypi.org/simple mkl_fft
If command above installs NumPy package from the PyPI, please use following command to install Intel optimized NumPy wheel package from Intel PyPI Cloud:
python -m pip install --index-url https://software.repos.intel.com/python/pypi --extra-index-url https://pypi.org/simple mkl_fft numpy==<numpy_version>
where <numpy_version> should be the latest version from https://software.repos.intel.com/python/conda/.
How to use?
mkl_fft.interfaces module
The recommended way to use mkl_fft package is through mkl_fft.interfaces module. These interfaces act as drop-in replacements for equivalent functions in NumPy and SciPy. Learn more about these interfaces here.
mkl_fft package
While using the interfaces module is the recommended way to leverage mk_fft, one can also use mkl_fft directly with the following FFT functions:
complex-to-complex (c2c) transforms:
fft(x, n=None, axis=-1, norm=None, out=None) - 1D FFT, similar to scipy.fft.fft
fft2(x, s=None, axes=(-2, -1), norm=None, out=None) - 2D FFT, similar to scipy.fft.fft2
fftn(x, s=None, axes=None, norm=None, out=None) - ND FFT, similar to scipy.fft.fftn
and similar inverse FFT (ifft*) functions.
real-to-complex (r2c) and complex-to-real (c2r) transforms:
rfft(x, n=None, axis=-1, norm=None, out=None) - r2c 1D FFT, similar to numpy.fft.rfft
rfft2(x, s=None, axes=(-2, -1), norm=None, out=None) - r2c 2D FFT, similar to numpy.fft.rfft2
rfftn(x, s=None, axes=None, norm=None, out=None) - r2c ND FFT, similar to numpy.fft.rfftn
and similar inverse c2r FFT (irfft*) functions.
The following example shows how to use mkl_fft for calculating a 1D FFT.
import numpy, mkl_fft
a = numpy.random.randn(10) + 1j*numpy.random.randn(10)
mkl_res = mkl_fft.fft(a)
np_res = numpy.fft.fft(a)
numpy.allclose(mkl_res, np_res)
# True
Patching Mechanisms
mkl_fft provides convenient patch methods to enable MKL-accelerated FFT operations in NumPy with or without modifying your code.
CLI Quickstart
Persistent patch (all Python sessions)
# Install
python -m mkl_fft --patch install
# Status (exit code: 0 = installed, 1 = not installed)
python -m mkl_fft --patch status
# Remove
python -m mkl_fft --patch uninstall
Verify current FFT backend
python -c "import numpy; print(f'numpy.fft.fft.__module__: {numpy.fft.fft.__module__}')"
One-shot patch (single command only)
# Script
python -m mkl_fft --with-numpy-patch my_script.py
# Pytest
python -m mkl_fft --with-numpy-patch -m pytest tests/
# One-liner
python -m mkl_fft --with-numpy-patch -c "import numpy; print(f\"numpy.fft.fft.__module__: {numpy.fft.fft.__module__}\")"
# Non-Python command
python -m mkl_fft --with-numpy-patch -- <command> [args...]
Programmatic Quickstart
import mkl_fft
mkl_fft.patch_numpy_fft()
print(mkl_fft.is_patched())
mkl_fft.restore_numpy_fft()
with mkl_fft.mkl_fft():
pass
Building from source
A C compiler, Intel® oneAPI Math Kernel Library (oneMKL), and NumPy are required
to build mkl_fft from source.
Executing
python -m pip install .
will pull in the required build dependencies, including mkl and numpy, and build mkl_fft.
If you already have mkl and numpy installed (from your system or a conda environment)
and want to reuse them instead of pulling fresh copies into an isolated build, first
install the build dependencies:
pip install meson-python cmake ninja "cython>=3.1.0" numpy mkl-devel
then build against the existing installation with:
python -m pip install --no-build-isolation --no-deps .
Optionally, install scipy to use the mkl_fft.interfaces.scipy_fft module:
pip install scipy
Contributing
See CONTRIBUTING.md for the development workflow: setting up a build environment, running the tests and lint hooks, code style, and what to include in a pull request.
Metadata
Release files for mkl-fft 2.4.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Built distributions (wheels)
| File | Reset | |||
|---|---|---|---|---|
| mkl_fft-2.4.0-0-cp314-cp314t-win_amd64.whl | CPython 3.14 | CPython 3.14 free-threading | Windows x86-64 | Details |
| mkl_fft-2.4.0-0-cp314-cp314t-manylinux_2_28_x86_64.whl | CPython 3.14 | CPython 3.14 free-threading | Linux glibc 2.28+ x86-64 | Details |
| mkl_fft-2.4.0-0-cp314-cp314-win_amd64.whl | CPython 3.14 | CPython 3.14 | Windows x86-64 | Details |
| mkl_fft-2.4.0-0-cp314-cp314-manylinux_2_28_x86_64.whl | CPython 3.14 | CPython 3.14 | Linux glibc 2.28+ x86-64 | Details |
| mkl_fft-2.4.0-0-cp313-cp313-win_amd64.whl | CPython 3.13 | CPython 3.13 | Windows x86-64 | Details |
| mkl_fft-2.4.0-0-cp313-cp313-manylinux_2_28_x86_64.whl | CPython 3.13 | CPython 3.13 | Linux glibc 2.28+ x86-64 | Details |
| mkl_fft-2.4.0-0-cp312-cp312-win_amd64.whl | CPython 3.12 | CPython 3.12 | Windows x86-64 | Details |
| mkl_fft-2.4.0-0-cp312-cp312-manylinux_2_28_x86_64.whl | CPython 3.12 | CPython 3.12 | Linux glibc 2.28+ x86-64 | Details |
| mkl_fft-2.4.0-0-cp311-cp311-win_amd64.whl | CPython 3.11 | CPython 3.11 | Windows x86-64 | Details |
| mkl_fft-2.4.0-0-cp311-cp311-manylinux_2_28_x86_64.whl | CPython 3.11 | CPython 3.11 | Linux glibc 2.28+ x86-64 | Details |
| mkl_fft-2.4.0-0-cp310-cp310-win_amd64.whl | CPython 3.10 | CPython 3.10 | Windows x86-64 | Details |
| mkl_fft-2.4.0-0-cp310-cp310-manylinux_2_28_x86_64.whl | CPython 3.10 | CPython 3.10 | Linux glibc 2.28+ x86-64 | Details |
Total release size: 1.9 MB
Release files / mkl_fft-2.4.0-0-cp314-cp314t-win_amd64.whl
| Download URL | mkl_fft-2.4.0-0-cp314-cp314t-win_amd64.whl |
|---|---|
| Size | 158.4 kB |
| Tags | CPython 3.14 CPython 3.14 free-threading Windows x86-64 |
|
SHA-256 checksum How to use checksums |
4387cb4c3f5824ebe8da882078d43f86076077c30ff1ff7869f13a3c264082c3
|
|
BLAKE2b-256 checksum How to use checksums |
171bd12ea653af635e221464a424f220a3c0c7b969cb862e3db44f29a0c94889
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.12.12
|
Release files / mkl_fft-2.4.0-0-cp314-cp314t-manylinux_2_28_x86_64.whl
| Download URL | mkl_fft-2.4.0-0-cp314-cp314t-manylinux_2_28_x86_64.whl |
|---|---|
| Size | 164.2 kB |
| Tags | CPython 3.14 CPython 3.14 free-threading Linux glibc 2.28+ x86-64 |
|
SHA-256 checksum How to use checksums |
1721bd315e6ff582805f8491a49536e0c7c0800a5b0f8e43fc001aaf94df3b7f
|
|
BLAKE2b-256 checksum How to use checksums |
25f227fd2d606c320c7fdb45c01ed1564e7e1e437dcbbac7456543eb75a822f0
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.12.12
|
Release files / mkl_fft-2.4.0-0-cp314-cp314-win_amd64.whl
| Download URL | mkl_fft-2.4.0-0-cp314-cp314-win_amd64.whl |
|---|---|
| Size | 149.8 kB |
| Tags | CPython 3.14 Windows x86-64 |
|
SHA-256 checksum How to use checksums |
66d13da1d2efa471686d615aedd5f67c8fa8e45c3516be9eb96f29ce2b590279
|
|
BLAKE2b-256 checksum How to use checksums |
b264c368571239209fb575ef6b2c9874d3d286b23364367af5ac74f074d02a63
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.12.12
|
Release files / mkl_fft-2.4.0-0-cp314-cp314-manylinux_2_28_x86_64.whl
| Download URL | mkl_fft-2.4.0-0-cp314-cp314-manylinux_2_28_x86_64.whl |
|---|---|
| Size | 162.0 kB |
| Tags | CPython 3.14 Linux glibc 2.28+ x86-64 |
|
SHA-256 checksum How to use checksums |
a24f011655f88e67ece39c76b4a1e65fa3964e45470178e56dc601197fcf8c81
|
|
BLAKE2b-256 checksum How to use checksums |
8aff6893287ac48b4dcd2b328a5164f400ff3fe82fdb698317dfc3f0b49edee5
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.12.12
|
Release files / mkl_fft-2.4.0-0-cp313-cp313-win_amd64.whl
| Download URL | mkl_fft-2.4.0-0-cp313-cp313-win_amd64.whl |
|---|---|
| Size | 149.7 kB |
| Tags | CPython 3.13 Windows x86-64 |
|
SHA-256 checksum How to use checksums |
266bb1a4ab4a697e29b332084887e4176b3495e5e530566879784c8104e0fb92
|
|
BLAKE2b-256 checksum How to use checksums |
9109b9f54662ba065a6de0105e96ba826917bb601929c72297b58d16fa8c9c96
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.12.12
|
Release files / mkl_fft-2.4.0-0-cp313-cp313-manylinux_2_28_x86_64.whl
| Download URL | mkl_fft-2.4.0-0-cp313-cp313-manylinux_2_28_x86_64.whl |
|---|---|
| Size | 161.7 kB |
| Tags | CPython 3.13 Linux glibc 2.28+ x86-64 |
|
SHA-256 checksum How to use checksums |
2baedc7e87f94c35e45440eed9e0f9b2750e6fbc9563e7eb9c4b12dbfdf8950c
|
|
BLAKE2b-256 checksum How to use checksums |
816a3c8ce5677f866f49217c9790a57d1833e66ac08f0ca895237905408009e0
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.12.12
|
Release files / mkl_fft-2.4.0-0-cp312-cp312-win_amd64.whl
| Download URL | mkl_fft-2.4.0-0-cp312-cp312-win_amd64.whl |
|---|---|
| Size | 149.9 kB |
| Tags | CPython 3.12 Windows x86-64 |
|
SHA-256 checksum How to use checksums |
5046f550b5cc516d0f8dd80708e822613bc5593760c76460a0d619d6cdcbde52
|
|
BLAKE2b-256 checksum How to use checksums |
7e4fa7b619c1823500691227c6e2e293f46179f4ffcdea259573f79571faa7d8
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.12.12
|
Release files / mkl_fft-2.4.0-0-cp312-cp312-manylinux_2_28_x86_64.whl
| Download URL | mkl_fft-2.4.0-0-cp312-cp312-manylinux_2_28_x86_64.whl |
|---|---|
| Size | 161.9 kB |
| Tags | CPython 3.12 Linux glibc 2.28+ x86-64 |
|
SHA-256 checksum How to use checksums |
714a015c6bbfe64ed1aadde10bc5100b17ab9153cf32435af9a8517118d2bed1
|
|
BLAKE2b-256 checksum How to use checksums |
6d9a30c534cbcd92656baa72fa6313d6651401e215e3db7826a27f45306274d6
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.12.12
|
Release files / mkl_fft-2.4.0-0-cp311-cp311-win_amd64.whl
| Download URL | mkl_fft-2.4.0-0-cp311-cp311-win_amd64.whl |
|---|---|
| Size | 151.5 kB |
| Tags | CPython 3.11 Windows x86-64 |
|
SHA-256 checksum How to use checksums |
f2b740151ec7c66fb2a7cf1309b9a6fb98d246e681e5698cf6cbece14c135605
|
|
BLAKE2b-256 checksum How to use checksums |
5d44169ec42824a85101e48d947304f18b43968aa6ac2122e4da7b10090deaad
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.12.12
|
Release files / mkl_fft-2.4.0-0-cp311-cp311-manylinux_2_28_x86_64.whl
| Download URL | mkl_fft-2.4.0-0-cp311-cp311-manylinux_2_28_x86_64.whl |
|---|---|
| Size | 161.9 kB |
| Tags | CPython 3.11 Linux glibc 2.28+ x86-64 |
|
SHA-256 checksum How to use checksums |
746783d1e4320738a4e62cc79e2fdaf154f08f71d938725eb04461c3792489ef
|
|
BLAKE2b-256 checksum How to use checksums |
daea6389e578b98654b357903b4c292b23b409ef306e734504a3b78a5a49b779
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.12.12
|
Release files / mkl_fft-2.4.0-0-cp310-cp310-win_amd64.whl
| Download URL | mkl_fft-2.4.0-0-cp310-cp310-win_amd64.whl |
|---|---|
| Size | 152.0 kB |
| Tags | CPython 3.10 Windows x86-64 |
|
SHA-256 checksum How to use checksums |
18832517af8f2a99a505623391ddfe33c1bf1f65884ede3751bca643c035c2eb
|
|
BLAKE2b-256 checksum How to use checksums |
f50601d8a3095a4c070e3cd6a57bf4c7d8bfb14b62e6ae151b36c9db73c57778
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.12.12
|
Release files / mkl_fft-2.4.0-0-cp310-cp310-manylinux_2_28_x86_64.whl
| Download URL | mkl_fft-2.4.0-0-cp310-cp310-manylinux_2_28_x86_64.whl |
|---|---|
| Size | 162.3 kB |
| Tags | CPython 3.10 Linux glibc 2.28+ x86-64 |
|
SHA-256 checksum How to use checksums |
671ccd72ce0ff3eca521b67057586c2a19aadf864b751ffe248e51a9d9148511
|
|
BLAKE2b-256 checksum How to use checksums |
04d1ffd02dc29cd5c2793a495cd86dc3ddaf398f8a546058d425e5cc0e687fba
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.12.12
|
Security for mkl-fft 2.4.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.