Skip to content

Commit 6239281

Browse files
authored
Refresh documentation (#1485)
* Updated Overview page * Added Quick Start Guide * Updated developement guides * Applied review comments * Added examples * Keeping existing docs instead of full clean-up
1 parent 70294a3 commit 6239281

21 files changed

+475
-188
lines changed

.github/workflows/build-sphinx.yml

Lines changed: 70 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,17 +4,21 @@ on:
44
branches:
55
- master
66
pull_request:
7+
types: [opened, synchronize, reopened, closed]
8+
9+
env:
10+
PUBLISH_DIR: doc/_build/html/
11+
12+
defaults:
13+
run:
14+
shell: bash -l {0}
715

816
jobs:
917
build-and-deploy:
1018
name: Build and Deploy Docs
1119

1220
runs-on: ubuntu-20.04
1321

14-
defaults:
15-
run:
16-
shell: bash -l {0}
17-
1822
env:
1923
python-ver: '3.9'
2024
CHANNELS: '-c dppy/label/dev -c intel -c conda-forge --override-channels'
@@ -116,4 +120,65 @@ jobs:
116120
uses: peaceiris/actions-gh-pages@v3.9.3
117121
with:
118122
github_token: ${{ secrets.GITHUB_TOKEN }}
119-
publish_dir: doc/_build/html/
123+
publish_dir: ${{ env.PUBLISH_DIR }}
124+
125+
- name: Publish pull-request docs
126+
if: |
127+
!github.event.pull_request.head.repo.fork && github.event.pull_request && github.event.action != 'closed'
128+
uses: peaceiris/actions-gh-pages@v3.9.3
129+
with:
130+
github_token: ${{ secrets.GITHUB_TOKEN }}
131+
publish_dir: ${{ env.PUBLISH_DIR }}
132+
destination_dir: ./pull/${{ github.event.number }}
133+
allow_empty_commit : true
134+
keep_files: true
135+
commit_message: ${{ github.event.head_commit.message }}
136+
publish_branch: gh-pages
137+
user_name: 'github-actions[bot]'
138+
user_email: 'github-actions[bot]@users.noreply.github.com'
139+
140+
- name: Comment with URL to published pull-request docs
141+
if: |
142+
!github.event.pull_request.head.repo.fork && github.event.pull_request && github.event.action != 'closed'
143+
env:
144+
PR_NUM: ${{ github.event.number }}
145+
uses: mshick/add-pr-comment@v2.8.1
146+
with:
147+
message: |
148+
View rendered docs @ https://intelpython.github.io/dpnp/pull/${{ env.PR_NUM }}/index.html
149+
allow-repeats: false
150+
151+
clean:
152+
if: |
153+
!github.event.pull_request.head.repo.fork && github.event.pull_request && github.event.action == 'closed'
154+
155+
needs: build-and-deploy
156+
157+
runs-on: ubuntu-20.04
158+
159+
steps:
160+
- uses: actions/checkout@v3.5.2
161+
with:
162+
fetch-depth: 0
163+
164+
- name: Remove docs [PR closed]
165+
env:
166+
PR_NUM: ${{ github.event.number }}
167+
run: |
168+
git remote add tokened_docs https://IntelPython:${{ secrets.GITHUB_TOKEN }}@github.com/IntelPython/dpnp.git
169+
git fetch tokened_docs
170+
git checkout --track tokened_docs/gh-pages
171+
echo `pwd`
172+
[ -d pull/${PR_NUM} ] && git rm -rf pull/${PR_NUM}
173+
git config --global user.name 'github-actions[bot]'
174+
git config --global user.email 'github-actions[bot]@users.noreply.github.com'
175+
git commit -m "Removing docs for closed pull request ${PR_NUM}"
176+
git push tokened_docs gh-pages
177+
178+
- name: Modify the comment with URL to official documentation
179+
uses: mshick/add-pr-comment@v2.8.1
180+
with:
181+
find: |
182+
View rendered docs @.+
183+
replace: |
184+
View rendered docs @ https://intelpython.github.io/dpnp/index.html

CHANGELOG.md

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,14 @@ All notable changes to this project will be documented in this file.
44
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
55
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
66

7+
## [0.12.2] - TBA
8+
9+
### Added
10+
11+
### Changed
12+
13+
### Fixed
14+
715
## [0.12.1] - 07/18/2023
816

917
### Added
@@ -23,11 +31,12 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
2331
* Added a specialized kernel for `dpnp.sum` with `axis=0` as a pybind11 extension [#1479](https://github.com/IntelPython/dpnp/pull/1479)
2432
* Redesigned `dpnp.square` function through pybind11 extension of OneMKL call where possible or Leveraging on `dpctl.tensor` implementation [#1473](https://github.com/IntelPython/dpnp/pull/1473)
2533
* Redesigned `dpnp.cos` and `dpnp.sin` functions through pybind11 extension of OneMKL calls where possible or Leveraging on `dpctl.tensor` implementation [#1471](https://github.com/IntelPython/dpnp/pull/1471)
26-
* Redesigned `dpnp.sqrt` function through pybind11 extension of OneMKL call where possible or Leveraging on `dpctl.tensor` implementation [#1470](https://github.com/IntelPython/dpnp/pull/1470)
27-
* Redesigned `dpnp.log` function through pybind11 extension of OneMKL call where possible or Leveraging on `dpctl.tensor` implementation [#1469](https://github.com/IntelPython/dpnp/pull/1469)
34+
* Redesigned `dpnp.sqrt` function through pybind11 extension of OneMKL call where possible or leveraging on `dpctl.tensor` implementation [#1470](https://github.com/IntelPython/dpnp/pull/1470)
35+
* Redesigned `dpnp.log` function through pybind11 extension of OneMKL call where possible or leveraging on `dpctl.tensor` implementation [#1469](https://github.com/IntelPython/dpnp/pull/1469)
2836
* Leveraged `dpctl.tensor` implementation for logical operations [#1464](https://github.com/IntelPython/dpnp/pull/1464)
2937
* Leveraged `dpctl.tensor` implementation for `dpnp.floor_divide` function [#1462](https://github.com/IntelPython/dpnp/pull/1462)
3038
* Leveraged `dpctl.tensor` implementation for comparison functions [#1458](https://github.com/IntelPython/dpnp/pull/1458)
39+
3140
### Fixed
3241

3342
* Improved `dpnp.dot` function to support OneMKL calls for input and output arrays with strides [#1477](https://github.com/IntelPython/dpnp/pull/1477)

doc/dpctl.rst

Lines changed: 18 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,19 @@
1-
DPCtl Usage
2-
===========
1+
.. _dptcl:
2+
.. include:: ./ext_links.txt
33

4-
`DPCtl <https://github.com/IntelPython/dpctl>`_ provides API to manage
5-
specific SYCL resources for SYCL-based Python packages. DPNP uses DPCtl as
6-
a global SYCL queue manager. Below code illustrates simple usage of DPNP
7-
in combination with dpCtl.
4+
Interplay with the Data Parallel Control Library
5+
===============================================
6+
7+
`Data Parallel Control Library`_ provides API to manage specific
8+
`SYCL*`_ resources for SYCL-based Python packages.
9+
10+
An example below demonstrates how the Data Parallel Extension for NumPy* can be
11+
easily combined with the device management interface provided by dpctl package.
12+
13+
Literally, the SYCL* queue manager interface from the dpctl package allows
14+
to set an input queue as the currently usable queue inside the context
15+
manager's scope. This way an array creation function from the dpnp package
16+
which is defined inside the context will allocate the data using that queue.
817

918
.. code-block:: python
1019
:linenos:
@@ -16,10 +25,11 @@ in combination with dpCtl.
1625
x = np.array([1, 2, 3])
1726
s = np.sum(x)
1827
19-
For more information please refer to `DPCtl's documentation <https://intelpython.github.io/dpctl>`_.
28+
For more information please refer to `Data Parallel Control Library`_
29+
documentation.
2030

2131
Example
22-
~~~~~~~
32+
-------
2333
.. literalinclude:: ../examples/example10.py
2434
:linenos:
2535
:language: python

doc/dpnp_backend_api.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,4 @@
44
C++ backend API Reference
55
*************************
66

7-
`DPNP C++ backend <backend_doc/>`_
7+
`C++ backend of Data Parallel Extension for NumPy* <backend_doc/>`_

doc/ext_links.txt

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
..
2+
**********************************************************
3+
THESE ARE EXTERNAL PROJECT LINKS USED IN THE DOCUMENTATION
4+
**********************************************************
5+
6+
.. _NumPy*: https://numpy.org/
7+
.. _Python* Array API Standard: https://data-apis.org/array-api/
8+
.. _OpenCl*: https://www.khronos.org/opencl/
9+
.. _oneAPI Level Zero: https://spec.oneapi.io/level-zero/latest/index.html
10+
.. _DPC++: https://www.apress.com/gp/book/9781484255735
11+
.. _SYCL*: https://www.khronos.org/sycl/
12+
.. _dpctl: https://intelpython.github.io/dpctl/latest/index.html
13+
.. _Data Parallel Control Library: https://intelpython.github.io/dpctl/latest/index.html
14+
.. _Intel oneAPI Base Toolkit: https://www.intel.com/content/www/us/en/developer/tools/oneapi/base-toolkit.html
15+
.. _Intel Distribution for Python*: https://www.intel.com/content/www/us/en/developer/tools/oneapi/distribution-for-python.html
16+
.. _Intel AI Analytics Toolkit: https://www.intel.com/content/www/us/en/developer/tools/oneapi/ai-analytics-toolkit.html

doc/index.rst

Lines changed: 12 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -1,37 +1,20 @@
1-
=========================================================
2-
DPNP -- A NumPy-compatible library for SYCL-based devices
3-
=========================================================
1+
.. _index:
2+
.. include:: ./ext_links.txt
43

5-
.. module:: dpnp
6-
7-
`DPNP <https://github.com/IntelPython/dpnp>`_ is a NumPy-like library accelerated with SYCL on Intel devices.
8-
It provides Python interfaces for many NumPy functions, and includes a subset of methods of :class:`dpnp.ndarray`.
9-
Under the hood it is based on native C++ and oneMKL based kernels.
10-
11-
Being drop-in replacement for Numpy its usage is very similar to Numpy:
12-
13-
>>> import dpnp as np
14-
15-
The :class:`dpnp.ndarray` class is a compatible alternative of :class:`numpy.ndarray`.
16-
17-
>>> x = np.array([1, 2, 3])
18-
19-
``x`` in the above example is an instance of :class:`dpnp.ndarray` that is created identically to ``NumPy``'s one.
20-
The key difference of :class:`dpnp.ndarray` from :class:`numpy.ndarray` is
21-
that the memory is allocated on Intel GPU when setting up ``DPNP_QUEUE_GPU=1`` in the environment.
4+
Data Parallel Extension for NumPy*
5+
==================================
226

23-
24-
Most of the array manipulations are also done in the way similar to NumPy such as:
25-
26-
>>> s = np.sum(x)
27-
28-
Please see the :ref:`API Reference <dpnp_reference>` for the complete list of supported NumPy APIs
29-
along with their limitations.
7+
.. module:: dpnp
308

319
.. toctree::
3210
:maxdepth: 2
3311

34-
install
12+
overview
13+
quick_start_guide
3514
reference/index
15+
16+
.. toctree::
17+
:maxdepth: 1
18+
:caption: Development information
19+
3620
dpnp_backend_api
37-
dpctl

doc/install.rst

Lines changed: 0 additions & 43 deletions
This file was deleted.

doc/overview.rst

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
.. _overview:
2+
.. include:: ./ext_links.txt
3+
4+
Overview
5+
========
6+
7+
.. module:: dpnp
8+
9+
The Data Parallel Extension for NumPy* (dpnp package) - a library that
10+
implements a subset of `NumPy*`_ that can be executed on any
11+
data parallel device. The subset is a drop-in replacement of core `NumPy*`_
12+
functions and numerical data types.
13+
14+
The Data Parallel Extension for NumPy* is being developed as part of
15+
`Intel AI Analytics Toolkit`_ and is distributed with the
16+
`Intel Distribution for Python*`_. The dpnp package is also available
17+
on Anaconda cloud. Please refer the :doc:`quick_start_guide` page to learn more.
18+
19+
Being drop-in replacement for `NumPy*`_ means that the usage is very similar:
20+
21+
>>> import dpnp as np
22+
23+
The :class:`dpnp.ndarray` class is a compatible alternative of
24+
:class:`numpy.ndarray`.
25+
26+
>>> x = np.array([1, 2, 3])
27+
28+
``x`` in the above example is an instance of :class:`dpnp.ndarray` that
29+
is created identically to ``NumPy*``'s one. The key difference of
30+
:class:`dpnp.ndarray` from :class:`numpy.ndarray` is that the memory
31+
is allocated on the default `SYCL*`_ device, which is a ``"gpu"`` on systems
32+
with integrated or discrete GPU (otherwise it is the ``"host"`` device
33+
on systems that do not have GPU).
34+
35+
Most of the array manipulations are also done in the way similar to `NumPy*`_ such as:
36+
37+
>>> s = np.sum(x)
38+
39+
Please see the :ref:`API Reference <dpnp_reference>` for the complete list of supported `NumPy*`_ APIs
40+
along with their limitations.

0 commit comments

Comments
 (0)