xpu_places¶
- paddle.static. xpu_places ( device_ids=None ) [source]
-
- Note:
-
For multi-card tasks, please use FLAGS_selected_xpus environment variable to set the visible XPU device. This function creates a list of
paddle.XPUPlace
objects. Ifdevice_ids
is None, environment variable ofFLAGS_selected_xpus
would be checked first. For example, ifFLAGS_selected_xpus=0,1,2
, the returned list would be [paddle.XPUPlace(0), paddle.XPUPlace(1), paddle.XPUPlace(2)]. IfFLAGS_selected_xpus
is not set, all visible xpu places would be returned. Ifdevice_ids
is not None, it should be the device ids of XPUs. For example, ifdevice_ids=[0,1,2]
, the returned list would be [paddle.XPUPlace(0), paddle.XPUPlace(1), paddle.XPUPlace(2)].
- Parameters
-
device_ids (list or tuple of int, optional) – list of XPU device ids.
- Returns
-
Created XPU place list.
- Return type
-
list of paddle.XPUPlace
Examples
>>> >>> import paddle >>> import paddle.static as static >>> paddle.device.set_device('xpu') >>> paddle.enable_static() >>> xpu_places = static.xpu_places()