- paddle.fluid.framework. xpu_places ( device_ids=None )
For multi-card tasks, please use FLAGS_selected_xpus environment variable to set the visible XPU device.
This function creates a list of
device_idsis None, environment variable of
FLAGS_selected_xpuswould 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_xpusis not set, all visible xpu places would be returned. If
device_idsis 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)].
device_ids (list or tuple of int, optional) – list of XPU device ids.
Created XPU place list.
- Return type
list of paddle.XPUPlace
import paddle import paddle.static as static paddle.enable_static() xpu_places = static.xpu_places()