Skip to content

Use USMHost as underlying buffer for result - #1026

Merged
oleksandr-pavlyk merged 1 commit into
masterfrom
faster-asnumpy
Dec 26, 2022
Merged

oleksandr-pavlyk merged 1 commit into
masterfrom
faster-asnumpy

Conversation

@oleksandr-pavlyk

@oleksandr-pavlyk oleksandr-pavlyk commented Dec 20, 2022 •

Copy link
Copy Markdown
Contributor

This should improver transfer timing per GPU optimization guidelines

  • Have you provided a meaningful PR description?
  • Have you added a test, reproducer or referred to an 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?
  • If this PR is a work in progress, are you filing the PR as a draft?

@github-actions

Copy link
Copy Markdown

Array API standard conformance tests for dpctl=0.14.1dev0=py310h76be34b_47 ran successfully.
Passed: 33
Failed: 801
Skipped: 280

@oleksandr-pavlyk

Copy link
Copy Markdown
Contributor Author

This change results in dramatic speed-up of dpt.asnumpy. For example, before the change:

In [1]: import dpctl.tensor as dpt

In [2]: x = dpt.ones(10**7 + 2, dtype='i2', device='gpu')

In [3]: %time y = dpt.asnumpy(x)
CPU times: user 285 µs, sys: 140 ms, total: 141 ms
Wall time: 100 ms

In [4]: %timeit y = dpt.asnumpy(x)
70.7 ms ± 4.13 ms per loop (mean ± std. dev. of 7 runs, 10 loops each)

after:

In [1]: import dpctl.tensor as dpt

In [2]: x = dpt.ones(10**7 + 2, dtype='i2', device='gpu')

In [3]: %time y = dpt.asnumpy(x)
CPU times: user 19.3 ms, sys: 69.4 ms, total: 88.7 ms
Wall time: 69.4 ms

In [4]: %timeit y = dpt.asnumpy(x)
15.9 ms ± 956 µs per loop (mean ± std. dev. of 7 runs, 100 loops each)

Consequentially, it improves performance of __repr__.

@oleksandr-pavlyk
oleksandr-pavlyk marked this pull request as ready for review December 22, 2022 02:55
@github-actions

Copy link
Copy Markdown

Array API standard conformance tests for dpctl=0.14.1dev0=py310h76be34b_47 ran successfully.
Passed: 33
Failed: 801
Skipped: 280

This should improver transfer timing per GPU optimization guidelines
@github-actions

Copy link
Copy Markdown

@coveralls

Copy link
Copy Markdown
Collaborator

Coverage Status

Coverage: 82.187% (+0.02%) from 82.172% when pulling b6ff2df on faster-asnumpy into e6da513 on master.

@github-actions

Copy link
Copy Markdown

Array API standard conformance tests for dpctl=0.14.1dev0=py310h76be34b_73 ran successfully.
Passed: 33
Failed: 801
Skipped: 280

@ndgrigorian ndgrigorian left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

LGTM!

@oleksandr-pavlyk
oleksandr-pavlyk merged commit 5ce4f42 into master Dec 26, 2022
@oleksandr-pavlyk
oleksandr-pavlyk deleted the faster-asnumpy branch December 26, 2022 19:02
@github-actions

Copy link
Copy Markdown

Deleted rendered PR docs from intelpython.github.com/dpctl, latest should be updated shortly. 🤞

@github-actions

Copy link
Copy Markdown

Array API standard conformance tests for dpctl=0.14.1dev0=py310h76be34b_73 ran successfully.
Passed: 33
Failed: 801
Skipped: 280

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.

3 participants