18
18
19
19
class Device :
20
20
"""
21
- Class representing Data-API concept of Device
21
+ Class representing Data-API concept of device.
22
22
23
- This is a wrapper around `dpctl.SyclQueue` with custom
23
+ This is a wrapper around :class: `dpctl.SyclQueue` with custom
24
24
formatting. The class does not have public constructor,
25
25
but a class method to construct it from device= keyword
26
26
in Array-API functions.
27
27
28
- Instance can be queries for `sycl_queue`, `sycl_context`,
29
- or `sycl_device`
28
+ Instance can be queried for `` sycl_queue`` , `` sycl_context` `,
29
+ or `` sycl_device``.
30
30
"""
31
31
32
32
def __new__ (cls , * args , ** kwargs ):
33
33
raise TypeError ("No public constructor" )
34
34
35
35
@classmethod
36
36
def create_device (cls , dev ):
37
+ """
38
+ Device.create_device(device)
39
+
40
+ Creates instance of Device from argument.
41
+
42
+ Args:
43
+ device: None, :class:`.Device`, :class:`dpctl.SyclQueue`, or
44
+ a :class:`dpctl.SyclDevice` corresponding to a root
45
+ SYCL device.
46
+ Raises:
47
+ ValueError: if an instance of :class:`dpctl.SycDevice` corresponding
48
+ to a sub-device was specified as the argument
49
+ SyclQueueCreationError: if :class:`dpctl.SyclQueue` could not be
50
+ created from the argument
51
+ """
37
52
obj = super ().__new__ (cls )
38
53
if isinstance (dev , Device ):
39
54
obj .sycl_queue_ = dev .sycl_queue
@@ -55,14 +70,23 @@ def create_device(cls, dev):
55
70
56
71
@property
57
72
def sycl_queue (self ):
73
+ """
74
+ :class:`dpctl.SyclQueue` used to offload to this :class:`.Device`.
75
+ """
58
76
return self .sycl_queue_
59
77
60
78
@property
61
79
def sycl_context (self ):
80
+ """
81
+ :class:`dpctl.SyclContext` associated with this :class:`.Device`.
82
+ """
62
83
return self .sycl_queue_ .sycl_context
63
84
64
85
@property
65
86
def sycl_device (self ):
87
+ """
88
+ :class:`dpctl.SyclDevice` targed by this :class:`.Device`.
89
+ """
66
90
return self .sycl_queue_ .sycl_device
67
91
68
92
def __repr__ (self ):
0 commit comments