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

Uploaded CPython 3.14Windows x86-64

mkl_fft-2.2.1-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.1-0-cp313-cp313-win_amd64.whl (144.4 kB view details)

Uploaded CPython 3.13Windows x86-64

mkl_fft-2.2.1-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.1-0-cp312-cp312-win_amd64.whl (144.5 kB view details)

Uploaded CPython 3.12Windows x86-64

mkl_fft-2.2.1-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.1-0-cp311-cp311-win_amd64.whl (146.1 kB view details)

Uploaded CPython 3.11Windows x86-64

mkl_fft-2.2.1-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.1-0-cp310-cp310-win_amd64.whl (146.3 kB view details)

Uploaded CPython 3.10Windows x86-64

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

File metadata

  • Download URL: mkl_fft-2.2.1-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.1-0-cp314-cp314-win_amd64.whl
Algorithm Hash digest
SHA256 d1bc5ce87642f17bc140fd6f2b0bc12c7221e9a5800c7a6eb422e1490bbb93b9
MD5 acf5cb0a3e1fb9a272f772b8ac818fc0
BLAKE2b-256 b40b8825a02aed22136a244003f63551027d5cc9f0f3429502177d65bb2c1fc3

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for mkl_fft-2.2.1-0-cp314-cp314-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 0aff38efe3f0480f80bf748529bdb65bda2ee433145c89b85363d239e80b5e03
MD5 0b3e7d977701c501565d6cdaa5ffa5c5
BLAKE2b-256 ac94b145a9b8b4df0deed1b04e90a91bcd171b1d4d5e9a43729bcf4bbe514199

See more details on using hashes here.

File details

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

File metadata

  • Download URL: mkl_fft-2.2.1-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.1-0-cp313-cp313-win_amd64.whl
Algorithm Hash digest
SHA256 3252cbcd5071b1708ed256cc7ca72be386f08bb6dd8627bdf287e994a282676b
MD5 f719f20ca10de8373e9d41ce53438d34
BLAKE2b-256 64abb8639cee10ba137368ed7a12c0b1e7262df533105cbd89056d8ca4c9263e

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for mkl_fft-2.2.1-0-cp313-cp313-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 a643d08316a066661fce5e41d934d5bc7d08a62c72be8a3f0274a804510ac296
MD5 48161b066440af21d90ba84c54392f73
BLAKE2b-256 b167b1de1dcab7b86d1c66a49859856df3076b7a1997de4665041e7fd5b5ff37

See more details on using hashes here.

File details

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

File metadata

  • Download URL: mkl_fft-2.2.1-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.1-0-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 32c23ae73e8e4797e6b4d750cf0900f49d5efcd735ce7a67a16a91018c00fc1d
MD5 e26bc2def6234097acaa1c68a39085de
BLAKE2b-256 bfc00ab5baf9bef0172d9e5864085d70aa4abeb589b0ef3724656529a1f08182

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for mkl_fft-2.2.1-0-cp312-cp312-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 a0f090c1b6b0ab0ed296ac70db33b5a6cc6747918f1529c6ddcab2fc4db03d0c
MD5 e46cccf6d1d7be561213d2706909ff7a
BLAKE2b-256 5c27b24cfbdd4d312f01be779be3f49aa31c14e7bdb33e11e2dc6ef66d439e14

See more details on using hashes here.

File details

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

File metadata

  • Download URL: mkl_fft-2.2.1-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.1-0-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 f50d022c2b87c7e1696bae7500df2cdb76b5b89de48a6fb077fdf0997b7e7fef
MD5 2c2df5463e098b1f229372cc82eb0ab3
BLAKE2b-256 f91623973f2f6595407115c5004d58f1952b3418022731c1dedd1bec83a545a2

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for mkl_fft-2.2.1-0-cp311-cp311-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 21e122b58edc10b90791eead4f70ca395d80f2f0d56f98176ed69fc55d54e9e4
MD5 ccb4d327a7783ad3fb2b5a12ad332888
BLAKE2b-256 3be25579fec42516f2aa8cd19e659218e61598a8fbcbafc5a1bd6fc2301b0254

See more details on using hashes here.

File details

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

File metadata

  • Download URL: mkl_fft-2.2.1-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.1-0-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 75f42ad600d740a22ecb9922d096f6e340ec351f11afca1f44c52b450cf875b8
MD5 7501dd6c4960116e826bcf97cc759d8f
BLAKE2b-256 7f7d41eb985e65406dd7a97bf4e700ba38600a432206aa0e44e5437844b828bc

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for mkl_fft-2.2.1-0-cp310-cp310-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 b81df4cc1fc0a73e1edf427e7d27a8b3d2f120fff575221112679c5d524c2760
MD5 10ec02891172c6f156ff25fcc64b0861
BLAKE2b-256 52fbe620bddf62a11bd2482fa229dc7874e8f723bdc9f2b4504ac3953099a67b

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