- paddle.static. npu_places ( device_ids=None )
For multi-card tasks, please use FLAGS_selected_npus environment variable to set the visible NPU device.
This function creates a list of
device_idsis None, environment variable of
FLAGS_selected_npuswould be checked first. For example, if
FLAGS_selected_npus=0,1,2, the returned list would be [paddle.NPUPlace(0), paddle.NPUPlace(1), paddle.NPUPlace(2)]. If
FLAGS_selected_npusis not set, all visible npu places would be returned. If
device_idsis not None, it should be the device ids of NPUs. For example, if
device_ids=[0,1,2], the returned list would be [paddle.NPUPlace(0), paddle.NPUPlace(1), paddle.NPUPlace(2)].
device_ids (list or tuple of int, optional) – list of NPU device ids.
Created NPU place list.
- Return type
list of paddle.NPUPlace
# required: npu import paddle import paddle.static as static paddle.enable_static() npu_places = static.npu_places()