Skip to content

Commit 24abe28

Browse files
Module renaming & small fixes
1 parent 6326683 commit 24abe28

File tree

10 files changed

+21
-28
lines changed

10 files changed

+21
-28
lines changed

dpnp/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ add_subdirectory(backend/extensions/fft)
5858
add_subdirectory(backend/extensions/lapack)
5959
add_subdirectory(backend/extensions/vm)
6060
add_subdirectory(backend/extensions/ufunc)
61-
add_subdirectory(backend/extensions/sycl_ext)
61+
add_subdirectory(backend/extensions/statistics)
6262

6363
add_subdirectory(dpnp_algo)
6464
add_subdirectory(dpnp_utils)

dpnp/backend/extensions/sycl_ext/CMakeLists.txt renamed to dpnp/backend/extensions/statistics/CMakeLists.txt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,11 +24,11 @@
2424
# *****************************************************************************
2525

2626

27-
set(python_module_name _sycl_ext_impl)
27+
set(python_module_name _statistics_impl)
2828
set(_module_src
2929
${CMAKE_CURRENT_SOURCE_DIR}/histogram.cpp
3030
${CMAKE_CURRENT_SOURCE_DIR}/histogram_common.cpp
31-
${CMAKE_CURRENT_SOURCE_DIR}/sycl_ext_py.cpp
31+
${CMAKE_CURRENT_SOURCE_DIR}/statistics_py.cpp
3232
)
3333

3434
pybind11_add_module(${python_module_name} MODULE ${_module_src})
@@ -83,5 +83,5 @@ if (DPNP_GENERATE_COVERAGE)
8383
endif()
8484

8585
install(TARGETS ${python_module_name}
86-
DESTINATION "dpnp/backend/extensions/sycl_ext"
86+
DESTINATION "dpnp/backend/extensions/statistics"
8787
)
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
from ._statistics_impl import histogram

dpnp/backend/extensions/sycl_ext/histogram.cpp renamed to dpnp/backend/extensions/statistics/histogram.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@
4444
namespace dpctl_td_ns = dpctl::tensor::type_dispatch;
4545
using dpctl::tensor::usm_ndarray;
4646

47-
using namespace histogram;
47+
using namespace statistics::histogram;
4848

4949
namespace
5050
{
@@ -175,7 +175,7 @@ struct ContigFactory
175175
}
176176
};
177177

178-
using sycl_ext::histogram::Histogram;
178+
using statistics::histogram::Histogram;
179179

180180
Histogram::FnT
181181
dispatch(Histogram *hist, int data_typenum, int, int hist_typenum)
@@ -248,7 +248,7 @@ std::tuple<sycl::event, sycl::event>
248248

249249
std::unique_ptr<Histogram> hist;
250250

251-
void sycl_ext::histogram::populate_histogram(py::module_ m)
251+
void statistics::histogram::populate_histogram(py::module_ m)
252252
{
253253
using namespace std::placeholders;
254254

dpnp/backend/extensions/sycl_ext/histogram.hpp renamed to dpnp/backend/extensions/statistics/histogram.hpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929

3030
namespace dpctl_td_ns = dpctl::tensor::type_dispatch;
3131

32-
namespace sycl_ext
32+
namespace statistics
3333
{
3434
namespace histogram
3535
{
@@ -58,4 +58,4 @@ struct Histogram
5858

5959
void populate_histogram(py::module_ m);
6060
} // namespace histogram
61-
} // namespace sycl_ext
61+
} // namespace statistics

dpnp/backend/extensions/sycl_ext/histogram_common.cpp renamed to dpnp/backend/extensions/statistics/histogram_common.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,8 @@ namespace dpctl_td_ns = dpctl::tensor::type_dispatch;
3939
using dpctl::tensor::usm_ndarray;
4040
using dpctl_td_ns::typenum_t;
4141

42+
namespace statistics
43+
{
4244
namespace histogram
4345
{
4446

@@ -194,3 +196,4 @@ void validate(const usm_ndarray &sample,
194196
}
195197

196198
} // namespace histogram
199+
} // namespace statistics

dpnp/backend/extensions/sycl_ext/histogram_common.hpp renamed to dpnp/backend/extensions/statistics/histogram_common.hpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,8 @@ class usm_ndarray;
3939

4040
using dpctl::tensor::usm_ndarray;
4141

42+
namespace statistics
43+
{
4244
namespace histogram
4345
{
4446

@@ -466,3 +468,4 @@ void validate(const usm_ndarray &sample,
466468
std::optional<const dpctl::tensor::usm_ndarray> &weights,
467469
const usm_ndarray &histogram);
468470
} // namespace histogram
471+
} // namespace statistics

dpnp/backend/extensions/sycl_ext/sycl_ext_py.cpp renamed to dpnp/backend/extensions/statistics/statistics_py.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@
3232

3333
#include "histogram.hpp"
3434

35-
PYBIND11_MODULE(_sycl_ext_impl, m)
35+
PYBIND11_MODULE(_statistics_impl, m)
3636
{
37-
sycl_ext::histogram::populate_histogram(m);
37+
statistics::histogram::populate_histogram(m);
3838
}

dpnp/dpnp_iface_histograms.py

Lines changed: 2 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -44,9 +44,7 @@
4444
import numpy
4545

4646
import dpnp
47-
48-
# pylint: disable=no-name-in-module
49-
import dpnp.backend.extensions.sycl_ext._sycl_ext_impl as sycl_ext
47+
import dpnp.backend.extensions.statistics as statistics_ext
5048

5149
# pylint: disable=no-name-in-module
5250
from .dpnp_utils import map_dtype_to_device
@@ -207,19 +205,6 @@ def _get_bin_edges(a, bins, range, usm_type):
207205
return bin_edges, None
208206

209207

210-
def _search_sorted_inclusive(a, v):
211-
"""
212-
Like :obj:`dpnp.searchsorted`, but where the last item in `v` is placed
213-
on the right.
214-
In the context of a histogram, this makes the last bin edge inclusive
215-
216-
"""
217-
218-
return dpnp.concatenate(
219-
(a.searchsorted(v[:-1], "left"), a.searchsorted(v[-1:], "right"))
220-
)
221-
222-
223208
def digitize(x, bins, right=False):
224209
"""
225210
Return the indices of the bins to which each value in input array belongs.
@@ -509,7 +494,7 @@ def histogram(a, bins=10, range=None, density=None, weights=None):
509494
)
510495
n_usm = dpnp.get_usm_ndarray(n_casted)
511496

512-
ht_ev, mem_ev = sycl_ext.histogram(
497+
ht_ev, mem_ev = statistics_ext.histogram(
513498
a_usm,
514499
bins_usm,
515500
weights_usm,

setup.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,7 @@ def _get_cmdclass():
6666
"dpnp.fft",
6767
"dpnp.linalg",
6868
"dpnp.random",
69+
"dpnp.backend.extensions.statistics",
6970
],
7071
package_data={
7172
"dpnp": [

0 commit comments

Comments
 (0)