How can I stop Matlab from using dedicated GPU in laptop?
Show older comments
I can't stop Matlab from using my dGPU even after I've set Nvidia's program to use "Integrated Graphics". I was thinking that Matlab enables the Nvidia chip anyway, because it has CUDA support?
Setup: Matlab 2015a, Win7 x64, Intel HD4600 + Nvidia GTX970M
Regards Martin
1 Comment
Walter Roberson
on 14 Jan 2017
Are you using any of the gpu functions such as gpuArray() ? Those can only be executed on the NVIDIA; there is no GPU support for any other manufacturer.
Answers (2)
TJ Smith
on 7 Jan 2018
You can turn off the GPU with this code:
gpuDevice([]);
I found this on this page: https://www.mathworks.com/help/distcomp/gpudevice.html which described it as:
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.
Adam
on 21 Apr 2015
doc gpuDevice
You should be able to get a list of GPU devices with
g = gpuDevice;
Then select a particular device from that list by its index:
D = gpuDevice(idx)
5 Comments
Martin Jensen
on 21 Apr 2015
Edited: Martin Jensen
on 21 Apr 2015
Edric Ellis
on 21 Apr 2015
I'm not quite sure why you'd want to do that though - MATLAB doesn't automatically perform any numeric computations on the GPU, it only uses it if you explicitly put data there using gpuArray...
Ryan
on 21 Jun 2016
The reason one might want to do that—because the user mentioned laptop—may be that this person is looking for a way for matlab not to mark itself as potentially using the GPU for the mac os operating system. On laptops, that can automatically switch on high performance computing mode, which turns on more energy expensive GPU chip. It's power saving to have high perf mode off.
Yetti
on 13 Jan 2017
Also, on a microsoft Surface Book, the dGPU is in the keyboard base. Detaching the screen requires quiting matlab when matlab grabs the dGPU automatically.
Kenz Dale
on 18 Jan 2018
Frustratingly, this command is only available if you have the Parallel Computing Toolbox. So I can't detach my Surface Book 2's screen unless I quit Matlab. This is bonkers, as one of the primary reasons I moved from macOS to Windows was to leverage the awesome power of the Surface Book.
Categories
Find more on GPU Computing in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!