Skip to main content

Conda package Editable build using pip and pre-release NumPy Conda package with conda-forge channel only OpenSSF Scorecard

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 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

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

mkl_fft-2.3.2-0-cp314-cp314-win_amd64.whl (137.8 kB view details)

Uploaded CPython 3.14Windows x86-64

mkl_fft-2.3.2-0-cp314-cp314-manylinux_2_28_x86_64.whl (152.0 kB view details)

Uploaded CPython 3.14manylinux: glibc 2.28+ x86-64

mkl_fft-2.3.2-0-cp313-cp313-win_amd64.whl (137.5 kB view details)

Uploaded CPython 3.13Windows x86-64

mkl_fft-2.3.2-0-cp313-cp313-manylinux_2_28_x86_64.whl (151.5 kB view details)

Uploaded CPython 3.13manylinux: glibc 2.28+ x86-64

mkl_fft-2.3.2-0-cp312-cp312-win_amd64.whl (137.8 kB view details)

Uploaded CPython 3.12Windows x86-64

mkl_fft-2.3.2-0-cp312-cp312-manylinux_2_28_x86_64.whl (154.2 kB view details)

Uploaded CPython 3.12manylinux: glibc 2.28+ x86-64

mkl_fft-2.3.2-0-cp311-cp311-win_amd64.whl (139.4 kB view details)

Uploaded CPython 3.11Windows x86-64

mkl_fft-2.3.2-0-cp311-cp311-manylinux_2_28_x86_64.whl (152.6 kB view details)

Uploaded CPython 3.11manylinux: glibc 2.28+ x86-64

mkl_fft-2.3.2-0-cp310-cp310-win_amd64.whl (139.4 kB view details)

Uploaded CPython 3.10Windows x86-64

mkl_fft-2.3.2-0-cp310-cp310-manylinux_2_28_x86_64.whl (152.7 kB view details)

Uploaded CPython 3.10manylinux: glibc 2.28+ x86-64

File details

Details for the file mkl_fft-2.3.2-0-cp314-cp314-win_amd64.whl.

File metadata

  • Download URL: mkl_fft-2.3.2-0-cp314-cp314-win_amd64.whl
  • Upload date:
  • Size: 137.8 kB
  • Tags: CPython 3.14, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.12

File hashes

Hashes for mkl_fft-2.3.2-0-cp314-cp314-win_amd64.whl
Algorithm Hash digest
SHA256 9ea486a052a1bc4fe955162a01a4c26f8de33552ef979b1943e096a5135756b7
MD5 9a150dcad4252c9f216a3d990fc3cc3a
BLAKE2b-256 35264003095bf61e92d979ecf8844acaa178a3cc95aac765e39eae764c40b209

See more details on using hashes here.

File details

Details for the file mkl_fft-2.3.2-0-cp314-cp314-manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for mkl_fft-2.3.2-0-cp314-cp314-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 f3d5c4e9a98e69990c0fded2761c52c76b66bcf0bc9a103aaa48b120dfb1abc0
MD5 17724e9c940cade0d80c37a9592e8470
BLAKE2b-256 5fbf053500231ed5694caa0e171ded5435900830742e866ebca856f5b9521740

See more details on using hashes here.

File details

Details for the file mkl_fft-2.3.2-0-cp313-cp313-win_amd64.whl.

File metadata

  • Download URL: mkl_fft-2.3.2-0-cp313-cp313-win_amd64.whl
  • Upload date:
  • Size: 137.5 kB
  • Tags: CPython 3.13, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.12

File hashes

Hashes for mkl_fft-2.3.2-0-cp313-cp313-win_amd64.whl
Algorithm Hash digest
SHA256 eb6f3895142bda817eb5981ed292d5930fca7a94f1c985c3b016bb211b0cafb2
MD5 dddc641c844a5fee3e41c637fbd07113
BLAKE2b-256 9db5bb33af0c8d137f46d37c84eea6409b4743df33ab9bdae4942f411ac41ae1

See more details on using hashes here.

File details

Details for the file mkl_fft-2.3.2-0-cp313-cp313-manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for mkl_fft-2.3.2-0-cp313-cp313-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 09823ae97971b80d2724f3ca2d95928570f4991452869dc024378fe6c5681e27
MD5 b2d0be9c6826b1aee21127f88b8ed6a4
BLAKE2b-256 e5cd316530dd810d5919a0bf79dde9643241e0dc93ae099ab4ee5516a397c682

See more details on using hashes here.

File details

Details for the file mkl_fft-2.3.2-0-cp312-cp312-win_amd64.whl.

File metadata

  • Download URL: mkl_fft-2.3.2-0-cp312-cp312-win_amd64.whl
  • Upload date:
  • Size: 137.8 kB
  • Tags: CPython 3.12, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.12

File hashes

Hashes for mkl_fft-2.3.2-0-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 76c91d4b861ff6a2f8791d394a7923e147753a7cba7420b59f10959cb114dabe
MD5 17c89c2e9bfa4412bd3150e539a14ec9
BLAKE2b-256 4028c934e255a16aac63e79b24f2d2c1b993140a62c94b7e91b087455f935003

See more details on using hashes here.

File details

Details for the file mkl_fft-2.3.2-0-cp312-cp312-manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for mkl_fft-2.3.2-0-cp312-cp312-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 1333810c755f9478916f3ea00894b36a525d27a1f5f7dce58070a381301b2e8b
MD5 40b4bf0ac8720e5e4ca4e92a7e80cf50
BLAKE2b-256 5ba88492610d531360d9a2a76bfac2edfee8791158544415397f6949ffeae3c8

See more details on using hashes here.

File details

Details for the file mkl_fft-2.3.2-0-cp311-cp311-win_amd64.whl.

File metadata

  • Download URL: mkl_fft-2.3.2-0-cp311-cp311-win_amd64.whl
  • Upload date:
  • Size: 139.4 kB
  • Tags: CPython 3.11, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.12

File hashes

Hashes for mkl_fft-2.3.2-0-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 8bf20db0eff320af52a5ce6b4270606c8877cbdc6c3b52f8a465a7d5f0151691
MD5 21bb8f3f2a880c306b3fbb11151090bb
BLAKE2b-256 0fad1c381577d53118604b258ebb668660cce663de0bae311103c3e1f8a3f63d

See more details on using hashes here.

File details

Details for the file mkl_fft-2.3.2-0-cp311-cp311-manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for mkl_fft-2.3.2-0-cp311-cp311-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 9b4092535403139e6af5dfe192efc3129313a4d8237bbe9e2419d8db7f9e3630
MD5 02ac688c173a83d20d7da93d5c5fa7d2
BLAKE2b-256 e51c18a7b1db8e149fd60c49089e72bd48f2606103be5caaad984d18495fd891

See more details on using hashes here.

File details

Details for the file mkl_fft-2.3.2-0-cp310-cp310-win_amd64.whl.

File metadata

  • Download URL: mkl_fft-2.3.2-0-cp310-cp310-win_amd64.whl
  • Upload date:
  • Size: 139.4 kB
  • Tags: CPython 3.10, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.12

File hashes

Hashes for mkl_fft-2.3.2-0-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 5bc8d97fe4fd2d2a8836f3aad1438dc47fb5616c092e2817a04b1cc6a236a2fa
MD5 ee25db810a8990a8abc831ad8c947c72
BLAKE2b-256 7af6f6cf3787180eb60a6c6f62e162e7b0d01e33ce1cd4820373fa5a12241cb9

See more details on using hashes here.

File details

Details for the file mkl_fft-2.3.2-0-cp310-cp310-manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for mkl_fft-2.3.2-0-cp310-cp310-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 5f7e1eecb7f5f2295e216d78da74ef79ea7a3cfc3a3048b6bb44ce5c83a35aca
MD5 cd4c25edaf313f7faf426f6a5bbb688e
BLAKE2b-256 c4c795895d0b86b6f028b16d6b92ed9a963c807762bb46652d782192bb39683b

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page