%% Identify and Select a GPU Device
% This example shows how to use gpuDevice to identify and select which device you want to use.
% To determine how many GPU devices are available in your computer, use the gpuDeviceCount function.

gpuDeviceCount("available")

%
% When there are multiple devices, the first is the default. You can examine its properties with the gpuDeviceTable function to determine if that is the one you want to use.

gpuDeviceTable

% If the first device is the device you want to use, you can proceed. To run computations on the GPU, use gpuArray enabled functions. For more information, see Run MATLAB Functions on a GPU.
% To use another device, call gpuDevice with the index of the other device.

gpuDevice(2)

% Copyright 2020 The MathWorks, Inc.