Skip to content

implement dpnp.mean - #1632

Merged
vtavana merged 3 commits into
masterfrom
mean
Nov 29, 2023
Merged

implement dpnp.mean#1632
vtavana merged 3 commits into
masterfrom
mean

Conversation

@vtavana

Copy link
Copy Markdown
Contributor

In this PR, dpnp.mean is implemented using its dpctl counterpart.

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

@vtavanavtavana self-assigned this Nov 27, 2023
@github-actions

github-actionsBot commented Nov 27, 2023

Copy link
Copy Markdown
Contributor

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

@vtavana
vtavana marked this pull request as ready for review November 28, 2023 01:30

@antonwolfyantonwolfy left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

We need also to secure performance against the previous implementation of dpnp.mean on PVC and Iris Xe. Could you please check that here is no performance degradation comes with the new implementation?

Comment threaddpnp/dpnp_array.py Outdated
Comment threadtests/test_statistics.py
@vtavana

Copy link
Copy Markdown
ContributorAuthor

Performance on PVC (Intel(R) Data Center GPU Max 1550):
Timing is obtained using %timeit -r 7 -n 100 for three different cases:

  1. a = dpnp.arange(1024*32).reshape(1024,32)
FunctionOld implementationNew Implementation
mean(a)1.98 ms ± 128 µs1.28 ms ± 44.4 µs
mean(a, axis=0)2.39 ms ± 26.6 µs1.52 ms ± 907 µs
mean(a, axis=1)1.97 ms ± 269 µs1.37 ms ± 494 µs
  1. a = dpnp.arange(1024*32).reshape(32,1024)
FunctionOld implementationNew Implementation
mean(a)1.89 ms ± 150 µs1.3 ms ± 33 µs
mean(a, axis=0)2.41 ms ± 48.3 µs1.17 ms ± 34.1 µs
mean(a, axis=1)2.33 ms ± 135 µs1.18 ms ± 26.9 µs
  1. a = dpnp.arange(300*300).reshape(300,300)
FunctionOld implementationNew Implementation
mean(a)2.21 ms ± 78.3 µs1.29 ms ± 58.5 µs
mean(a, axis=0)2.4 ms ± 28.9 µs1.15 ms ± 29.8 µs
mean(a, axis=1)2.39 ms ± 30 µs1.16 ms ± 34 µs

@vtavana

Copy link
Copy Markdown
ContributorAuthor

Performance on Iris Xe (Intel(R) Graphics [0x46a8]):
Timing is obtained using %timeit -r 7 -n 100 for three different cases:

  1. a = dpnp.arange(1024*32).reshape(1024,32)
FunctionOld implementationNew Implementation
mean(a)2.13 ms ± 265 µs621 µs ± 93 µs
mean(a, axis=0)1.96 ms ± 127 µs673 µs ± 102 µs
mean(a, axis=1)1.97 ms ± 122 µs674 µs ± 71.4 µs
  1. a = dpnp.arange(1024*32).reshape(32,1024)
FunctionOld implementationNew Implementation
mean(a)1.9 ms ± 101 µs574 µs ± 87 µs
mean(a, axis=0)1.99 ms ± 55.3 µs737 µs ± 98.2 µs
mean(a, axis=1)1.97 ms ± 105 µs656 µs ± 85.1 µs
  1. a = dpnp.arange(300*300).reshape(300,300)
FunctionOld implementationNew Implementation
mean(a)1.92 ms ± 147 µs622 µs ± 74.5 µs
mean(a, axis=0)1.98 ms ± 113 µs654 µs ± 103 µs
mean(a, axis=1)1.96 ms ± 108 µs698 µs ± 122 µs

@vtavana
vtavana merged commit ad90f66 into masterNov 29, 2023
@vtavana
vtavana deleted the mean branch November 29, 2023 20:40
github-actionsBot added a commit to antonwolfy/dpnp that referenced this pull request Dec 4, 2023
* implement dpnp.mean
* address comments ad90f66
Sign up for freeto 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

@vtavana@antonwolfy