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

Improve performance for dpnp.diag() #1822

Merged
merged 5 commits into from
May 13, 2024
Merged

Conversation

vlad-perevezentsev
Copy link
Collaborator

This PR suggests to update dpnp.diag() implementation with a reuse of dpnp.diagonal() and return a read/write view instead of copy if the input array is an instance of {dpnp.ndarray, usm_ndarray} for the default case ( device ,usm_type, sycl_queue are None).
These changes greatly improve performance compared to the old implementation

image

  • 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?

Copy link
Contributor

github-actions bot commented May 13, 2024

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

dpnp/dpnp_iface_arraycreation.py Outdated Show resolved Hide resolved
dpnp/dpnp_iface_arraycreation.py Show resolved Hide resolved
dpnp/dpnp_iface_arraycreation.py Show resolved Hide resolved
Copy link
Contributor

@antonwolfy antonwolfy 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 @vlad-perevezentsev for implementing so noticeable improvement.

@vlad-perevezentsev vlad-perevezentsev merged commit 4ef2157 into master May 13, 2024
55 of 56 checks passed
@vlad-perevezentsev vlad-perevezentsev deleted the update_dpnp_diag branch May 13, 2024 14:39
github-actions bot added a commit that referenced this pull request May 13, 2024
* Update dpnp.diag to improve perfomance

* Use dpnp.zero_like() instead of dpnp.zeros()

* Update doctrings for dpnp.diagflat/eye/identity

* Update cupy test_matrix.py 4ef2157
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