cuda_places

paddle.fluid.cuda_places(device_ids=None)[source]
Note:

For multi-card tasks, please use FLAGS_selected_gpus environment variable to set the visible GPU device. The next version will fix the problem with CUDA_VISIBLE_DEVICES environment variable.

This function creates a list of fluid.CUDAPlace objects.

If device_ids is None, environment variable of FLAGS_selected_gpus would be checked first. For example, if FLAGS_selected_gpus=0,1,2, the returned list would be [fluid.CUDAPlace(0), fluid.CUDAPlace(1), fluid.CUDAPlace(2)]. If FLAGS_selected_gpus is not set, all visible gpu places would be returned according to the CUDA_VISIBLE_DEVICES environment variable.

If device_ids is not None, it should be the device ids of GPUs. For example, if device_ids=[0,1,2], the returned list would be [fluid.CUDAPlace(0), fluid.CUDAPlace(1), fluid.CUDAPlace(2)].

Parameters

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

Returns

Created GPU place list.

Return type

list of fluid.CUDAPlace

Examples

import paddle.fluid as fluid
cuda_places = fluid.cuda_places()