Skip to content

Commit a03458e

Browse files
Merge pull request #76 from IntelPython/add-interfaces
Add interfaces
2 parents efae8da + 2cae8e2 commit a03458e

File tree

13 files changed

+438
-186
lines changed

13 files changed

+438
-186
lines changed

.github/workflows/conda-package.yml

Lines changed: 17 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -8,20 +8,20 @@ env:
88

99
jobs:
1010
build:
11-
runs-on: ubuntu-latest
11+
runs-on: ubuntu-20.04
1212
strategy:
1313
matrix:
1414
python: [3.9]
1515
steps:
16-
- uses: actions/checkout@v2
16+
- uses: actions/checkout@v3
1717
with:
1818
fetch-depth: 0
1919

2020
- name: Set pkgs_dirs
2121
run: |
2222
echo "pkgs_dirs: [~/.conda/pkgs]" >> ~/.condarc
2323
- name: Cache conda packages
24-
uses: actions/cache@v2
24+
uses: actions/cache@v3
2525
env:
2626
CACHE_NUMBER: 0 # Increase to reset cache
2727
with:
@@ -38,7 +38,7 @@ jobs:
3838
run: conda install conda-build
3939
- name: Build conda package
4040
run: |
41-
CHANNELS="-c intel -c defaults --override-channels"
41+
CHANNELS="-c intel -c main --override-channels"
4242
VERSIONS="--python ${{ matrix.python }}"
4343
TEST="--no-test"
4444
@@ -48,7 +48,7 @@ jobs:
4848
$CHANNELS \
4949
conda-recipe
5050
- name: Upload artifact
51-
uses: actions/upload-artifact@v2
51+
uses: actions/upload-artifact@v3
5252
with:
5353
name: ${{ env.PACKAGE_NAME }} ${{ runner.os }} Python ${{ matrix.python }}
5454
path: /usr/share/miniconda/conda-bld/linux-64/${{ env.PACKAGE_NAME }}-*.tar.bz2
@@ -61,14 +61,14 @@ jobs:
6161
matrix:
6262
python: [3.9]
6363
experimental: [false]
64-
runner: [ubuntu-latest]
64+
runner: [ubuntu-20.04]
6565
continue-on-error: ${{ matrix.experimental }}
6666
env:
67-
CHANNELS: -c intel -c defaults --override-channels
67+
CHANNELS: -c intel -c main --override-channels
6868

6969
steps:
7070
- name: Download artifact
71-
uses: actions/download-artifact@v2
71+
uses: actions/download-artifact@v3
7272
with:
7373
name: ${{ env.PACKAGE_NAME }} ${{ runner.os }} Python ${{ matrix.python }}
7474
- name: Add conda to system path
@@ -86,12 +86,14 @@ jobs:
8686
- name: Collect dependencies
8787
run: |
8888
CHANNELS="-c $GITHUB_WORKSPACE/channel ${{ env.CHANNELS }}"
89-
conda install $PACKAGE_NAME python=${{ matrix.python }} $CHANNELS --only-deps --dry-run > lockfile
89+
conda create -n test_mkl_fft $PACKAGE_NAME python=${{ matrix.python }} $CHANNELS --only-deps --dry-run > lockfile
90+
- name: Display lockfile
91+
run: cat lockfile
9092
- name: Set pkgs_dirs
9193
run: |
9294
echo "pkgs_dirs: [~/.conda/pkgs]" >> ~/.condarc
9395
- name: Cache conda packages
94-
uses: actions/cache@v2
96+
uses: actions/cache@v3
9597
env:
9698
CACHE_NUMBER: 0 # Increase to reset cache
9799
with:
@@ -105,9 +107,11 @@ jobs:
105107
- name: Install mkl_fft
106108
run: |
107109
CHANNELS="-c $GITHUB_WORKSPACE/channel ${{ env.CHANNELS }}"
108-
conda install $PACKAGE_NAME pytest python=${{ matrix.python }} $CHANNELS
110+
conda create -n test_mkl_fft python=${{ matrix.python }} $PACKAGE_NAME pytest $CHANNELS
109111
# Test installed packages
110-
conda list
112+
conda list -n test_mkl_fft
111113
- name: Run tests
112114
run: |
113-
python -m pytest --pyargs $MODULE_NAME
115+
source $CONDA/etc/profile.d/conda.sh
116+
conda activate test_mkl_fft
117+
pytest -v --pyargs $MODULE_NAME

conda-recipe/meta.yaml

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
{% set version = "1.3.0" %}
2-
{% set buildnumber = 1 %}
1+
{% set version = "1.3.1" %}
2+
{% set buildnumber = 0 %}
33

44
package:
55
name: mkl_fft
@@ -21,7 +21,6 @@ requirements:
2121
- setuptools
2222
- mkl-devel
2323
- cython
24-
- blas=*=mkl
2524
- numpy-base
2625
run:
2726
- python
@@ -31,13 +30,14 @@ requirements:
3130

3231
test:
3332
commands:
34-
- nosetests -v mkl_fft
33+
- pytest -v --args mkl_fft
3534
requires:
36-
- nose
35+
- pytest
3736
imports:
3837
- mkl_fft
39-
- mkl_fft._numpy_fft
40-
- mkl_fft._scipy_fft
38+
- mkl_fft.interface
39+
- mkl_fft.interface.numpy_fft
40+
- mkl_fft.interface.scipy_fft
4141

4242
about:
4343
home: http://github.com/IntelPython/mkl_fft

mkl_fft/__init__.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@
2828
rfft_numpy, irfft_numpy, rfftn_numpy, irfftn_numpy)
2929

3030
from ._version import __version__
31+
import mkl_fft.interfaces
3132

3233
__all__ = ['fft', 'ifft', 'fft2', 'ifft2', 'fftn', 'ifftn', 'rfft', 'irfft',
33-
'rfft_numpy', 'irfft_numpy', 'rfftn_numpy', 'irfftn_numpy']
34+
'rfft_numpy', 'irfft_numpy', 'rfftn_numpy', 'irfftn_numpy', 'interfaces']

mkl_fft/_float_utils.py

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#!/usr/bin/env python
2-
# Copyright (c) 2017-2019, Intel Corporation
2+
# Copyright (c) 2017-2023, Intel Corporation
33
#
44
# Redistribution and use in source and binary forms, with or without
55
# modification, are permitted provided that the following conditions are met:
@@ -25,9 +25,9 @@
2525
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
2626

2727
from numpy import (half, float32, asarray, ndarray,
28-
longdouble, float64, longcomplex, complex_)
28+
longdouble, float64, longcomplex, complex_, float128, complex256)
2929

30-
__all__ = ['__upcast_float16_array', '__downcast_float128_array']
30+
__all__ = ['__upcast_float16_array', '__downcast_float128_array', '__supported_array_or_not_implemented']
3131

3232
def __upcast_float16_array(x):
3333
"""
@@ -71,3 +71,14 @@ def __downcast_float128_array(x):
7171
return asarray(x, dtype=complex_)
7272
return __x
7373
return x
74+
75+
76+
def __supported_array_or_not_implemented(x):
77+
"""
78+
Used in _scipy_fft_backend to convert array to float32,
79+
float64, complex64, or complex128 type or return NotImplemented
80+
"""
81+
__x = asarray(x)
82+
if __x.dtype in [half, float128, complex256]:
83+
return NotImplemented
84+
return __x

mkl_fft/_numpy_fft.py

Lines changed: 1 addition & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#!/usr/bin/env python
2-
# Copyright (c) 2017-2019, Intel Corporation
2+
# Copyright (c) 2017-2023, Intel Corporation
33
#
44
# Redistribution and use in source and binary forms, with or without
55
# modification, are permitted provided that the following conditions are met:
@@ -88,11 +88,6 @@ def ortho_sc_1d(n, s):
8888
return sqrt(frwd_sc_1d(n, s))
8989

9090

91-
def _unitary(norm):
92-
check_norm(norm)
93-
return norm is not None
94-
95-
9691
def trycall(func, args, kwrds):
9792
try:
9893
res = func(*args, **kwrds)
@@ -735,13 +730,6 @@ def _cook_nd_args(a, s=None, axes=None, invreal=0):
735730
return s, axes
736731

737732

738-
def _tot_size(x, axes):
739-
s = x.shape
740-
if axes is None:
741-
return x.size
742-
return prod([s[ai] for ai in axes])
743-
744-
745733
def fftn(a, s=None, axes=None, norm=None):
746734
"""
747735
Compute the N-dimensional discrete Fourier Transform.
@@ -1265,7 +1253,6 @@ def rfftn(a, s=None, axes=None, norm=None):
12651253
12661254
"""
12671255
check_norm(norm)
1268-
unitary = _unitary(norm)
12691256
x = _float_utils.__downcast_float128_array(a)
12701257
if (norm in (None, "backward")):
12711258
output = trycall(

mkl_fft/_pydfti.pyx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#!/usr/bin/env python
2-
# Copyright (c) 2017-2019, Intel Corporation
2+
# Copyright (c) 2017-2023, Intel Corporation
33
#
44
# Redistribution and use in source and binary forms, with or without
55
# modification, are permitted provided that the following conditions are met:

mkl_fft/_scipy_fft.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#!/usr/bin/env python
2-
# Copyright (c) 2017-2019, Intel Corporation
2+
# Copyright (c) 2017-2023, Intel Corporation
33
#
44
# Redistribution and use in source and binary forms, with or without
55
# modification, are permitted provided that the following conditions are met:

0 commit comments

Comments
 (0)