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

impelement dpnp.norm #1746

Merged
merged 16 commits into from
Apr 3, 2024
Merged

impelement dpnp.norm #1746

merged 16 commits into from
Apr 3, 2024

Conversation

vtavana
Copy link
Collaborator

@vtavana vtavana commented Mar 13, 2024

In this PR, dpnp.norm is updated using existing functions in dpnp.

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

@vtavana vtavana self-assigned this Mar 13, 2024
Copy link
Contributor

github-actions bot commented Mar 13, 2024

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

@vtavana vtavana marked this pull request as ready for review March 13, 2024 18:07
dpnp/linalg/dpnp_utils_linalg.py Outdated Show resolved Hide resolved
dpnp/linalg/dpnp_utils_linalg.py Outdated Show resolved Hide resolved
dpnp/linalg/dpnp_iface_linalg.py Outdated Show resolved Hide resolved
dpnp/linalg/dpnp_utils_linalg.py Show resolved Hide resolved
dpnp/linalg/dpnp_utils_linalg.py Outdated Show resolved Hide resolved
dpnp/linalg/dpnp_utils_linalg.py Outdated Show resolved Hide resolved
tests/test_sycl_queue.py Outdated Show resolved Hide resolved
tests/test_sycl_queue.py Outdated Show resolved Hide resolved
tests/test_usm_type.py Outdated Show resolved Hide resolved
dpnp/linalg/dpnp_utils_linalg.py Show resolved Hide resolved
dpnp/linalg/dpnp_utils_linalg.py Show resolved Hide resolved
dpnp/linalg/dpnp_utils_linalg.py Show resolved Hide resolved
dpnp/linalg/dpnp_utils_linalg.py Show resolved Hide resolved
@vtavana
Copy link
Collaborator Author

vtavana commented Mar 26, 2024

timing case 1: output is scalar
Poor performance on cpu for floating point data types is known and related to dpnp.dot function.

import dpctl,dpctl.tensor as dpt, numpy, dpnp
import numpy.random as default_rng
npoints = 10**8
dims = 3
x = default_rng.random((npoints, dims))
dtype = "i4"
x = numpy.array(x, dtype=dtype)
device="gpu"
x_dp = dpnp.array(x, device=device)

%timeit numpy.linalg.norm(x)

%timeit dpnp.linalg.norm(x_dp)

device="cpu"
x_dp = dpnp.array(x, device=device)
%timeit dpnp.linalg.norm(x_dp)

image

image

@vtavana
Copy link
Collaborator Author

vtavana commented Mar 26, 2024

timing case 2: output is a vector

import dpctl,dpctl.tensor as dpt, numpy, dpnp
import numpy.random as default_rng
npoints = 10**8
dims = 3
x = default_rng.random((npoints, dims))
dtype = "i4"
x = numpy.array(x, dtype=dtype)
device="gpu"
x_dp = dpnp.array(x, device=device)

%timeit numpy.linalg.norm(x, axis=1)

%timeit dpnp.linalg.norm(x_dp, axis=1)

device="cpu"
x_dp = dpnp.array(x, device=device)
%timeit dpnp.linalg.norm(x_dp, axis=1)

image

image

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 @vtavana

@vtavana vtavana changed the title impelement dpnp.norm impelement dpnp.norm Apr 3, 2024
@vtavana vtavana merged commit a8bcdaf into master Apr 3, 2024
44 checks passed
@vtavana vtavana deleted the dpnp_norm branch April 3, 2024 04:41
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