mlu_places

paddle.static. mlu_places ( device_ids=None ) [source]
Note:

For multi-card tasks, please use FLAGS_selected_mlus environment variable to set the visible MLU device. This function creates a list of paddle.device.MLUPlace objects. If device_ids is None, environment variable of FLAGS_selected_mlus would be checked first. For example, if FLAGS_selected_mlus=0,1,2, the returned list would be [paddle.device.MLUPlace(0), paddle.device.MLUPlace(1), paddle.device.MLUPlace(2)]. If FLAGS_selected_mlus is not set, all visible mlu places would be returned. If device_ids is not None, it should be the device ids of MLUs. For example, if device_ids=[0,1,2], the returned list would be [paddle.device.MLUPlace(0), paddle.device.MLUPlace(1), paddle.device.MLUPlace(2)].

Parameters

device_ids (list or tuple of int, optional) – list of MLU device ids.

Returns

Created MLU place list.

Return type

list of paddle.device.MLUPlace

Examples

# required: mlu

import paddle
import paddle.static as static

paddle.enable_static()
mlu_places = static.mlu_places()