-
Notifications
You must be signed in to change notification settings - Fork 30
Expanded doc-string of dpctl.tensor.usm_ndarray.to_device #990
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
Conversation
View rendered docs @ https://intelpython.github.io/dpctl/pulls/990/index.html |
Array API standard conformance tests for dpctl=0.14.0rc2=py310h8c27c75_5 ran successfully. |
The failure of pre-commit workflow is being addressed in #991 |
90646b6
to
0010e48
Compare
Array API standard conformance tests for dpctl=0.14.0rc2=py310h8c27c75_7 ran successfully. |
0010e48
to
bc58a9a
Compare
Array API standard conformance tests for dpctl=0.14.0rc2=py310h8c27c75_7 ran successfully. |
bc58a9a
to
00b333f
Compare
Array API standard conformance tests for dpctl=0.14.0rc2=py310h8c27c75_7 ran successfully. |
00b333f
to
427c4e6
Compare
Array API standard conformance tests for dpctl=0.14.0rc2=py310h8c27c75_7 ran successfully. |
427c4e6
to
bd6700c
Compare
Array API standard conformance tests for dpctl=0.14.0rc2=py310h8c27c75_7 ran successfully. |
bd6700c
to
87fe6b2
Compare
Array API standard conformance tests for dpctl=0.14.0rc2=py310h8c27c75_7 ran successfully. |
87fe6b2
to
0a44b81
Compare
Array API standard conformance tests for dpctl=0.14.0rc2=py310h8c27c75_7 ran successfully. |
769675b
to
3b66dc9
Compare
3b66dc9
to
335afd5
Compare
Array API standard conformance tests for dpctl=0.14.0rc2=py310h8c27c75_7 ran successfully. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've checked the generated page and it looks that:
- The copyright year is not updated:
Copyright 2020-21, Intel Corp..
- The link below from
usm_ndarray.usm_type
description isn't working:
USM type of underlying memory. Can be ‘device’, ‘shared’, or ‘host’.
See: https://docs.oneapi.com/versions/latest/dpcpp/iface/usm.html
y = x.to_device(q_prof) | ||
timer = dpctl.SyclTimer() | ||
with timer(q_prof): | ||
z = y * y |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've tried the example, but got an exception:
In [1]: import dpctl
...: import dpctl.tensor as dpt
...:
...: x = dpt.full(10**6, 2, dtype="int64")
...: q_prof = dpctl.SyclQueue(
...: x.sycl_device, property="enable_profiling")
...: # return a view with profile-enabled queue
...: y = x.to_device(q_prof)
...: timer = dpctl.SyclTimer()
...: with timer(q_prof):
...: z = y * y
...: print(timer.dt)
---------------------------------------------------------------------------
TypeError Traceback (most recent call last)
Input In [1], in <cell line: 10>()
9 timer = dpctl.SyclTimer()
10 with timer(q_prof):
---> 11 z = y * y
12 print(timer.dt)
TypeError: unsupported operand type(s) for *: 'dpctl.tensor._usmarray.usm_ndarray' and 'dpctl.tensor._usmarray.usm_ndarray'
but if I add import dpnp
and run exactly the same code again, it will pass:
In [2]: import dpnp
In [3]: import dpctl
...: import dpctl.tensor as dpt
...:
...: x = dpt.full(10**6, 2, dtype="int64")
...: q_prof = dpctl.SyclQueue(
...: x.sycl_device, property="enable_profiling")
...: # return a view with profile-enabled queue
...: y = x.to_device(q_prof)
...: timer = dpctl.SyclTimer()
...: with timer(q_prof):
...: z = y * y
...: print(timer.dt)
(0.10838821064680815, 0.10794714400000001)
since, as I've got, dpctl will dispatch to dpnp.multiply
then.
I believe import dpnp
is missing in the example.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, this example presently requires dpnp
, because dpctl.tensor.__mul__
falls back to dpnp
if present or returns NotImplemented
. This is transient and support for Python arithmetic operations is coming soon.
For the purpose of illustrating usm_ndarray.to_device
I probably should have used z = foo(y)
to emphasize that any offloading routine we want to time could be used.
Merging. Will update copyright years with a tool in a separate commit. |
Deleted rendered PR docs from intelpython.github.com/dpctl, latest should be updated shortly. 🤞 |
Array API standard conformance tests for dpctl=0.14.0rc2=py310h8c27c75_7 ran successfully. |
Expanded doc-string for
to_device
method ofusm_ndarray
class.