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

Uploaded CPython 3.14Windows x86-64

mkl_fft-2.2.0-0-cp314-cp314-manylinux_2_28_x86_64.whl (156.3 kB view details)

Uploaded CPython 3.14manylinux: glibc 2.28+ x86-64

mkl_fft-2.2.0-0-cp313-cp313-win_amd64.whl (144.4 kB view details)

Uploaded CPython 3.13Windows x86-64

mkl_fft-2.2.0-0-cp313-cp313-manylinux_2_28_x86_64.whl (155.7 kB view details)

Uploaded CPython 3.13manylinux: glibc 2.28+ x86-64

mkl_fft-2.2.0-0-cp312-cp312-win_amd64.whl (144.5 kB view details)

Uploaded CPython 3.12Windows x86-64

mkl_fft-2.2.0-0-cp312-cp312-manylinux_2_28_x86_64.whl (158.5 kB view details)

Uploaded CPython 3.12manylinux: glibc 2.28+ x86-64

mkl_fft-2.2.0-0-cp311-cp311-win_amd64.whl (146.1 kB view details)

Uploaded CPython 3.11Windows x86-64

mkl_fft-2.2.0-0-cp311-cp311-manylinux_2_28_x86_64.whl (157.2 kB view details)

Uploaded CPython 3.11manylinux: glibc 2.28+ x86-64

mkl_fft-2.2.0-0-cp310-cp310-win_amd64.whl (146.3 kB view details)

Uploaded CPython 3.10Windows x86-64

mkl_fft-2.2.0-0-cp310-cp310-manylinux_2_28_x86_64.whl (157.5 kB view details)

Uploaded CPython 3.10manylinux: glibc 2.28+ x86-64

File details

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

File metadata

  • Download URL: mkl_fft-2.2.0-0-cp314-cp314-win_amd64.whl
  • Upload date:
  • Size: 144.5 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.2.0-0-cp314-cp314-win_amd64.whl
Algorithm Hash digest
SHA256 5b2692f8c5f9256c0e9c9d2911269f67375966c453d63a77aae10dc0c76ae517
MD5 27077a812d5854e5e2688c09b5dc9823
BLAKE2b-256 6a0131c9f400cb78ca3cd34197d4dd589dd7db5eff763645327df2e6587841ed

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for mkl_fft-2.2.0-0-cp314-cp314-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 a8dca759b4850c8c0ebc0e062334e816fbe643bdb3df283c7a39e929f8b09e10
MD5 9c24bfb462bc1978920c4b589af87292
BLAKE2b-256 40e78f7a49a8d0e0e422d4be52dabe843dd15deb583686d79fee1a8a5f47b79e

See more details on using hashes here.

File details

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

File metadata

  • Download URL: mkl_fft-2.2.0-0-cp313-cp313-win_amd64.whl
  • Upload date:
  • Size: 144.4 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.2.0-0-cp313-cp313-win_amd64.whl
Algorithm Hash digest
SHA256 dc9d1b78a1f3fb6d45bc6e2be33982be5a5d29c849dc7d99ce6aaf299aac26c5
MD5 6e386ccb7e26b2a067d6e55c4021c016
BLAKE2b-256 405930bb5ade5eb7e5bda0078b863cf25a6e3b1bc50a60601474b1ced9007a92

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for mkl_fft-2.2.0-0-cp313-cp313-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 30c232d9488ad94d7d816fb7f84ce42e17276231a7f50e7a8e9981acdf055e9e
MD5 65c4c132a57a044f1674293f46d001fd
BLAKE2b-256 824322a125d4800866bf01cec2d40c4ec852e5b3b425131b3531124b97604271

See more details on using hashes here.

File details

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

File metadata

  • Download URL: mkl_fft-2.2.0-0-cp312-cp312-win_amd64.whl
  • Upload date:
  • Size: 144.5 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.2.0-0-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 831cba09ad2d2dc734056907f792ccadf0c6dae989815baf69028817f3c76272
MD5 5dd85e45737e6dedcf1486555769410f
BLAKE2b-256 11a8768a9627df2e5660083f6274120b9c52c59c428b6f334338527a3ea2257e

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for mkl_fft-2.2.0-0-cp312-cp312-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 65f67530559e3b186eb7b81cb72729f83c4d069515c9ecf8aee2d4825e1dc6ca
MD5 9b00393906be7808cce48873f9484238
BLAKE2b-256 128fcb9b179050493944d8eda583efba1a2802d5cf2881ffe12a64185e0f2cbf

See more details on using hashes here.

File details

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

File metadata

  • Download URL: mkl_fft-2.2.0-0-cp311-cp311-win_amd64.whl
  • Upload date:
  • Size: 146.1 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.2.0-0-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 4c59e870af5cf91ec4ca9e26c2eef0ad17e3e486f7c177dc858a123d82347b50
MD5 7bf37b0b782701289953de9583b75cf9
BLAKE2b-256 ee64fb1bdf0886dff1e83dff7be1ba0cb77d99531d01e970da30615e08add893

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for mkl_fft-2.2.0-0-cp311-cp311-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 76a40661a0c80e2867af6e056927d69bd3fb00d88b0a76f2345a22ffec3be400
MD5 1cf98e846321a8654ff4e1f0c55a4d4e
BLAKE2b-256 e592848756b22a6ba7db204c7f61356f03acd2e6757df8fcb8dfaac7fd435960

See more details on using hashes here.

File details

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

File metadata

  • Download URL: mkl_fft-2.2.0-0-cp310-cp310-win_amd64.whl
  • Upload date:
  • Size: 146.3 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.2.0-0-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 d7dfaccad66b2ddda01a038f32c165d56f9b48ad7d2b12880944c30db04da40c
MD5 a6a7aff27b3966fa2bb91d5722d0e8cf
BLAKE2b-256 00dba29c3ee23f04cd277d3df6d36e9af6dce6d2f19a1f88ce3ae1fbf417b826

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for mkl_fft-2.2.0-0-cp310-cp310-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 f2c1420c00dcb61c87fde46c092c87d9201b6ef69b51f628b57c87b03cb9bd33
MD5 84ce35dea67a192268b9b61b8f6f3a28
BLAKE2b-256 d84984b980feeccb257d34da00cbe08ee46c6f2103228836a0255361dc7a5377

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