Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support of missing arguments in dpnp.count_nonzero #1615

Merged
merged 4 commits into from
Nov 3, 2023

Conversation

antonwolfy
Copy link
Contributor

@antonwolfy antonwolfy commented Nov 2, 2023

The PR is about to fully get rid of fallback on numpy in dpnp.count_nonzero function. It requires to implement support of remaining arguments there.
Another added improvement here is to calculate the result using kernel submitting to a device rather than copying input data to shared USM memory and performing computing on the host.

The implementation is done through dpnp.sum call for an input array casted to bool type.
It is enough to demonstrate a huge performance improvements for the dpnp.count_nonzero call time. Meanwhile there is possible future improvement by implementation a SYCL extension with separate kernel specific to count_nonzero operation.

  • Have you provided a meaningful PR description?
  • Have you added a test, reproducer or referred to issue with a reproducer?
  • Have you tested your changes locally for CPU and GPU devices?
  • Have you made sure that new changes do not introduce compiler warnings?
  • Have you checked performance impact of proposed changes?
  • If this PR is a work in progress, are you filing the PR as a draft?

@antonwolfy antonwolfy self-assigned this Nov 2, 2023
Copy link
Contributor

github-actions bot commented Nov 2, 2023

View rendered docs @ https://intelpython.github.io/dpnp/index.html

Copy link
Collaborator

@vtavana vtavana left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In addition, could we add all data types to tests/test_counting.py::test_count_nonzero?

dpnp/dpnp_iface_counting.py Outdated Show resolved Hide resolved
dpnp/dpnp_iface_counting.py Outdated Show resolved Hide resolved
@antonwolfy
Copy link
Contributor Author

antonwolfy commented Nov 2, 2023

In addition, could we add all data types to tests/test_counting.py::test_count_nonzero?

Done. Thank you for catching that.

Copy link
Collaborator

@vtavana vtavana left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you @antonwolfy

@antonwolfy antonwolfy merged commit 83d28d7 into master Nov 3, 2023
34 of 35 checks passed
@antonwolfy antonwolfy deleted the count_nonzero branch November 3, 2023 08:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants