Skip to content
This repository was archived by the owner on Jan 12, 2026. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions docs/sources/programming_dpep.rst
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,9 @@ to execute your `Numpy*`_ script on GPU usually requires changing just a few lin
:caption: Your first NumPy code running on GPU
:name: ex_01_hello_dpnp

.. command-output:: python ./01-hello_dpnp.py
:cwd: ../../examples

In this example ``np.asarray()`` creates an array on the default `SYCL*`_ device, which is ``"gpu"`` on systems
with integrated or discrete GPU (it is ``"cpu"`` on systems that do not have GPU).
The queue associated with this array is now carried with ``x``, and ``np.sum(x)`` will derive it from ``x``,
Expand All @@ -54,6 +57,9 @@ In the following example we create the array ``x`` on the GPU device, and perfor
:caption: Select device type while creating array
:name: ex_02_dpnp_device

.. command-output:: python ./02-dpnp_device.py
:cwd: ../../examples

Data Parallel Extension for Numba - numba-dpex
**********************************************

Expand Down
5 changes: 3 additions & 2 deletions examples/02-dpnp_device.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,10 @@

import dpnp as np

x = np.empty(3)
try:
x = np.asarray([1, 2, 3], device=gpu)
x = np.asarray([1, 2, 3], device="gpu")
except:
print(GPU device is not available)
print("GPU device is not available")

y = np.sum(x)