Skip to main content

MKL-based FFT transforms for NumPy arrays

Project description

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

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 using mkl_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 using mkl_fft.interface.scipy_fft module)
  • cd ..
  • python -c "import mkl_fft"

Project details


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

Uploaded CPython 3.14Windows x86-64

mkl_fft-2.1.2-0-cp314-cp314-manylinux_2_28_x86_64.whl (151.1 kB view details)

Uploaded CPython 3.14manylinux: glibc 2.28+ x86-64

mkl_fft-2.1.2-0-cp313-cp313-win_amd64.whl (139.8 kB view details)

Uploaded CPython 3.13Windows x86-64

mkl_fft-2.1.2-0-cp313-cp313-manylinux_2_28_x86_64.whl (150.5 kB view details)

Uploaded CPython 3.13manylinux: glibc 2.28+ x86-64

mkl_fft-2.1.2-0-cp312-cp312-win_amd64.whl (140.0 kB view details)

Uploaded CPython 3.12Windows x86-64

mkl_fft-2.1.2-0-cp312-cp312-manylinux_2_28_x86_64.whl (153.3 kB view details)

Uploaded CPython 3.12manylinux: glibc 2.28+ x86-64

mkl_fft-2.1.2-0-cp311-cp311-win_amd64.whl (141.6 kB view details)

Uploaded CPython 3.11Windows x86-64

mkl_fft-2.1.2-0-cp311-cp311-manylinux_2_28_x86_64.whl (152.0 kB view details)

Uploaded CPython 3.11manylinux: glibc 2.28+ x86-64

mkl_fft-2.1.2-0-cp310-cp310-win_amd64.whl (141.7 kB view details)

Uploaded CPython 3.10Windows x86-64

mkl_fft-2.1.2-0-cp310-cp310-manylinux_2_28_x86_64.whl (152.3 kB view details)

Uploaded CPython 3.10manylinux: glibc 2.28+ x86-64

File details

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

File metadata

  • Download URL: mkl_fft-2.1.2-0-cp314-cp314-win_amd64.whl
  • Upload date:
  • Size: 140.0 kB
  • Tags: CPython 3.14, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.10.14

File hashes

Hashes for mkl_fft-2.1.2-0-cp314-cp314-win_amd64.whl
Algorithm Hash digest
SHA256 fbd883cdaf9e2c7f53a81a7c5c7bfe535ae0b2dd34c94151765c66eaba92f4b1
MD5 082d472c73b57ea4768ae85c3cd4da4f
BLAKE2b-256 459998340b2efc2e090005a511f478ee32eabbcb30ca8ff0f3614ad51ceb4cac

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for mkl_fft-2.1.2-0-cp314-cp314-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 5e3395dcdfd2e571d717b9594c6f02eaf6c2845159b48ce0b2462e47960360f8
MD5 a78d9251339ea1d537d313153d393374
BLAKE2b-256 f31087fb3551c50db9f4ba2a0be8a60242254b6a59c5411aaf9610ef920d60dd

See more details on using hashes here.

File details

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

File metadata

  • Download URL: mkl_fft-2.1.2-0-cp313-cp313-win_amd64.whl
  • Upload date:
  • Size: 139.8 kB
  • Tags: CPython 3.13, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.10.14

File hashes

Hashes for mkl_fft-2.1.2-0-cp313-cp313-win_amd64.whl
Algorithm Hash digest
SHA256 037bc18476d115a3dd369cee51ba74d129803163fb6e44537263be1bade41200
MD5 f584e1d1686887db713748c579945fde
BLAKE2b-256 e9918bd581805ec969234977b3e430e30e7f5bd3e5e5e1cd3ffdb7a3d22a8e12

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for mkl_fft-2.1.2-0-cp313-cp313-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 0616da164fca8bc4b62258cba834bb2626040c25d9080f97e7149ba3cf1e1234
MD5 212653b1c86b072497f883b5fe7c18e0
BLAKE2b-256 c1a6b829ea6c84360b9224778ef36b6fc55d39b86951c241bc90ebd51bfb6519

See more details on using hashes here.

File details

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

File metadata

  • Download URL: mkl_fft-2.1.2-0-cp312-cp312-win_amd64.whl
  • Upload date:
  • Size: 140.0 kB
  • Tags: CPython 3.12, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.10.14

File hashes

Hashes for mkl_fft-2.1.2-0-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 7a389640a489fc802e3ff55012d6381d30f996a61d48929232abe6cd6b5a527d
MD5 f0fb0ed9ad8638d9ec0fd14e0f516438
BLAKE2b-256 41b61c341fd7d3d93569050d5b30db9ccccbec353ede4e7de619f93acea6f8bb

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for mkl_fft-2.1.2-0-cp312-cp312-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 69ca28e18427892f504d9bfd3f84352dea667b09c87a6218624ee5dd05214da0
MD5 84987d949afdc8476d279e3ad89db7c1
BLAKE2b-256 ace1a78b5d209789c33ab5f0fb08d9ec4426f0d15fac894f38ea4244d3ededad

See more details on using hashes here.

File details

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

File metadata

  • Download URL: mkl_fft-2.1.2-0-cp311-cp311-win_amd64.whl
  • Upload date:
  • Size: 141.6 kB
  • Tags: CPython 3.11, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.10.14

File hashes

Hashes for mkl_fft-2.1.2-0-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 8c2eacc0f77f4a462e1a3063743931a142433ce764a93ad239617ada100b8e27
MD5 61c9697b49501edea0bb4418f956f8e4
BLAKE2b-256 57067369a774b9801aaae00cd4f319b0ae53fb78a3061153117066eb7d03c284

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for mkl_fft-2.1.2-0-cp311-cp311-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 43d500372321161cddb09f4eed828fd9cdf509cd148ab0694139a76f3ceb19b0
MD5 a82c0aad19cb5350b3636c59189423bf
BLAKE2b-256 56a2538d578c9a799cc140f0d7e91d9b0d7e7f19e88ccfd8fd69da215d6bfb58

See more details on using hashes here.

File details

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

File metadata

  • Download URL: mkl_fft-2.1.2-0-cp310-cp310-win_amd64.whl
  • Upload date:
  • Size: 141.7 kB
  • Tags: CPython 3.10, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.10.14

File hashes

Hashes for mkl_fft-2.1.2-0-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 a8bb7d400819750c42c7b1b3433991fb96d0f7e697183a2543fc37e4b1b46d89
MD5 cc2fe4e7db4c1dba0064f7be0bf9e010
BLAKE2b-256 71d9f626947e69dd2da82585b32a5d3072a089f499b8bde3cdc59945803cdbac

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for mkl_fft-2.1.2-0-cp310-cp310-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 4aa6b87196bbaee8c9b7f7182fb853b60ab24f733ed8cc866bc5930ab07b9a01
MD5 4d6c103bec3125615d4241d01cf43154
BLAKE2b-256 c85698805462037d0424284dd7ade3eb6bd142c7347cfc4b44e0e2e8ee71d00d

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