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.

System Message: WARNING/2 (/usr/local/lib/python3.8/site-packages/paddle/fluid/framework.py:docstring of paddle.fluid.framework.xpu_places, line 3)

Definition list ends without a blank line; unexpected unindent.

This function creates a list of paddle.XPUPlace objects. If device_ids is None, environment variable of FLAGS_selected_xpus would be checked first. For example, if FLAGS_selected_xpus=0,1,2, the returned list would be [paddle.XPUPlace(0), paddle.XPUPlace(1), paddle.XPUPlace(2)]. If FLAGS_selected_xpus is not set, all visible xpu places would be returned. If device_ids is not None, it should be the device ids of XPUs. For example, if device_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.enable_static()
xpu_places = static.xpu_places()