Detect when no GPU is selected
显示 更早的评论
In the documentation on gpuDevice() it says that,
"gpuDevice([]), with an empty argument (as opposed to no argument), deselects the GPU device and clears its memory of gpuArray and CUDAKernel variables. . This leaves no GPU device selected as the current device."
Is there a way to detect whether this 'no GPU' state is the current state? The intuitive way to check would be the following,
g=gpuDevice;
isempty(g.Index)
This does not work, however, because a call to gpuDevice with no input arguments always results in the selection of a device. Thus, g.Index can never be empty.
采纳的回答
更多回答(0 个)
类别
在 帮助中心 和 File Exchange 中查找有关 GPU Computing in MATLAB 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!