From 678899c7883ed38dd588df5a9edb51876862fabb Mon Sep 17 00:00:00 2001
From: Anton <100830759+antonwolfy@users.noreply.github.com>
Date: Wed, 13 Nov 2024 12:46:07 +0100
Subject: [PATCH 1/4] Update README.md (#2166)
* Update README.md
* Replace with a link to IDP installation guide
---
README.md | 129 +++++++++++++++++++-----------------------------------
1 file changed, 44 insertions(+), 85 deletions(-)
diff --git a/README.md b/README.md
index aa31495d88fc..6dd31be3e231 100644
--- a/README.md
+++ b/README.md
@@ -6,117 +6,76 @@
[](https://intelpython.github.io/dpnp)
[](https://securityscorecards.dev/viewer/?uri=github.com/IntelPython/dpnp)
+
+
# DPNP - Data Parallel Extension for NumPy*
+
+Data Parallel Extension for NumPy* or `dpnp` is a Python library that
+implements a subset of NumPy* that can be executed on any data parallel device.
+The subset is a drop-in replacement of core NumPy* functions and numerical data types.
+
[API coverage summary](https://intelpython.github.io/dpnp/reference/comparison.html#summary)
[Full documentation](https://intelpython.github.io/dpnp/)
-[DPNP C++ backend documentation](https://intelpython.github.io/dpnp/backend_doc/)
+`Dpnp` is the core part of a larger family of [data-parallel Python libraries and tools](https://www.intel.com/content/www/us/en/developer/tools/oneapi/distribution-for-python.html)
+to program on XPUs.
-## Build from source:
-Ensure you have the following prerequisite packages installed:
-- `cython`
-- `cmake >=3.21`
-- `dpcpp_linux-64` or `dpcpp_win-64` (depending on your OS)
-- `dpctl`
-- `mkl-devel-dpcpp`
-- `onedpl-devel`
-- `ninja`
-- `numpy >=1.19,<1.25a0`
-- `python`
-- `scikit-build`
-- `setuptools`
-- `sysroot_linux-64 >=2.28` (only on Linux OS)
-- `tbb-devel`
+# Installing
-After these steps, `dpnp` can be built in debug mode as follows:
+You can install the library using `conda`, `mamba` or [pip](https://pypi.org/project/dpnp/)
+package managers. It is also available as part of the [Intel(R) Distribution for Python](https://www.intel.com/content/www/us/en/developer/tools/oneapi/distribution-for-python.html)
+(IDP).
-```bash
-git clone https://github.com/IntelPython/dpnp
-cd dpnp
-python scripts/build_locally.py
-```
+## Intel(R) Distribution for Python
-## Install Wheel Package via pip
-Install DPNP
-```cmd
-python -m pip install --index-url https://software.repos.intel.com/python/pypi dpnp
-```
+You can find the most recent release of `dpnp` every quarter as part of the IDP
+releases.
-Set path to Performance Libraries in case of using venv or system Python:
-```cmd
-export LD_LIBRARY_PATH=/lib
-```
+To get the library from the latest release, follow the instructions from
+[Get Started With IntelĀ® Distribution for Python](https://www.intel.com/content/www/us/en/developer/articles/technical/get-started-with-intel-distribution-for-python.html).
-It is also required to set following environment variables:
-```cmd
-export OCL_ICD_FILENAMES_RESET=1
-export OCL_ICD_FILENAMES=libintelocl.so
-```
+## Conda
-## Run test
-```bash
-pytest
-# or
-pytest tests/test_matmul.py -s -v
-# or
-python -m unittest tests/test_mixins.py
-```
+To install `dpnp` from the Intel(R) conda channel, use the following command:
-## Run numpy external test
```bash
-. ./0.env.sh
-python -m tests.third_party.numpy_ext
-# or
-python -m tests.third_party.numpy_ext core/tests/test_umath.py
-# or
-python -m tests.third_party.numpy_ext core/tests/test_umath.py::TestHypot::test_simple
+conda install dpnp -c https://software.repos.intel.com/python/conda/ -c conda-forge
```
-### Building documentation:
+## Pip
+
+The `dpnp` can be installed using `pip` obtaining wheel packages either from
+PyPi or from Intel(R) channel. To install `dpnp` wheel package from Intel(R)
+channel, run the following command:
+
```bash
-Prerequisites:
-$ conda install sphinx sphinx_rtd_theme
-Building:
-1. Install dpnp into your python environment
-2. $ cd doc && make html
-3. The documentation will be in doc/_build/html
+python -m pip install --index-url https://software.repos.intel.com/python/pypi dpnp
```
-## Packaging:
+## Installing the bleeding edge
+
+To try out the latest features, install `dpnp` using our development channel on
+Anaconda cloud:
+
```bash
-. ./0.env.sh
-conda-build conda-recipe/
+conda install dpnp -c dppy/label/dev -c https://software.repos.intel.com/python/conda/ -c conda-forge
```
-## Run benchmark:
-```bash
-cd benchmarks/
-asv run --python=python --bench
-# example:
-asv run --python=python --bench bench_elementwise
+# Building
-# or
+Refer to our [Documentation](https://intelpython.github.io/dpnp/quick_start_guide.html)
+for more information on setting up a development environment and building `dpnp`
+from the source.
-asv run --python=python --bench .
-# example:
-asv run --python=python --bench Elementwise.time_square
-# add --quick option to run every case once but looks like first execution has additional overheads and takes a lot of time (need to be investigated)
-```
+# Running Tests
+Tests are located in folder [dpnp/tests](dpnp/tests).
-## Tests matrix:
-| # |Name |OS |distributive|interpreter|python used from|SYCL queue manager|build commands set |forced environment |
-|---|------------------------------------|-----|------------|-----------|:--------------:|:----------------:|------------------------------------------------------------------------------------------------------------------------------------------------|-------------------------------------------------------------------------------------------------------------------------|
-|1 |Ubuntu 20.04 Python37 |Linux|Ubuntu 20.04|Python 3.7 | IntelOneAPI | local |export DPNP_DEBUG=1 python setup.py clean python setup.py build_clib python setup.py build_ext --inplace pytest |cmake-3.19.2, valgrind, pytest-valgrind, conda-build, pytest, hypothesis |
-|2 |Ubuntu 20.04 Python38 |Linux|Ubuntu 20.04|Python 3.8 | IntelOneAPI | local |export DPNP_DEBUG=1 python setup.py clean python setup.py build_clib python setup.py build_ext --inplace pytest |cmake-3.19.2, valgrind, pytest-valgrind, conda-build, pytest, hypothesis |
-|3 |Ubuntu 20.04 Python39 |Linux|Ubuntu 20.04|Python 3.9 | IntelOneAPI | local |export DPNP_DEBUG=1 python setup.py clean python setup.py build_clib python setup.py build_ext --inplace pytest |cmake-3.19.2, valgrind, pytest-valgrind, conda-build, pytest, hypothesis |
-|4 |Ubuntu 20.04 External Tests Python37|Linux|Ubuntu 20.04|Python 3.7 | IntelOneAPI | local |export DPNP_DEBUG=1 python setup.py clean python setup.py build_clib python setup.py build_ext --inplace python -m tests_external.numpy.runtests|cmake-3.19.2, valgrind, pytest-valgrind, conda-build, pytest, hypothesis |
-|5 |Ubuntu 20.04 External Tests Python38|Linux|Ubuntu 20.04|Python 3.8 | IntelOneAPI | local |export DPNP_DEBUG=1 python setup.py clean python setup.py build_clib python setup.py build_ext --inplace python -m tests_external.numpy.runtests|cmake-3.19.2, valgrind, pytest-valgrind, conda-build, pytest, hypothesis |
-|6 |Ubuntu 20.04 External Tests Python39|Linux|Ubuntu 20.04|Python 3.9 | IntelOneAPI | local |export DPNP_DEBUG=1 python setup.py clean python setup.py build_clib python setup.py build_ext --inplace python -m tests_external.numpy.runtests|cmake-3.19.2, valgrind, pytest-valgrind, conda-build, pytest, hypothesis |
-|7 |Code style |Linux|Ubuntu 20.04|Python 3.8 | IntelOneAPI | local |python ./setup.py style |cmake-3.19.2, valgrind, pytest-valgrind, conda-build, pytest, hypothesis, conda-verify, pycodestyle, autopep8, black |
-|8 |Valgrind |Linux|Ubuntu 20.04| | IntelOneAPI | local |export DPNP_DEBUG=1 python setup.py clean python setup.py build_clib python setup.py build_ext --inplace |cmake-3.19.2, valgrind, pytest-valgrind, conda-build, pytest, hypothesis |
-|9 |Code coverage |Linux|Ubuntu 20.04|Python 3.8 | IntelOneAPI | local |export DPNP_DEBUG=1 python setup.py clean python setup.py build_clib python setup.py build_ext --inplace |cmake-3.19.2, valgrind, pytest-valgrind, conda-build, pytest, hypothesis, conda-verify, pycodestyle, autopep8, pytest-cov|
+To run the tests, use:
+```bash
+python -m pytest --pyargs dpnp
+```
From 18a8eb5b751df32fda372d4a702d2a3a2b1fc6da Mon Sep 17 00:00:00 2001
From: Anton Volkov
Date: Thu, 5 Dec 2024 12:24:56 +0100
Subject: [PATCH 2/4] Add entry to ChangeLog
---
CHANGELOG.md | 11 ++++++++++-
1 file changed, 10 insertions(+), 1 deletion(-)
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 864fb2fb79aa..11ba6b459cb5 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,9 +1,18 @@
# Changelog
All notable changes to this project will be documented in this file.
-The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
+The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
+## [0.16.1] - 12/XX/2024
+
+This is a bug-fix release.
+
+### Changed
+
+* Updated `README.md` to reflect current installation requirements and available options [#2166](https://github.com/IntelPython/dpnp/pull/2166)
+
+
## [0.16.0] - 10/14/2024
This release reaches an important milestone by making offloading fully asynchronous. Calls to `dpnp` submit tasks for execution to DPC++ runtime and return without waiting for execution of these tasks to finish. The sequential semantics a user comes to expect from execution of Python script is preserved though.
From 5472b282c90d0806ff2eb6143eacd386915f9351 Mon Sep 17 00:00:00 2001
From: Vahid Tavanashad <120411540+vtavana@users.noreply.github.com>
Date: Thu, 14 Nov 2024 08:15:58 -0600
Subject: [PATCH 3/4] fix CFD issue for dpnp.extract (#2172)
Co-authored-by: Anton <100830759+antonwolfy@users.noreply.github.com>
---
dpnp/dpnp_iface_indexing.py | 10 ++++------
tests/test_sycl_queue.py | 14 ++++++++++++++
tests/test_usm_type.py | 12 ++++++++++++
3 files changed, 30 insertions(+), 6 deletions(-)
diff --git a/dpnp/dpnp_iface_indexing.py b/dpnp/dpnp_iface_indexing.py
index 3c94c7091ec9..a51c42bb4c40 100644
--- a/dpnp/dpnp_iface_indexing.py
+++ b/dpnp/dpnp_iface_indexing.py
@@ -51,10 +51,7 @@
dpnp_putmask,
)
from .dpnp_array import dpnp_array
-from .dpnp_utils import (
- call_origin,
- get_usm_allocations,
-)
+from .dpnp_utils import call_origin, get_usm_allocations
__all__ = [
"choose",
@@ -585,11 +582,12 @@ def extract(condition, a):
"""
usm_a = dpnp.get_usm_ndarray(a)
+ usm_type, exec_q = get_usm_allocations([usm_a, condition])
usm_cond = dpnp.as_usm_ndarray(
condition,
dtype=dpnp.bool,
- usm_type=usm_a.usm_type,
- sycl_queue=usm_a.sycl_queue,
+ usm_type=usm_type,
+ sycl_queue=exec_q,
)
if usm_cond.size != usm_a.size:
diff --git a/tests/test_sycl_queue.py b/tests/test_sycl_queue.py
index e1ae1d8e65dc..a44f156b81c0 100644
--- a/tests/test_sycl_queue.py
+++ b/tests/test_sycl_queue.py
@@ -406,6 +406,20 @@ def test_copy_operation(device):
assert_sycl_queue_equal(y.sycl_queue, x.sycl_queue)
+@pytest.mark.parametrize(
+ "device",
+ valid_devices,
+ ids=[device.filter_string for device in valid_devices],
+)
+def test_extract(device):
+ x = dpnp.arange(3, device=device)
+ y = dpnp.array([True, False, True], device=device)
+ result = dpnp.extract(x, y)
+
+ assert_sycl_queue_equal(result.sycl_queue, x.sycl_queue)
+ assert_sycl_queue_equal(result.sycl_queue, y.sycl_queue)
+
+
@pytest.mark.parametrize(
"device",
valid_devices,
diff --git a/tests/test_usm_type.py b/tests/test_usm_type.py
index 592340d6c0db..2dcd1bbf98fa 100644
--- a/tests/test_usm_type.py
+++ b/tests/test_usm_type.py
@@ -769,6 +769,18 @@ def test_concat_stack(func, data1, data2, usm_type_x, usm_type_y):
assert z.usm_type == du.get_coerced_usm_type([usm_type_x, usm_type_y])
+@pytest.mark.parametrize("usm_type_x", list_of_usm_types, ids=list_of_usm_types)
+@pytest.mark.parametrize("usm_type_y", list_of_usm_types, ids=list_of_usm_types)
+def test_extract(usm_type_x, usm_type_y):
+ x = dp.arange(3, usm_type=usm_type_x)
+ y = dp.array([True, False, True], usm_type=usm_type_y)
+ z = dp.extract(y, x)
+
+ assert x.usm_type == usm_type_x
+ assert y.usm_type == usm_type_y
+ assert z.usm_type == du.get_coerced_usm_type([usm_type_x, usm_type_y])
+
+
@pytest.mark.parametrize(
"func,data1",
[
From 7c8631acd36dabb646883641bb1cddaa1460da86 Mon Sep 17 00:00:00 2001
From: Anton Volkov
Date: Thu, 5 Dec 2024 12:32:23 +0100
Subject: [PATCH 4/4] Add entry to ChangeLog
---
CHANGELOG.md | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 11ba6b459cb5..68a0dfba61cf 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -12,6 +12,10 @@ This is a bug-fix release.
* Updated `README.md` to reflect current installation requirements and available options [#2166](https://github.com/IntelPython/dpnp/pull/2166)
+### Fixed
+
+* Resolved an issue with Compute Follows Data inconsistency in `dpnp.extract` function [#2172](https://github.com/IntelPython/dpnp/pull/2172)
+
## [0.16.0] - 10/14/2024