MKL-based FFT transforms for NumPy arrays
Project description
mkl_fft
-- a NumPy-based Python interface to Intel® oneAPI Math Kernel Library (OneMKL) FFT functionality
Introduction
mkl_fft
started as a part of Intel® Distribution for Python* optimizations to NumPy, and is now being released
as a stand-alone package. It offers a thin layered interface for the Intel® oneAPI Math Kernel Library (OneMKL) FFT functionality that allows efficient access to native FFT optimizations from a range of NumPy and SciPy functions. 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 Fast Fourier Transforms 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 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, overwrite_x=False, fwd_scale=1.0, out=None)
- 1D FFT, similar to scipy.fft.fft
fft2(x, s=None, axes=(-2, -1), overwrite_x=False, fwd_scale=1.0, out=None)
- 2D FFT, similar to scipy.fft.fft2
fftn(x, s=None, axes=None, overwrite_x=False, fwd_scale=1.0, 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, fwd_scale=1.0, out=None)
- r2c 1D FFT, similar to numpy.fft.rfft
rfft2(x, s=None, axes=(-2, -1), fwd_scale=1.0, out=None)
- r2c 2D FFT, similar to numpy.fft.rfft2
rfftn(x, s=None, axes=None, fwd_scale=1.0, 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
Building from source
To build mkl_fft
from sources on Linux with Intel® OneMKL:
- create a virtual environment:
python3 -m venv fft_env
- activate the environment:
source fft_env/bin/activate
- install a recent version of OneMKL, if necessary
- execute
source /path_to_oneapi/mkl/latest/env/vars.sh
git clone https://github.com/IntelPython/mkl_fft.git mkl_fft
cd mkl_fft
python -m pip install .
pip install scipy
(optional: for usingmkl_fft.interface.scipy_fft
module)cd ..
python -c "import mkl_fft"
To build mkl_fft
from sources on Linux with conda follow these steps:
conda create -n fft_env python=3.12 mkl-devel
conda activate fft_env
export MKLROOT=$CONDA_PREFIX
git clone https://github.com/IntelPython/mkl_fft.git mkl_fft
cd mkl_fft
python -m pip install .
conda install scipy
(optional: for usingmkl_fft.interface.scipy_fft
module)cd ..
python -c "import mkl_fft"
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distributions
Built Distributions
File details
Details for the file mkl_fft-2.0.0-23-cp313-cp313-win_amd64.whl
.
File metadata
- Download URL: mkl_fft-2.0.0-23-cp313-cp313-win_amd64.whl
- Upload date:
- Size: 144.8 kB
- Tags: CPython 3.13, Windows x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.0 CPython/3.10.15
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 |
4d5cb98f166478f3eb050661ac9d6324caa395e039b343750a8dbb14788a28c0
|
|
MD5 |
a0833966016d471af9995575abf92a88
|
|
BLAKE2b-256 |
d85810c98088c33bf96465464ce91a4420a8371bc7154e1d20beb7e8b72b2d2a
|
File details
Details for the file mkl_fft-2.0.0-23-cp313-cp313-manylinux_2_28_x86_64.whl
.
File metadata
- Download URL: mkl_fft-2.0.0-23-cp313-cp313-manylinux_2_28_x86_64.whl
- Upload date:
- Size: 3.7 MB
- Tags: CPython 3.13, manylinux: glibc 2.28+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.0 CPython/3.10.15
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 |
5c4039387bc96dd93795899c15435d5502207dc54ddf6316a648704f89cb0bb3
|
|
MD5 |
b1b04459fc248c282e40e5346a6c39f5
|
|
BLAKE2b-256 |
87a735296a6baddd1fc460e39f825eeb298d5357771f382630acd24e13fc6bb2
|
File details
Details for the file mkl_fft-2.0.0-22-cp312-cp312-manylinux_2_28_x86_64.whl
.
File metadata
- Download URL: mkl_fft-2.0.0-22-cp312-cp312-manylinux_2_28_x86_64.whl
- Upload date:
- Size: 3.7 MB
- Tags: CPython 3.12, manylinux: glibc 2.28+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.0 CPython/3.10.15
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 |
85f2c684f26a80a8affcdba6a6cc77b392878b82edf4f0f431e216c8cd1e1096
|
|
MD5 |
04c704ee7064722baaa769dff7d29064
|
|
BLAKE2b-256 |
64377e93700495db235be30c83a920ba48dfbe884e4190e52a4ab008ef5caf41
|
File details
Details for the file mkl_fft-2.0.0-22-cp311-cp311-manylinux_2_28_x86_64.whl
.
File metadata
- Download URL: mkl_fft-2.0.0-22-cp311-cp311-manylinux_2_28_x86_64.whl
- Upload date:
- Size: 3.7 MB
- Tags: CPython 3.11, manylinux: glibc 2.28+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.0 CPython/3.10.15
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 |
091af736d6307cc3eaef2c4fef16faab72083ae95ed8c7ff283c413b91ea4da4
|
|
MD5 |
85995a2e26347afd77cb3fedc86b7083
|
|
BLAKE2b-256 |
a3808911bea06f68774cba9f8d17f0b4a7e4894de055e77923f76d3035d21f80
|
File details
Details for the file mkl_fft-2.0.0-22-cp310-cp310-manylinux_2_28_x86_64.whl
.
File metadata
- Download URL: mkl_fft-2.0.0-22-cp310-cp310-manylinux_2_28_x86_64.whl
- Upload date:
- Size: 3.7 MB
- Tags: CPython 3.10, manylinux: glibc 2.28+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.0 CPython/3.10.15
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 |
5d0e260864f6b23c3cec91c560628e33abb3be78a427b28b66d141199f078d01
|
|
MD5 |
6d95147af971fa532d4b9c8e3360e819
|
|
BLAKE2b-256 |
ae9e9a65dd6c4dc661e3c1bc5ecab132147764c28b9447d9e045468d3eacb7db
|
File details
Details for the file mkl_fft-2.0.0-21-cp312-cp312-win_amd64.whl
.
File metadata
- Download URL: mkl_fft-2.0.0-21-cp312-cp312-win_amd64.whl
- Upload date:
- Size: 145.0 kB
- Tags: CPython 3.12, Windows x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.0 CPython/3.10.15
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 |
89c60a29548133e2f33bd5378ca6a618d39786f4f0ad2dfdb7bc09d13b88275a
|
|
MD5 |
2e9920471ce2a6067764c5d0cf29a710
|
|
BLAKE2b-256 |
e525513af475e8a8ced674898669d06bd8fd6f65706375715dab86fe1e5fce38
|
File details
Details for the file mkl_fft-2.0.0-21-cp311-cp311-win_amd64.whl
.
File metadata
- Download URL: mkl_fft-2.0.0-21-cp311-cp311-win_amd64.whl
- Upload date:
- Size: 147.9 kB
- Tags: CPython 3.11, Windows x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.0 CPython/3.10.15
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 |
5d1cc537a01c00806d5dde1d07821b4936d51118bce9f1f764a15e1d92933dcc
|
|
MD5 |
72f9ab6736d14c2bba9cb79f37296c56
|
|
BLAKE2b-256 |
0318629dfe6e1cf05c88f1466e4c502d5d4ef8ffa33768a0f8023e8e6f8d6800
|
File details
Details for the file mkl_fft-2.0.0-21-cp310-cp310-win_amd64.whl
.
File metadata
- Download URL: mkl_fft-2.0.0-21-cp310-cp310-win_amd64.whl
- Upload date:
- Size: 146.4 kB
- Tags: CPython 3.10, Windows x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.0 CPython/3.10.15
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 |
77ac3c00e21f6d8a37c619abe1380538fb51ebad222957d47c4d590b6fc6d921
|
|
MD5 |
ab585d163acb7ba12f93a9afb7c869de
|
|
BLAKE2b-256 |
ba10bc4e989322d9a2394dbf8e2b7d262c8f8aa954fe41d7831942b828d626b7
|
File details
Details for the file mkl_fft-2.0.0-1-cp39-cp39-win_amd64.whl
.
File metadata
- Download URL: mkl_fft-2.0.0-1-cp39-cp39-win_amd64.whl
- Upload date:
- Size: 146.4 kB
- Tags: CPython 3.9, Windows x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.0 CPython/3.10.15
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 |
6625b56fdedd7ecee0de14226adb92fa4e72498af36e5c657cb9e616bc839158
|
|
MD5 |
7a5118fa3de08acd1c66f502d32fc51d
|
|
BLAKE2b-256 |
e689d9342032cbb1b92218e8e9c115805b377d930d1ed12f2c7dcbc7f15d026a
|
File details
Details for the file mkl_fft-2.0.0-1-cp39-cp39-manylinux_2_28_x86_64.whl
.
File metadata
- Download URL: mkl_fft-2.0.0-1-cp39-cp39-manylinux_2_28_x86_64.whl
- Upload date:
- Size: 3.7 MB
- Tags: CPython 3.9, manylinux: glibc 2.28+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.0 CPython/3.10.15
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 |
1048bc8a4e4cc7bb4dcd5aa0fef51ab01f51eef1970a96ed7725cc8190daa05f
|
|
MD5 |
dfa95f47c81d56f9ce5b3a3fc003c23c
|
|
BLAKE2b-256 |
ffc9b0eeb20475418c6b6bffea4812419dca8a84c0d054ea7068c08d91eb4147
|