From 7b64b0a179fa87115ea1e8920c50620fea5de943 Mon Sep 17 00:00:00 2001 From: Vahid Tavanashad Date: Wed, 16 Jul 2025 15:59:52 -0700 Subject: [PATCH 1/2] use the correct license for init_helper.py file --- mkl_fft/_init_helper.py | 31 +++++++++++++++++++++---------- 1 file changed, 21 insertions(+), 10 deletions(-) diff --git a/mkl_fft/_init_helper.py b/mkl_fft/_init_helper.py index 3a4c1ddc..b5f21b85 100644 --- a/mkl_fft/_init_helper.py +++ b/mkl_fft/_init_helper.py @@ -1,16 +1,27 @@ -# Copyright 2025 Intel Corporation +# Copyright (c) 2025, Intel Corporation # -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions are met: # -# http://www.apache.org/licenses/LICENSE-2.0 +# * Redistributions of source code must retain the above copyright notice, +# this list of conditions and the following disclaimer. +# * Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in the +# documentation and/or other materials provided with the distribution. +# * Neither the name of Intel Corporation nor the names of its contributors +# may be used to endorse or promote products derived from this software +# without specific prior written permission. # -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +# DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE +# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR +# SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, +# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. import os import os.path From 8fbe03a4e1d07ed9a1e529fdd361250d44c56b58 Mon Sep 17 00:00:00 2001 From: Vahid Tavanashad Date: Wed, 16 Jul 2025 16:01:22 -0700 Subject: [PATCH 2/2] use oneMKL instead OneMKL --- README.md | 19 +++++++++---------- mkl_fft/interfaces/README.md | 3 +-- 2 files changed, 10 insertions(+), 12 deletions(-) diff --git a/README.md b/README.md index 8f865fd4..25c87f50 100644 --- a/README.md +++ b/README.md @@ -1,14 +1,15 @@ -## `mkl_fft` -- a NumPy-based Python interface to Intel® oneAPI Math Kernel Library (OneMKL) FFT functionality [![Conda package](https://github.com/IntelPython/mkl_fft/actions/workflows/conda-package.yml/badge.svg)](https://github.com/IntelPython/mkl_fft/actions/workflows/conda-package.yml) [![Editable build using pip and pre-release NumPy](https://github.com/IntelPython/mkl_fft/actions/workflows/build_pip.yaml/badge.svg)](https://github.com/IntelPython/mkl_fft/actions/workflows/build_pip.yaml) [![Conda package with conda-forge channel only](https://github.com/IntelPython/mkl_fft/actions/workflows/conda-package-cf.yml/badge.svg)](https://github.com/IntelPython/mkl_fft/actions/workflows/conda-package-cf.yml) [![OpenSSF Scorecard](https://api.securityscorecards.dev/projects/github.com/IntelPython/mkl_fft/badge)](https://securityscorecards.dev/viewer/?uri=github.com/IntelPython/mkl_fft) +## `mkl_fft` -- a NumPy-based Python interface to Intel® oneAPI Math Kernel Library (oneMKL) Fourier Transform Functions + # Introduction -`mkl_fft` started as a part of Intel® Distribution for Python* optimizations to NumPy, and is now being released -as a stand-alone package. It offers a thin layered interface for the Intel® oneAPI Math Kernel Library (OneMKL) FFT functionality that allows efficient access to native FFT optimizations from a range of NumPy and SciPy functions. 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](https://github.com/intelpython/fft_benchmark). +`mkl_fft` started as a part of [Intel® Distribution for Python*](https://www.intel.com/content/www/us/en/developer/tools/oneapi/distribution-for-python.html) optimizations to NumPy, and is now being released as a stand-alone package. +It offers a thin layered python interface to the [Intel® oneAPI Math Kernel Library (oneMKL) Fourier Transform Functions](https://www.intel.com/content/www/us/en/docs/onemkl/developer-reference-c/2025-2/fourier-transform-functions.html) 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](https://github.com/intelpython/fft_benchmark). -Thanks to Intel® OneMKL’s flexibility in its supports for arbitrarily strided input and output arrays both one-dimensional and multi-dimensional Fast Fourier Transforms 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. +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"](https://proceedings.scipy.org/articles/shinma-7f4c6e7-00f) from Proceedings of the 16th Python in Science Conference (SciPy 2017). @@ -26,9 +27,7 @@ or from conda-forge channel: conda install -c conda-forge mkl_fft ``` ---- - -To install `mkl_fft` PyPI package please use following command: +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 @@ -40,7 +39,7 @@ If command above installs NumPy package from the PyPI, please use following comm python -m pip install --index-url https://software.repos.intel.com/python/pypi --extra-index-url https://pypi.org/simple mkl_fft numpy== ``` -Where `` should be the latest version from https://software.repos.intel.com/python/conda/ +where `` should be the latest version from https://software.repos.intel.com/python/conda/. --- # How to use? @@ -85,10 +84,10 @@ numpy.allclose(mkl_res, np_res) --- # Building from source -To build `mkl_fft` from sources on Linux with Intel® OneMKL: +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 + - 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` diff --git a/mkl_fft/interfaces/README.md b/mkl_fft/interfaces/README.md index 0e8969ff..c47028a5 100644 --- a/mkl_fft/interfaces/README.md +++ b/mkl_fft/interfaces/README.md @@ -101,7 +101,7 @@ print(f"Time with scipy.fft default backend: {t1:.1f} seconds") with scipy.fft.set_backend(mkl_backend, only=True): t2 = timeit.timeit(lambda: scipy.signal.fftconvolve(a, b), number=10) -print(f"Time with OneMKL FFT backend installed: {t2:.1f} seconds") +print(f"Time with oneMKL FFT backend installed: {t2:.1f} seconds") # Time with MKL FFT backend installed: 9.1 seconds ``` @@ -110,7 +110,6 @@ In the following example, we use `set_worker` to control the number of threads w ```python import numpy, mkl, scipy import mkl_fft.interfaces.scipy_fft as mkl_fft -import scipy a = numpy.random.randn(128, 64) + 1j*numpy.random.randn(128, 64) scipy.fft.set_global_backend(mkl_fft) # set mkl_fft as global backend