Overhaul of dpctl documentation#1619
Conversation
|
@oleksandr-pavlyk the PR will need to be split up. I suggest all docstring changes to be merged separately. |
f58650f to
0567168
Compare
|
Deleted rendered PR docs from intelpython.github.com/dpctl, latest should be updated shortly. 🤞 |
|
Array API standard conformance tests for dpctl=0.17.0dev0=py310h15de555_181 ran successfully. |
1 similar comment
|
Array API standard conformance tests for dpctl=0.17.0dev0=py310h15de555_181 ran successfully. |
0567168 to
2348853
Compare
|
Array API standard conformance tests for dpctl=0.17.0dev0=py310h15de555_181 ran successfully. |
|
Array API standard conformance tests for dpctl=0.17.0dev0=py310h15de555_182 ran successfully. |
|
Array API standard conformance tests for dpctl=0.17.0dev0=py310h15de555_186 ran successfully. |
|
Array API standard conformance tests for dpctl=0.17.0dev0=py310h15de555_187 ran successfully. |
|
Array API standard conformance tests for dpctl=0.17.0dev0=py310h15de555_189 ran successfully. |
|
Array API standard conformance tests for dpctl=0.17.0dev0=py310h15de555_191 ran successfully. |
a597ccc to
4da37bc
Compare
I split the PR into gh-1625, and remaining docs-only changes in this PR opened into branch behind gh-1625. |
|
Array API standard conformance tests for dpctl=0.17.0dev0=py310h15de555_190 ran successfully. |
|
Array API standard conformance tests for dpctl=0.17.0dev0=py310h15de555_191 ran successfully. |
891a1c5 to
7ac9ff2
Compare
4840c5f to
6ef7cc5
Compare
|
Array API standard conformance tests for dpctl=0.17.0dev0=py310h15de555_192 ran successfully. |
4463a84 to
9bc0a86
Compare
|
Array API standard conformance tests for dpctl=0.17.0dev0=py310h15de555_199 ran successfully. |
|
Array API standard conformance tests for dpctl=0.17.0dev0=py310h15de555_200 ran successfully. |
|
Array API standard conformance tests for dpctl=0.17.0dev0=py310h15de555_201 ran successfully. |
|
Array API standard conformance tests for dpctl=0.17.0dev0=py310h15de555_202 ran successfully. |
|
Array API standard conformance tests for dpctl=0.17.0dev0=py310h15de555_285 ran successfully. |
|
|
||
| .. note:: | ||
| Two instances :class:`dpctl.SyclQueue` may target the same ``sycl::device`` and be using the same ``sycl::context``, but correspond | ||
| to different scheduling enties, and hence be in violation of the compute-follows-data requirement. One common example of this are |
There was a problem hiding this comment.
Nit, but was this meant to say "entries"?
| If assignign USM-type "device" a score of 0, USM-type "shared" a score of 1, and USM-type "host" a score of 2, | ||
| the USM-type of the output array has the smallest score of all its inputs. | ||
|
|
||
| .. currentmodule:: dpctl.utils | ||
|
|
||
| The convenience function :py:func:`get_coerced_usm_type` is a convenience function to determine the USM-type | ||
| following this convention: |
There was a problem hiding this comment.
| If assignign USM-type "device" a score of 0, USM-type "shared" a score of 1, and USM-type "host" a score of 2, | |
| the USM-type of the output array has the smallest score of all its inputs. | |
| .. currentmodule:: dpctl.utils | |
| The convenience function :py:func:`get_coerced_usm_type` is a convenience function to determine the USM-type | |
| following this convention: | |
| If assigning USM-type "device" a score of 0, USM-type "shared" a score of 1, and USM-type "host" a score of 2, | |
| the USM-type of the output array has the smallest score of all its inputs. | |
| .. currentmodule:: dpctl.utils | |
| The convenience function :py:func:`get_coerced_usm_type` determines the USM-type following this convention: |
| # r3 has value "host" | ||
| r3 = get_coerced_usm_type(["host", "host", "host"]) | ||
|
|
||
| Sharing data between devices and Python |
There was a problem hiding this comment.
It may be worthwhile to add an example demonstrating what happens when migrating a Numpy array of a data type not supported by the destination device.
Can be done later though.
| ------------- | ||
|
|
||
| * History of ``"dpctl"`` :ref:`name <beginners_guide_why_dpctl>` | ||
| * Frequenty asked questions |
There was a problem hiding this comment.
| * Frequenty asked questions | |
| * Frequently asked questions |
| @@ -0,0 +1,69 @@ | |||
| .. _beginners_guide_why_dpctl: | |||
|
|
|||
| History of ``dpctl`` name | |||
There was a problem hiding this comment.
I wonder if this page should either be renamed or moved to the beginner's guides index page in the future. It stands out when looking at the list.
| :class:`dpctl.tensor.usm_ndarray` objects one associated with ``q1`` and another associated with ``q2`` | ||
| could not be combined in a call to the same function that implementes | ||
| :ref:`compute-followed-data programming model <dpctl_tensor_compute_follows_data>` in :mod:`dpctl.tensor`. |
There was a problem hiding this comment.
| :class:`dpctl.tensor.usm_ndarray` objects one associated with ``q1`` and another associated with ``q2`` | |
| could not be combined in a call to the same function that implementes | |
| :ref:`compute-followed-data programming model <dpctl_tensor_compute_follows_data>` in :mod:`dpctl.tensor`. | |
| :class:`dpctl.tensor.usm_ndarray` objects one associated with ``q1`` and another associated with ``q2`` | |
| could not be combined in a call to the same function that implements | |
| :ref:`compute-follows-data programming model <dpctl_tensor_compute_follows_data>` in :mod:`dpctl.tensor`. |
| x1 : dpctl.tensor.usm_ndarray, | ||
| x2 : dpctl.tensor.usm_ndarray | ||
| ): | ||
| exec_q = dpctil.utils.get_execution_queue((x1.sycl_queue, x2.sycl_queue)) |
There was a problem hiding this comment.
| exec_q = dpctil.utils.get_execution_queue((x1.sycl_queue, x2.sycl_queue)) | |
| exec_q = dpctl.utils.get_execution_queue((x1.sycl_queue, x2.sycl_queue)) |
| ... | ||
|
|
||
| In order to ensure that compute-follows-data works seemlessly out-of-the-box, :mod:`dpctl` maintains | ||
| a cache of with context and device as keys and queues as values used by :class:`dpctl.tensor.Device` class. |
There was a problem hiding this comment.
| a cache of with context and device as keys and queues as values used by :class:`dpctl.tensor.Device` class. | |
| a cache with context and device as keys and queues as values used by :class:`dpctl.tensor.Device` class. |
| const auto &all_root_devs = sycl::device::get_devices(); | ||
| auto beg = std::begin(all_root_devs); | ||
| auto end = std::end(all_root_devs); | ||
| auto selectot_fn = [parent_root_device](const sycl::device &root_d) -> bool { |
There was a problem hiding this comment.
| auto selectot_fn = [parent_root_device](const sycl::device &root_d) -> bool { | |
| auto selector_fn = [parent_root_device](const sycl::device &root_d) -> bool { |
| select_cpu_device | ||
| select_gpu_device | ||
| select_accelerator_device | ||
| select_device_with_aspects |
There was a problem hiding this comment.
This function could use a proper docstring later.
There was a problem hiding this comment.
This was referring specifically to select_device_with_aspects, which has a description that isn't a true docstring (no real info about what types are permitted for a required_aspect, for instance).
| SyclProgram | ||
| SyclKernel |
There was a problem hiding this comment.
Empty __init__() methods are picked up in the documentation of these, and the methods don't have pages or proper docstrings.
| :py:mod:`dpctl.tensor` is written using C++ and :sycl_spec_2020:`SYCL <>` | ||
| and oneAPI extensions implemented in :dpcpp_compiler:`Intel(R) oneAPI DPC++ compiler <>`. | ||
|
|
||
| This module contains: |
There was a problem hiding this comment.
Some undocumented things:
all constants (pi,e,nan,inf, andnewaxis)asnumpyandto_numpydtypeitself- in elementwise functions, no documentation is rendered for
nin,nout,types, etc. special attributes - print utilities do not have rendered documentation
flags object onusm_ndarrayis mentioned underusm_ndarray.flagsbut has no rendered documentation- order keyword in general/memory layouts (C-contiguous vs. F-contiguous) may be worth a quick note
|
@oleksandr-pavlyk |
Some found in review, some identified by spell-checker tool.
Also added few workd to the list is known-to-be-correctly-spelled
|
Array API standard conformance tests for dpctl=0.17.0dev0=py310h15de555_291 ran successfully. |
ndgrigorian
left a comment
There was a problem hiding this comment.
Changes requested in my review have now either been committed or will be deferred to a later PR.
This LGTM, thank you @oleksandr-pavlyk! Very exciting to see these documentation improvements finally go in.
diptorupd
left a comment
There was a problem hiding this comment.
Let's merge it as-is for now, the changes in the PR are already a big improvement over status quo.
Also, the PR has become too large and all further change should be done incrementally.
This PR is a rewrite of
dpctl's documentation. Here is the link to rendered docs based on sources in this PR.generate_rst.pyand AutoAutosummary class, but uses Sphinx's autosummary extension to generate individual pages for classes, and array API functions.This required test changes and code changes.