sigpy.Device¶
-
class
sigpy.
Device
(id_or_device)[source]¶ Device class.
This class extends cupy.Device, with id > 0 representing the id_th GPU, and id = -1 representing CPU. cupy must be installed to use GPUs.
The array module for the corresponding device can be obtained via .xp. Similar to cupy.Device, the Device object can be used as a context:
>>> device = Device(2) >>> xp = device.xp # xp is cupy. >>> with device: >>> x = xp.array([1, 2, 3]) >>> x += 1
Parameters: id_or_device (int or Device or cupy.cuda.Device) – id > 0 represents the corresponding GPUs, and id = -1 represents CPU. -
id
¶ id = -1 represents CPU, and others represents the id_th GPUs.
Type: int
Methods
__init__
(id_or_device)Initialize self. use
()Use computing device. Attributes
xp
numpy or cupy module for the device. -