|
1 | 1 | .. _routines.exceptions: |
2 | 2 |
|
| 3 | +.. py:module:: dpnp.exceptions |
| 4 | +
|
3 | 5 | Exceptions and Warnings |
4 | 6 | ======================= |
5 | 7 |
|
6 | 8 | General exceptions used by DPNP. Note that some exceptions may be module |
7 | 9 | specific, such as linear algebra errors. |
8 | 10 |
|
9 | | -.. currentmodule:: dpnp.exceptions |
10 | | - |
11 | 11 | Exceptions |
12 | 12 | ---------- |
13 | 13 |
|
14 | | -.. data:: AxisError |
| 14 | +.. exception:: AxisError |
| 15 | + |
| 16 | + Given when an axis is invalid. |
| 17 | + |
| 18 | +.. exception:: DLPackCreationError |
15 | 19 |
|
16 | | - Given when an axis is invalid. |
| 20 | + Given when constructing DLPack capsule from either :class:`dpnp.ndarray` or |
| 21 | + :class:`dpctl.tensor.usm_ndarray` based on a USM allocation |
| 22 | + on a partitioned SYCL device. |
17 | 23 |
|
18 | | -.. data:: DLPackCreationError |
| 24 | + .. rubric:: Examples |
19 | 25 |
|
20 | | - Given when constructing DLPack capsule from either :class:`dpnp.ndarray` or |
21 | | - :class:`dpctl.tensor.usm_ndarray` based on a USM allocation |
22 | | - on a partitioned SYCL device. |
| 26 | + .. code-block:: python |
23 | 27 |
|
24 | | - .. rubric:: Examples |
| 28 | + >>> import dpnp as np |
| 29 | + >>> import dpctl |
| 30 | + >>> dev = dpctl.SyclDevice('cpu') |
| 31 | + >>> sdevs = dev.create_sub_devices(partition=[1, 1]) |
| 32 | + >>> q = dpctl.SyclQueue(sdevs[0]) |
| 33 | + >>> x = np.ones(10, sycl_queue=q) |
| 34 | + >>> np.from_dlpack(x) |
| 35 | + Traceback (most recent call last): |
| 36 | + ... |
| 37 | + DLPackCreationError: to_dlpack_capsule: DLPack can only export arrays based on USM allocations bound to a default platform SYCL context |
25 | 38 |
|
26 | | - .. code-block:: python |
| 39 | +.. exception:: ExecutionPlacementError |
27 | 40 |
|
28 | | - >>> import dpnp as np |
29 | | - >>> import dpctl |
30 | | - >>> dev = dpctl.SyclDevice('cpu') |
31 | | - >>> sdevs = dev.create_sub_devices(partition=[1, 1]) |
32 | | - >>> q = dpctl.SyclQueue(sdevs[0]) |
33 | | - >>> x = np.ones(10, sycl_queue=q) |
34 | | - >>> np.from_dlpack(x) |
35 | | - Traceback (most recent call last): |
36 | | - ... |
37 | | - DLPackCreationError: to_dlpack_capsule: DLPack can only export arrays based on USM allocations bound to a default platform SYCL context |
| 41 | + Given when execution placement target can not be unambiguously determined |
| 42 | + from input arrays. Make sure that input arrays are associated with the same |
| 43 | + :class:`dpctl.SyclQueue`, or migrate data to the same |
| 44 | + :class:`dpctl.SyclQueue` using :meth:`dpnp.ndarray.to_device` method. |
38 | 45 |
|
39 | | -.. data:: ExecutionPlacementError |
| 46 | +.. exception:: SyclContextCreationError |
40 | 47 |
|
41 | | - Given when execution placement target can not be unambiguously determined |
42 | | - from input arrays. Make sure that input arrays are associated with the same |
43 | | - :class:`dpctl.SyclQueue`, or migrate data to the same |
44 | | - :class:`dpctl.SyclQueue` using :meth:`dpnp.ndarray.to_device` method. |
| 48 | + Given when :class:`dpctl.SyclContext` instance could not be created. |
45 | 49 |
|
46 | | -.. data:: SyclContextCreationError |
| 50 | +.. exception:: SyclDeviceCreationError |
47 | 51 |
|
48 | | - Given when :class:`dpctl.SyclContext` instance could not be created. |
| 52 | + Given when :class:`dpctl.SyclDevice` instance could not be created. |
49 | 53 |
|
50 | | -.. data:: SyclDeviceCreationError |
| 54 | +.. exception:: SyclQueueCreationError |
51 | 55 |
|
52 | | - Given when :class:`dpctl.SyclDevice` instance could not be created. |
| 56 | + Given when :class:`dpctl.SyclQueue` instance could not be created. |
| 57 | + The creation can fail if the filter string is invalid, or the backend or |
| 58 | + device type values are not supported. |
53 | 59 |
|
54 | | -.. data:: SyclQueueCreationError |
| 60 | +.. exception:: USMAllocationError |
55 | 61 |
|
56 | | - Given when :class:`dpctl.SyclQueue` instance could not be created. |
57 | | - The creation can fail if the filter string is invalid, or the backend or |
58 | | - device type values are not supported. |
| 62 | + Given when Unified Shared Memory (USM) allocation call returns a null |
| 63 | + pointer, signaling a failure to perform the allocation. |
| 64 | + Some common reasons for allocation failure are: |
59 | 65 |
|
60 | | -.. data:: USMAllocationError |
| 66 | + * insufficient free memory to perform the allocation request |
| 67 | + * allocation size exceeds the maximum supported by targeted backend |
61 | 68 |
|
62 | | - Given when Unified Shared Memory (USM) allocation call returns a null |
63 | | - pointer, signaling a failure to perform the allocation. |
64 | | - Some common reasons for allocation failure are: |
65 | 69 |
|
66 | | - * insufficient free memory to perform the allocation request |
67 | | - * allocation size exceeds the maximum supported by targeted backend |
| 70 | +.. automodule:: dpnp.exceptions |
| 71 | + :no-index: |
0 commit comments