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.0-0-cp314-cp314-win_amd64.whl (137.8 kB view details)

Uploaded CPython 3.14Windows x86-64

mkl_fft-2.3.0-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.0-0-cp313-cp313-win_amd64.whl (137.5 kB view details)

Uploaded CPython 3.13Windows x86-64

mkl_fft-2.3.0-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.0-0-cp312-cp312-win_amd64.whl (137.8 kB view details)

Uploaded CPython 3.12Windows x86-64

mkl_fft-2.3.0-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.0-0-cp311-cp311-win_amd64.whl (139.4 kB view details)

Uploaded CPython 3.11Windows x86-64

mkl_fft-2.3.0-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.0-0-cp310-cp310-win_amd64.whl (139.4 kB view details)

Uploaded CPython 3.10Windows x86-64

mkl_fft-2.3.0-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.0-0-cp314-cp314-win_amd64.whl.

File metadata

  • Download URL: mkl_fft-2.3.0-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.0-0-cp314-cp314-win_amd64.whl
Algorithm Hash digest
SHA256 738999669801bc1c319b1e585667cbffe4bd40c16008ab9094387ca4962afd66
MD5 6b6e7c522e314f7d1c6969a154469f0a
BLAKE2b-256 90968d318c825a547ed7a76f12058e72514e1cf77b45d616a25d417929a90211

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for mkl_fft-2.3.0-0-cp314-cp314-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 dda70402928962ab316d1288d6d8015c7da39fc4d30552846055b5255ef888ed
MD5 d2476f4a3d8c778aba8e8dca6e324fe6
BLAKE2b-256 2c5a8b3eddc497555ea3f91d6ea85b71904dd80152d8b54bf897c0991e7bafd8

See more details on using hashes here.

File details

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

File metadata

  • Download URL: mkl_fft-2.3.0-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.0-0-cp313-cp313-win_amd64.whl
Algorithm Hash digest
SHA256 6e66b45d2ffc1fcce381473568f74946667bccb605cd7569ee9d0915fd8218d1
MD5 da66ce5ee658f22eb5d2ebac898d22c1
BLAKE2b-256 3dd923a47ec4061207aceb3603f50c884434665f528a811cf84d3f03c28eae50

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for mkl_fft-2.3.0-0-cp313-cp313-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 00ceb32defa2102e5c9978192de1628ca9bf399ff04d9d32657ff6629456d0eb
MD5 34aa3242779006ee8035ed9de9f47173
BLAKE2b-256 2ebb37c6b285176b8312dbbdce98beba5164e5f429b7f7130ba4b1132da4bcce

See more details on using hashes here.

File details

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

File metadata

  • Download URL: mkl_fft-2.3.0-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.0-0-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 426864384cfbc84328b790952c814d07e578f7698e50ced272582d98fdf6f28c
MD5 119a24b8cf9414186b822c8ae0289eeb
BLAKE2b-256 7f56a44544d8efa649080b5528c296af901cd3bbd37b7696b6a9a9550d3ad04f

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for mkl_fft-2.3.0-0-cp312-cp312-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 fcd2e99d4a7cb2e7a741273a4ca1f8385cc6c3b0c523a8f989539f91039b9966
MD5 89e25aeb54b7397471b214215e25d3d1
BLAKE2b-256 788f3f1849253559f1c4e035fbab90574d92a0eaf340caf9138e73214a4113ed

See more details on using hashes here.

File details

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

File metadata

  • Download URL: mkl_fft-2.3.0-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.0-0-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 eb21a32f861f3214cfe269585ce4c6e463e90233e5019e11dc428fb60b19df58
MD5 f233001f6e9c3982eff515a0caf1a65d
BLAKE2b-256 7a4de87235f0ec50bc6ffb5cbf65b1d0f4a5b1f689394a827af0d91655f4c378

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for mkl_fft-2.3.0-0-cp311-cp311-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 5daefcbb0176ed98c425b58593688d699737c194becdb4459666ddcda6ab6962
MD5 45ab97cee870b2b4e8e164f125fb3a3c
BLAKE2b-256 c61766e976bd6dbed907bf4794c2a5ce26895290dd83fa481e9b214923233a73

See more details on using hashes here.

File details

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

File metadata

  • Download URL: mkl_fft-2.3.0-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.0-0-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 b0ca77cdeddd35336bdd3b706449dff1aa024477c8dc270041547557c80b32d4
MD5 9bf6b164bf1abf7f648b8549d4c9972b
BLAKE2b-256 14d8490494b5e69df561ca4a819e8e37757dd4d7c3f43fdefca6a9adea50d8fa

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for mkl_fft-2.3.0-0-cp310-cp310-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 8363d598d82901d868b80438c299a235587ef8da7bd8ff3c991aca2cb2e95145
MD5 7bd494065bc3c5079db47042e44e4149
BLAKE2b-256 1f28f07388638ceffa1fc84b86abac35fda77cacf505f4fbd1010e4d97642a65

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