Skip to content

Commit 9b71a8e

Browse files
implement dpnp.fft.fft and dpnp.fft.ifft using pybind11 extension (#1879)
* implement fft and ifft using pybind11 extension * fixing minor issues * address comments * link to dpnp doc for FFT background info * add TODO * update backend structure * update CMakefile * update tests * add out keyword and fix an issue with negative stride * fix sphinx spelling issues * update for mkl-2024.2 * implement in-place fft * update to reuse dpctl function * fix an issue for out keyword given as usm_ndarray * fix a test * add TODO * extend descriptor template mkl_dft::domain is added to descriptor template for future impelemntation of REAL domain * add incorrectly removed header * address comments * fix empty array test * implement async memory * address comments * use dpnp_array * update a test * fix pre-commit * consistency with stock NumPy for coverage report --------- Co-authored-by: Anton <[email protected]> 100094a
1 parent fe32b29 commit 9b71a8e

File tree

592 files changed

+5267
-2232
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

592 files changed

+5267
-2232
lines changed

.buildinfo

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
# Sphinx build info version 1
22
# This file hashes the configuration used when building these files. When it is not found, a full rebuild will be done.
3-
config: 3eb3dfa8681a4d0bee1af7b9613d5389
3+
config: fefc697c994726cc0bbc265390727c27
44
tags: 645f666f9bcd5a90fca523b33c5a78b7

_modules/dpnp/dpnp_array.html

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
</script>
1313

1414
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
15-
<title>dpnp.dpnp_array &mdash; Data Parallel Extension for NumPy 0.16.0dev0+55.g0dbc7e9185 documentation</title>
15+
<title>dpnp.dpnp_array &mdash; Data Parallel Extension for NumPy 0.16.0dev0+56.g100094a99c documentation</title>
1616
<link rel="stylesheet" type="text/css" href="../../_static/pygments.css?v=fa44fd50" />
1717
<link rel="stylesheet" type="text/css" href="../../_static/css/theme.css?v=19f00094" />
1818

@@ -23,7 +23,7 @@
2323

2424
<script src="../../_static/jquery.js?v=5d32c60e"></script>
2525
<script src="../../_static/_sphinx_javascript_frameworks_compat.js?v=2cd50e6c"></script>
26-
<script src="../../_static/documentation_options.js?v=1d589441"></script>
26+
<script src="../../_static/documentation_options.js?v=a24f9f76"></script>
2727
<script src="../../_static/doctools.js?v=9a2dae69"></script>
2828
<script src="../../_static/sphinx_highlight.js?v=dc90522c"></script>
2929
<script src="../../_static/js/theme.js"></script>
@@ -43,7 +43,7 @@
4343
Data Parallel Extension for NumPy
4444
</a>
4545
<div class="version">
46-
0.16.0dev0+55.g0dbc7e9185
46+
0.16.0dev0+56.g100094a99c
4747
</div>
4848
<div role="search">
4949
<form id="rtd-search-form" class="wy-form" action="../../search.html" method="get">

_modules/dpnp/dpnp_flatiter.html

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
</script>
1313

1414
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
15-
<title>dpnp.dpnp_flatiter &mdash; Data Parallel Extension for NumPy 0.16.0dev0+55.g0dbc7e9185 documentation</title>
15+
<title>dpnp.dpnp_flatiter &mdash; Data Parallel Extension for NumPy 0.16.0dev0+56.g100094a99c documentation</title>
1616
<link rel="stylesheet" type="text/css" href="../../_static/pygments.css?v=fa44fd50" />
1717
<link rel="stylesheet" type="text/css" href="../../_static/css/theme.css?v=19f00094" />
1818

@@ -23,7 +23,7 @@
2323

2424
<script src="../../_static/jquery.js?v=5d32c60e"></script>
2525
<script src="../../_static/_sphinx_javascript_frameworks_compat.js?v=2cd50e6c"></script>
26-
<script src="../../_static/documentation_options.js?v=1d589441"></script>
26+
<script src="../../_static/documentation_options.js?v=a24f9f76"></script>
2727
<script src="../../_static/doctools.js?v=9a2dae69"></script>
2828
<script src="../../_static/sphinx_highlight.js?v=dc90522c"></script>
2929
<script src="../../_static/js/theme.js"></script>
@@ -43,7 +43,7 @@
4343
Data Parallel Extension for NumPy
4444
</a>
4545
<div class="version">
46-
0.16.0dev0+55.g0dbc7e9185
46+
0.16.0dev0+56.g100094a99c
4747
</div>
4848
<div role="search">
4949
<form id="rtd-search-form" class="wy-form" action="../../search.html" method="get">

_modules/dpnp/dpnp_iface.html

Lines changed: 51 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
</script>
1313

1414
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
15-
<title>dpnp.dpnp_iface &mdash; Data Parallel Extension for NumPy 0.16.0dev0+55.g0dbc7e9185 documentation</title>
15+
<title>dpnp.dpnp_iface &mdash; Data Parallel Extension for NumPy 0.16.0dev0+56.g100094a99c documentation</title>
1616
<link rel="stylesheet" type="text/css" href="../../_static/pygments.css?v=fa44fd50" />
1717
<link rel="stylesheet" type="text/css" href="../../_static/css/theme.css?v=19f00094" />
1818

@@ -23,7 +23,7 @@
2323

2424
<script src="../../_static/jquery.js?v=5d32c60e"></script>
2525
<script src="../../_static/_sphinx_javascript_frameworks_compat.js?v=2cd50e6c"></script>
26-
<script src="../../_static/documentation_options.js?v=1d589441"></script>
26+
<script src="../../_static/documentation_options.js?v=a24f9f76"></script>
2727
<script src="../../_static/doctools.js?v=9a2dae69"></script>
2828
<script src="../../_static/sphinx_highlight.js?v=dc90522c"></script>
2929
<script src="../../_static/js/theme.js"></script>
@@ -43,7 +43,7 @@
4343
Data Parallel Extension for NumPy
4444
</a>
4545
<div class="version">
46-
0.16.0dev0+55.g0dbc7e9185
46+
0.16.0dev0+56.g100094a99c
4747
</div>
4848
<div role="search">
4949
<form id="rtd-search-form" class="wy-form" action="../../search.html" method="get">
@@ -126,12 +126,13 @@ <h1>Source code for dpnp.dpnp_iface</h1><div class="highlight"><pre>
126126
<span class="sd"> - The functions parameters check</span>
127127

128128
<span class="sd">&quot;&quot;&quot;</span>
129-
129+
<span class="c1"># pylint: disable=protected-access</span>
130130

131131
<span class="kn">import</span> <span class="nn">os</span>
132132

133133
<span class="kn">import</span> <span class="nn">dpctl</span>
134134
<span class="kn">import</span> <span class="nn">dpctl.tensor</span> <span class="k">as</span> <span class="nn">dpt</span>
135+
<span class="kn">import</span> <span class="nn">dpctl.tensor._tensor_impl</span> <span class="k">as</span> <span class="nn">ti</span>
135136
<span class="kn">import</span> <span class="nn">dpctl.utils</span> <span class="k">as</span> <span class="nn">dpu</span>
136137
<span class="kn">import</span> <span class="nn">numpy</span>
137138
<span class="kn">from</span> <span class="nn">dpctl.tensor._device</span> <span class="kn">import</span> <span class="n">normalize_queue_device</span>
@@ -144,6 +145,7 @@ <h1>Source code for dpnp.dpnp_iface</h1><div class="highlight"><pre>
144145
<span class="kn">from</span> <span class="nn">dpnp.random</span> <span class="kn">import</span> <span class="o">*</span>
145146

146147
<span class="n">__all__</span> <span class="o">=</span> <span class="p">[</span>
148+
<span class="s2">&quot;are_same_logical_tensors&quot;</span><span class="p">,</span>
147149
<span class="s2">&quot;array_equal&quot;</span><span class="p">,</span>
148150
<span class="s2">&quot;asnumpy&quot;</span><span class="p">,</span>
149151
<span class="s2">&quot;astype&quot;</span><span class="p">,</span>
@@ -220,6 +222,47 @@ <h1>Source code for dpnp.dpnp_iface</h1><div class="highlight"><pre>
220222
<span class="n">__all__</span> <span class="o">+=</span> <span class="n">__all__trigonometric</span>
221223

222224

225+
<span class="k">def</span> <span class="nf">are_same_logical_tensors</span><span class="p">(</span><span class="n">ar1</span><span class="p">,</span> <span class="n">ar2</span><span class="p">):</span>
226+
<span class="w"> </span><span class="sd">&quot;&quot;&quot;</span>
227+
<span class="sd"> Check if two arrays are logical views into the same memory.</span>
228+
229+
<span class="sd"> Parameters</span>
230+
<span class="sd"> ----------</span>
231+
<span class="sd"> ar1 : {dpnp_array, usm_ndarray}</span>
232+
<span class="sd"> First input array.</span>
233+
<span class="sd"> ar2 : {dpnp_array, usm_ndarray}</span>
234+
<span class="sd"> Second input array.</span>
235+
236+
<span class="sd"> Returns</span>
237+
<span class="sd"> -------</span>
238+
<span class="sd"> out : bool</span>
239+
<span class="sd"> ``True`` if two arrays are logical views into the same memory,</span>
240+
<span class="sd"> ``False`` otherwise.</span>
241+
242+
<span class="sd"> Examples</span>
243+
<span class="sd"> --------</span>
244+
<span class="sd"> &gt;&gt;&gt; import dpnp as np</span>
245+
<span class="sd"> &gt;&gt;&gt; a = np.array([1, 2, 3])</span>
246+
<span class="sd"> &gt;&gt;&gt; b = a[:]</span>
247+
<span class="sd"> &gt;&gt;&gt; a is b</span>
248+
<span class="sd"> False</span>
249+
<span class="sd"> &gt;&gt;&gt; np.are_same_logical_tensors(a, b)</span>
250+
<span class="sd"> True</span>
251+
<span class="sd"> &gt;&gt;&gt; b[0] = 0</span>
252+
<span class="sd"> &gt;&gt;&gt; a</span>
253+
<span class="sd"> array([0, 2, 3])</span>
254+
255+
<span class="sd"> &gt;&gt;&gt; c = a.copy()</span>
256+
<span class="sd"> &gt;&gt;&gt; np.are_same_logical_tensors(a, c)</span>
257+
<span class="sd"> False</span>
258+
259+
<span class="sd"> &quot;&quot;&quot;</span>
260+
261+
<span class="k">return</span> <span class="n">ti</span><span class="o">.</span><span class="n">_same_logical_tensors</span><span class="p">(</span>
262+
<span class="n">dpnp</span><span class="o">.</span><span class="n">get_usm_ndarray</span><span class="p">(</span><span class="n">ar1</span><span class="p">),</span> <span class="n">dpnp</span><span class="o">.</span><span class="n">get_usm_ndarray</span><span class="p">(</span><span class="n">ar2</span><span class="p">)</span>
263+
<span class="p">)</span>
264+
265+
223266
<div class="viewcode-block" id="array_equal">
224267
<a class="viewcode-back" href="../../reference/generated/dpnp.array_equal.html#dpnp.array_equal">[docs]</a>
225268
<span class="k">def</span> <span class="nf">array_equal</span><span class="p">(</span><span class="n">a1</span><span class="p">,</span> <span class="n">a2</span><span class="p">,</span> <span class="n">equal_nan</span><span class="o">=</span><span class="kc">False</span><span class="p">):</span>
@@ -736,18 +779,17 @@ <h1>Source code for dpnp.dpnp_iface</h1><div class="highlight"><pre>
736779
<span class="k">if</span> <span class="n">out</span> <span class="ow">is</span> <span class="kc">None</span><span class="p">:</span>
737780
<span class="k">return</span> <span class="n">a</span>
738781

739-
<span class="k">if</span> <span class="n">a</span> <span class="ow">is</span> <span class="n">out</span><span class="p">:</span>
782+
<span class="k">if</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">out</span><span class="p">,</span> <span class="n">dpt</span><span class="o">.</span><span class="n">usm_ndarray</span><span class="p">):</span>
783+
<span class="n">out</span> <span class="o">=</span> <span class="n">dpnp_array</span><span class="o">.</span><span class="n">_create_from_usm_ndarray</span><span class="p">(</span><span class="n">out</span><span class="p">)</span>
784+
785+
<span class="k">if</span> <span class="n">a</span> <span class="ow">is</span> <span class="n">out</span> <span class="ow">or</span> <span class="n">dpnp</span><span class="o">.</span><span class="n">are_same_logical_tensors</span><span class="p">(</span><span class="n">a</span><span class="p">,</span> <span class="n">out</span><span class="p">):</span>
740786
<span class="k">return</span> <span class="n">out</span>
741787

742-
<span class="n">dpnp</span><span class="o">.</span><span class="n">check_supported_arrays_type</span><span class="p">(</span><span class="n">out</span><span class="p">)</span>
743788
<span class="k">if</span> <span class="n">out</span><span class="o">.</span><span class="n">shape</span> <span class="o">!=</span> <span class="n">a</span><span class="o">.</span><span class="n">shape</span><span class="p">:</span>
744789
<span class="k">raise</span> <span class="ne">ValueError</span><span class="p">(</span>
745790
<span class="sa">f</span><span class="s2">&quot;Output array of shape </span><span class="si">{</span><span class="n">a</span><span class="o">.</span><span class="n">shape</span><span class="si">}</span><span class="s2"> is needed, got </span><span class="si">{</span><span class="n">out</span><span class="o">.</span><span class="n">shape</span><span class="si">}</span><span class="s2">.&quot;</span>
746791
<span class="p">)</span>
747792

748-
<span class="k">if</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">out</span><span class="p">,</span> <span class="n">dpt</span><span class="o">.</span><span class="n">usm_ndarray</span><span class="p">):</span>
749-
<span class="n">out</span> <span class="o">=</span> <span class="n">dpnp_array</span><span class="o">.</span><span class="n">_create_from_usm_ndarray</span><span class="p">(</span><span class="n">out</span><span class="p">)</span>
750-
751793
<span class="n">dpnp</span><span class="o">.</span><span class="n">copyto</span><span class="p">(</span><span class="n">out</span><span class="p">,</span> <span class="n">a</span><span class="p">,</span> <span class="n">casting</span><span class="o">=</span><span class="n">casting</span><span class="p">)</span>
752794
<span class="k">return</span> <span class="n">out</span>
753795

_modules/dpnp/dpnp_iface_arraycreation.html

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
</script>
1313

1414
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
15-
<title>dpnp.dpnp_iface_arraycreation &mdash; Data Parallel Extension for NumPy 0.16.0dev0+55.g0dbc7e9185 documentation</title>
15+
<title>dpnp.dpnp_iface_arraycreation &mdash; Data Parallel Extension for NumPy 0.16.0dev0+56.g100094a99c documentation</title>
1616
<link rel="stylesheet" type="text/css" href="../../_static/pygments.css?v=fa44fd50" />
1717
<link rel="stylesheet" type="text/css" href="../../_static/css/theme.css?v=19f00094" />
1818

@@ -23,7 +23,7 @@
2323

2424
<script src="../../_static/jquery.js?v=5d32c60e"></script>
2525
<script src="../../_static/_sphinx_javascript_frameworks_compat.js?v=2cd50e6c"></script>
26-
<script src="../../_static/documentation_options.js?v=1d589441"></script>
26+
<script src="../../_static/documentation_options.js?v=a24f9f76"></script>
2727
<script src="../../_static/doctools.js?v=9a2dae69"></script>
2828
<script src="../../_static/sphinx_highlight.js?v=dc90522c"></script>
2929
<script src="../../_static/js/theme.js"></script>
@@ -43,7 +43,7 @@
4343
Data Parallel Extension for NumPy
4444
</a>
4545
<div class="version">
46-
0.16.0dev0+55.g0dbc7e9185
46+
0.16.0dev0+56.g100094a99c
4747
</div>
4848
<div role="search">
4949
<form id="rtd-search-form" class="wy-form" action="../../search.html" method="get">

_modules/dpnp/dpnp_iface_counting.html

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
</script>
1313

1414
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
15-
<title>dpnp.dpnp_iface_counting &mdash; Data Parallel Extension for NumPy 0.16.0dev0+55.g0dbc7e9185 documentation</title>
15+
<title>dpnp.dpnp_iface_counting &mdash; Data Parallel Extension for NumPy 0.16.0dev0+56.g100094a99c documentation</title>
1616
<link rel="stylesheet" type="text/css" href="../../_static/pygments.css?v=fa44fd50" />
1717
<link rel="stylesheet" type="text/css" href="../../_static/css/theme.css?v=19f00094" />
1818

@@ -23,7 +23,7 @@
2323

2424
<script src="../../_static/jquery.js?v=5d32c60e"></script>
2525
<script src="../../_static/_sphinx_javascript_frameworks_compat.js?v=2cd50e6c"></script>
26-
<script src="../../_static/documentation_options.js?v=1d589441"></script>
26+
<script src="../../_static/documentation_options.js?v=a24f9f76"></script>
2727
<script src="../../_static/doctools.js?v=9a2dae69"></script>
2828
<script src="../../_static/sphinx_highlight.js?v=dc90522c"></script>
2929
<script src="../../_static/js/theme.js"></script>
@@ -43,7 +43,7 @@
4343
Data Parallel Extension for NumPy
4444
</a>
4545
<div class="version">
46-
0.16.0dev0+55.g0dbc7e9185
46+
0.16.0dev0+56.g100094a99c
4747
</div>
4848
<div role="search">
4949
<form id="rtd-search-form" class="wy-form" action="../../search.html" method="get">

_modules/dpnp/dpnp_iface_histograms.html

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
</script>
1313

1414
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
15-
<title>dpnp.dpnp_iface_histograms &mdash; Data Parallel Extension for NumPy 0.16.0dev0+55.g0dbc7e9185 documentation</title>
15+
<title>dpnp.dpnp_iface_histograms &mdash; Data Parallel Extension for NumPy 0.16.0dev0+56.g100094a99c documentation</title>
1616
<link rel="stylesheet" type="text/css" href="../../_static/pygments.css?v=fa44fd50" />
1717
<link rel="stylesheet" type="text/css" href="../../_static/css/theme.css?v=19f00094" />
1818

@@ -23,7 +23,7 @@
2323

2424
<script src="../../_static/jquery.js?v=5d32c60e"></script>
2525
<script src="../../_static/_sphinx_javascript_frameworks_compat.js?v=2cd50e6c"></script>
26-
<script src="../../_static/documentation_options.js?v=1d589441"></script>
26+
<script src="../../_static/documentation_options.js?v=a24f9f76"></script>
2727
<script src="../../_static/doctools.js?v=9a2dae69"></script>
2828
<script src="../../_static/sphinx_highlight.js?v=dc90522c"></script>
2929
<script src="../../_static/js/theme.js"></script>
@@ -43,7 +43,7 @@
4343
Data Parallel Extension for NumPy
4444
</a>
4545
<div class="version">
46-
0.16.0dev0+55.g0dbc7e9185
46+
0.16.0dev0+56.g100094a99c
4747
</div>
4848
<div role="search">
4949
<form id="rtd-search-form" class="wy-form" action="../../search.html" method="get">

_modules/dpnp/dpnp_iface_indexing.html

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
</script>
1313

1414
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
15-
<title>dpnp.dpnp_iface_indexing &mdash; Data Parallel Extension for NumPy 0.16.0dev0+55.g0dbc7e9185 documentation</title>
15+
<title>dpnp.dpnp_iface_indexing &mdash; Data Parallel Extension for NumPy 0.16.0dev0+56.g100094a99c documentation</title>
1616
<link rel="stylesheet" type="text/css" href="../../_static/pygments.css?v=fa44fd50" />
1717
<link rel="stylesheet" type="text/css" href="../../_static/css/theme.css?v=19f00094" />
1818

@@ -23,7 +23,7 @@
2323

2424
<script src="../../_static/jquery.js?v=5d32c60e"></script>
2525
<script src="../../_static/_sphinx_javascript_frameworks_compat.js?v=2cd50e6c"></script>
26-
<script src="../../_static/documentation_options.js?v=1d589441"></script>
26+
<script src="../../_static/documentation_options.js?v=a24f9f76"></script>
2727
<script src="../../_static/doctools.js?v=9a2dae69"></script>
2828
<script src="../../_static/sphinx_highlight.js?v=dc90522c"></script>
2929
<script src="../../_static/js/theme.js"></script>
@@ -43,7 +43,7 @@
4343
Data Parallel Extension for NumPy
4444
</a>
4545
<div class="version">
46-
0.16.0dev0+55.g0dbc7e9185
46+
0.16.0dev0+56.g100094a99c
4747
</div>
4848
<div role="search">
4949
<form id="rtd-search-form" class="wy-form" action="../../search.html" method="get">

_modules/dpnp/dpnp_iface_libmath.html

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
</script>
1313

1414
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
15-
<title>dpnp.dpnp_iface_libmath &mdash; Data Parallel Extension for NumPy 0.16.0dev0+55.g0dbc7e9185 documentation</title>
15+
<title>dpnp.dpnp_iface_libmath &mdash; Data Parallel Extension for NumPy 0.16.0dev0+56.g100094a99c documentation</title>
1616
<link rel="stylesheet" type="text/css" href="../../_static/pygments.css?v=fa44fd50" />
1717
<link rel="stylesheet" type="text/css" href="../../_static/css/theme.css?v=19f00094" />
1818

@@ -23,7 +23,7 @@
2323

2424
<script src="../../_static/jquery.js?v=5d32c60e"></script>
2525
<script src="../../_static/_sphinx_javascript_frameworks_compat.js?v=2cd50e6c"></script>
26-
<script src="../../_static/documentation_options.js?v=1d589441"></script>
26+
<script src="../../_static/documentation_options.js?v=a24f9f76"></script>
2727
<script src="../../_static/doctools.js?v=9a2dae69"></script>
2828
<script src="../../_static/sphinx_highlight.js?v=dc90522c"></script>
2929
<script src="../../_static/js/theme.js"></script>
@@ -43,7 +43,7 @@
4343
Data Parallel Extension for NumPy
4444
</a>
4545
<div class="version">
46-
0.16.0dev0+55.g0dbc7e9185
46+
0.16.0dev0+56.g100094a99c
4747
</div>
4848
<div role="search">
4949
<form id="rtd-search-form" class="wy-form" action="../../search.html" method="get">

0 commit comments

Comments
 (0)