Skip to content

Commit 0de1218

Browse files
Merge pull request #712 from IntelPython/docs/user-guide
2 parents ccd21b6 + 94d4079 commit 0de1218

21 files changed

+610
-74
lines changed

.github/workflows/generate-docs.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ jobs:
4949
if: ${{ !github.event.pull_request || github.event.action != 'closed' }}
5050
shell: bash -l {0}
5151
run: |
52-
pip install numpy cython setuptools sphinx sphinx_rtd_theme pydot graphviz
52+
pip install numpy cython setuptools sphinx sphinx_rtd_theme pydot graphviz sphinxcontrib-programoutput
5353
- name: Checkout repo
5454
uses: actions/checkout@v2
5555
with:

docs/conf.in

Lines changed: 34 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,43 @@
1+
# Data Parallel Control (dpctl)
2+
#
3+
# Copyright 2020-2021 Intel Corporation
4+
#
5+
# Licensed under the Apache License, Version 2.0 (the "License");
6+
# you may not use this file except in compliance with the License.
7+
# You may obtain a copy of the License at
8+
#
9+
# http://www.apache.org/licenses/LICENSE-2.0
10+
#
11+
# Unless required by applicable law or agreed to in writing, software
12+
# distributed under the License is distributed on an "AS IS" BASIS,
13+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
# See the License for the specific language governing permissions and
15+
# limitations under the License.
16+
117
#!/usr/bin/env python3
218
# -*- coding: utf-8 -*-
319

420
# If extensions (or modules to document with autodoc) are in another directory,
521
# add these directories to sys.path here. If the directory is relative to the
622
# documentation root, use os.path.abspath to make it absolute, like shown here.
723
#
8-
# import os
9-
# import sys
10-
# sys.path.insert(0, os.path.abspath('.'))
24+
import os
25+
import sys
26+
1127
from docutils.parsers.rst import directives
1228
from sphinx.ext.autosummary import Autosummary, get_documenter
1329
from sphinx.util.inspect import safe_getattr
1430

1531
import dpctl
1632

33+
sys.path.insert(0, os.path.abspath("."))
34+
35+
import extlinks_gen as urlgen
36+
1737
# -- Project information -----------------------------------------------------
1838

1939
project = "Data-parallel Control (dpctl)"
20-
copyright = "2020, Intel Corp."
40+
copyright = "2020-21, Intel Corp."
2141
author = "Intel Corp."
2242

2343
version = dpctl.__version__.strip(".dirty")
@@ -31,13 +51,15 @@ release = dpctl.__version__.strip(".dirty")
3151
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
3252
# ones.
3353
extensions = [
34-
"sphinx.ext.todo",
35-
"sphinx.ext.coverage",
36-
"sphinx.ext.viewcode",
37-
"sphinx.ext.githubpages",
3854
"sphinx.ext.autodoc",
3955
"sphinx.ext.autosummary",
56+
"sphinx.ext.coverage",
57+
"sphinx.ext.extlinks",
58+
"sphinx.ext.githubpages",
4059
"sphinx.ext.napoleon",
60+
"sphinx.ext.todo",
61+
"sphinx.ext.viewcode",
62+
"sphinxcontrib.programoutput",
4163
]
4264

4365
todo_include_todos = True
@@ -209,3 +231,7 @@ class AutoAutoSummary(Autosummary):
209231

210232
def setup(app):
211233
app.add_directive("autoautosummary", AutoAutoSummary)
234+
235+
236+
# A dictionary of urls
237+
extlinks = urlgen.create_extlinks()

docs/docfiles/intro.rst

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,9 @@ Welcome to Data-parallel Control (dpctl)'s documentation!
22
=========================================================
33

44
The data-parallel control (dpctl) library provides C and Python bindings for
5-
`SYCL 2020 <https://www.khronos.org/registry/SYCL/specs/sycl-2020/html/sycl-2020.html>`_.
6-
The SYCL 2020 features supported by dpctl are limited to those included by
7-
Intel's DPCPP compiler and specifically cover the SYCL runtime classes described
8-
in `Section 4.6 <https://www.khronos.org/registry/SYCL/specs/sycl-2020/html/sycl-2020.html#_sycl_runtime_classes>`_
5+
:sycl_spec_2020:`SYCL 2020 <>`. The SYCL 2020 features supported by dpctl are
6+
limited to those included by Intel's DPCPP compiler and specifically cover the
7+
SYCL runtime classes described in :sycl_runtime_classes:`Section 4.6 <>`
98
of the SYCL 2020 specification. Apart from the bindings for these runtime
109
classes, dpctl includes bindings for SYCL USM memory allocators and
1110
deallocators. Dpctl's Python API provides classes that implement

docs/docfiles/urls.json

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
{
2+
"dpcpp_envar": "https://github.com/intel/llvm/blob/sycl/sycl/doc/EnvironmentVariables.md",
3+
"numa_domain": "https://en.wikipedia.org/wiki/Non-uniform_memory_access",
4+
"oneapi": "https://www.oneapi.io/",
5+
"oneapi_filter_selection": "https://github.com/intel/llvm/blob/sycl/sycl/doc/extensions/FilterSelector/FilterSelector.adoc",
6+
"sycl_aspects": "https://www.khronos.org/registry/SYCL/specs/sycl-2020/html/sycl-2020.html#table.device.aspect",
7+
"sycl_context": "https://sycl.readthedocs.io/en/latest/iface/context.html",
8+
"sycl_device": "https://sycl.readthedocs.io/en/latest/iface/device.html",
9+
"sycl_device_info": "https://www.khronos.org/registry/SYCL/specs/sycl-2020/html/sycl-2020.html#_device_information_descriptors",
10+
"sycl_device_selector": "https://sycl.readthedocs.io/en/latest/iface/device-selector.html",
11+
"sycl_event": "https://sycl.readthedocs.io/en/latest/iface/event.html",
12+
"sycl_platform": "https://sycl.readthedocs.io/en/latest/iface/platform.html",
13+
"sycl_queue": "https://sycl.readthedocs.io/en/latest/iface/queue.html",
14+
"sycl_runtime_classes": "https://www.khronos.org/registry/SYCL/specs/sycl-2020/html/sycl-2020.html#_sycl_runtime_classes",
15+
"sycl_spec_2020": "https://www.khronos.org/registry/SYCL/specs/sycl-2020/html/sycl-2020.html"
16+
}

docs/docfiles/urls.rst

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

docs/docfiles/user_guides/QuickStart.rst

Lines changed: 22 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,8 @@
44
Quick Start Guide
55
#################
66

7-
8-
.. contents:: Table of contents
9-
:local:
10-
:backlinks: none
11-
:depth: 3
12-
137
Installing from oneAPI
14-
----------------------
8+
======================
159

1610
Dpctl is available as part of the oneAPI Intel Distribution of Python (IDP).
1711
Please follow `oneAPI installation guide`_ to install oneAPI. In this quick
@@ -50,7 +44,7 @@ On Windows
5044
`GPU driver installation guide`_.
5145

5246
Install Wheel package from Pypi
53-
-------------------------------
47+
===============================
5448

5549
Dpctl can also be istalled from Pypi.
5650

@@ -79,20 +73,21 @@ On Windows
7973
set PATH=<path_to_your_env>\bin;<path_to_your_env>\Library\bin;%PATH%
8074
8175
Building from source
82-
--------------------
76+
====================
8377

8478
To build dpctl from source, we need dpcpp and GPU drivers (and optionally CPU
8579
OpenCL drivers). It is preferable to use the dpcpp compiler packaged as part of
8680
oneAPI. However, it is possible to use a custom build of dpcpp to build dpctl,
8781
especially if you want to enable CUDA support.
8882

8983
Building using oneAPI dpcpp
90-
~~~~~~~~~~~~~~~~~~~~~~~~~~~
84+
---------------------------
9185

9286
As before, oneAPI and graphics drivers should be installed on the system prior
9387
to proceeding further.
9488

95-
**Activate oneAPI as follows**
89+
Activate oneAPI as follows
90+
~~~~~~~~~~~~~~~~~~~~~~~~~~
9691

9792
On Linux
9893

@@ -106,7 +101,8 @@ On Windows
106101
107102
call "%ONEAPI_ROOT%\setvars.bat"
108103
109-
**Build and install using conda-build**
104+
Build and install using conda-build
105+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
110106

111107
The conda-recipe included with the sources can be used to build the dpctl
112108
package. The advantage of this approach is that all dependencies are pulled in
@@ -136,7 +132,9 @@ After building the conda package you may install it by executing:
136132
You could face issues with conda-build version 3.20. Use conda-build
137133
3.18 instead.
138134

139-
**Build and Install with setuptools**
135+
136+
Build and install with setuptools
137+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
140138

141139
To build using Python ``setuptools``, the following packages should be
142140
installed:
@@ -164,13 +162,13 @@ to build and install
164162
python setup.py develop
165163
166164
Building using custom dpcpp
167-
~~~~~~~~~~~~~~~~~~~~~~~~~~~
165+
---------------------------
168166

169167
It is possible to build dpctl from source using .. _DPC++ toolchain: https://github.com/intel/llvm/blob/sycl/sycl/doc/GetStartedGuide.md
170168
instead of the DPC++ compiler that comes with oneAPI. One reason for doing this
171169
may be to enable support for CUDA devices.
172170

173-
Following steps in :ref:`Build and Install with setuptools` use command line
171+
Following steps in `Build and install with setuptools`_ use command line
174172
option :code:`--sycl-compiler-prefix`, for example:
175173

176174
.. code-block:: bash
@@ -181,7 +179,7 @@ Available options and their descriptions can be retrieved using option
181179
:code:`--help`.
182180

183181
Using dpctl
184-
-----------
182+
===========
185183

186184
Dpctl requires a DPC++ runtime. When dpctl is installed via conda then it uses
187185
the DPC++ runtime from ``dpcpp_cpp_rt`` package that is part of IDP. When using
@@ -190,10 +188,10 @@ the system. The easiest way to setup a DPC++ runtime will be by activating
190188
oneAPI.
191189

192190
Running examples and tests
193-
--------------------------
191+
==========================
194192

195193
Running the examples
196-
~~~~~~~~~~~~~~~~~~~~
194+
--------------------
197195

198196
After setting up dpctl you can try out the Python examples as follows:
199197

@@ -213,7 +211,7 @@ located under *examples/cython*. Each example in the folder can be built using
213211
examples.
214212

215213
Running the Python tests
216-
~~~~~~~~~~~~~~~~~~~~~~~~
214+
------------------------
217215

218216
The dpctl Python test suite can be executed as follows:
219217

@@ -222,14 +220,13 @@ The dpctl Python test suite can be executed as follows:
222220
pytest --pyargs dpctl
223221
224222
225-
Building the C API shared library
226-
---------------------------------
223+
Building the DPCTLSyclInterface library
224+
=======================================
227225

228-
The dpctl C API is a shared library called libDPCTLSyclInterface and is built
229-
together when build the Python package. However, it is possible to only build
230-
the C API as a standalone library. To do so, you will need ``cmake``,
226+
The libDPCTLSyclInterface is a shared library used by the Python package.
227+
To build the library you will need ``DPC++`` toolchain, ``cmake``,
231228
``ninja`` or ``make``, and optionally ``gtest 1.10`` if you wish to run the
232-
C API test suite.
229+
test suite.
233230

234231
For example, on Linux the following script can be used to build the C oneAPI
235232
library.
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
.. _user_manual:
2+
3+
###########
4+
User Manual
5+
###########
6+
7+
.. toctree::
8+
:maxdepth: 3
9+
10+
manual/dpctl/intro
Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
.. _basic_concepts:
2+
3+
Basic Concepts
4+
==============
5+
6+
The section introduces the basic concepts for XPU management used by dpctl.
7+
As dpctl is based on SYCL the concepts should be familiar to users with prior
8+
experience with SYCL. However, users of dpctl need not have any prior experience
9+
with SYCL and the concepts presented here should be self-sufficient. We do not
10+
go into all the SYCL-level details here and if needed readers should refer to a
11+
more topical SYCL reference such as the :sycl_spec_2020:`SYCL 2020 spec <>`.
12+
13+
* **Heterogeneous computing**
14+
Refers to using multiple devices in a program.
15+
16+
* **Host**
17+
Every program starts by running on a host, and most of the lines of code in
18+
a program, in particular lines of code implementing the Python interpreter
19+
itself, are usually for the host. Hosts are customarily CPUs.
20+
21+
* **Device**
22+
A device is an XPU connected to a host that is programmable with a specific
23+
device driver. Different types of devices can have different architectures
24+
(CPUs, GPUs, FPGA, ASICs, DSP), but are programmable using the same
25+
:oneapi:`oneAPI <>` programming model.
26+
27+
* **Platform**
28+
A device driver installed on the system is termed as a platform. As multiple
29+
devices of the same type can share the same device driver, a platform may
30+
contain multiple devices. Note that the same physical hardware (say, a GPU)
31+
may be reflected as two separate devices if they can be programmed by more
32+
than one platform, *e.g.*, the same GPU hardware can be listed as an
33+
OpenCL GPU device and a Level-Zero GPU device.
34+
35+
* **Context**
36+
A context holds the run-time information needed to operate on a device or a
37+
group of devices from the same platform. Contexts are relatively expensive
38+
to create and should be reused as much as possible.
39+
40+
* **Queue**
41+
A queue is needed to schedule execution of any computation, or data
42+
copying on the device. Queue construction requires specifying a device
43+
and a context targeting that device as well as additional properties,
44+
such as whether profiling information should be collected or whether submitted
45+
tasks are executed in the order in which they were submitted.
46+
47+
* **Event**
48+
An event holds information related to computation/data movement operation
49+
scheduled for execution on a queue, such as its execution status as well
50+
as profiling information if the queue the task was submitted to allowed
51+
for collection of such information. Events can be used to specify task
52+
dependencies as well as to synchronize host and devices.
53+
54+
* **USM**
55+
Unified Shared Memory (USM) refers to pointer based device memory management.
56+
USM allocations are bound to context. In other words, a pointer representing
57+
USM allocation can be unambiguously mapped to the data it represents only
58+
if the associated context is known. USM allocations are accessible by
59+
computational kernels that are executed on a device, provided that the
60+
allocation is bound to the same context that was used to construct the queue
61+
where the kernel was scheduled for execution.
62+
63+
Depending on the capability of the device, USM allocations can be a "device"
64+
allocation, a "shared" allocation, or a "host" allocation. A "device"
65+
allocation is not accessible from host, while "shared" or "host" allocations
66+
are. "Host" allocation refers to an allocation in host memory that is
67+
accessible from a device.
68+
69+
"Shared" allocations are accessible by both host and device. Runtime manages
70+
synchronization of host's and device's view into shared allocations. Initial
71+
placement of the shared allocations is not defined.
72+
73+
* **Backend**
74+
Refers to an implementation of :oneapi:`oneAPI <>` programming model exposed
75+
by the underlying runtime.

0 commit comments

Comments
 (0)