get_available_device

paddle.device. get_available_device ( ) [source]

Get all available devices.

Returns

A list of all available devices.

Examples

>>> import paddle
>>> paddle.device.get_available_device()

>>> # Case 1: paddlepaddle-cpu package installed, and no custom device registered.
>>> # Output: ['cpu']

>>> # Case 2: paddlepaddle-gpu package installed, and no custom device registered.
>>> # Output: ['cpu', 'gpu:0', 'gpu:1']

>>> # Case 3: paddlepaddle-cpu package installed, and custom device 'CustomCPU' is registered.
>>> # Output: ['cpu', 'CustomCPU']

>>> # Case 4: paddlepaddle-gpu package installed, and custom device 'CustomCPU' and 'CustomGPU' is registered.
>>> # Output: ['cpu', 'gpu:0', 'gpu:1', 'CustomCPU', 'CustomGPU:0', 'CustomGPU:1']