tf = canUseGPU()
| Parameter | Description |
|---|---|
| tf | logical: true when a compatible GPU device is available. |
tf = canUseGPU() returns true when a compatible GPU device is present and usable, and false otherwise (for example on a machine without a supported Vulkan, Metal or Direct3D 12 backend).
Use it to write code that runs on the GPU when possible and falls back to the CPU otherwise.
if canUseGPU()
A = gpuArray(single(rand(1000)));
else
A = single(rand(1000));
end
| Version | Description |
|---|---|
| 2.0.0 | initial version |