Disable the gpu.

조회 수: 38(최근 30일)
María del Carmen Salas Casas
María del Carmen Salas Casas 2023년 1월 13일
댓글: Joss Knight 2023년 1월 15일
Good morning,
I have matlab version 2022b and I would like to disable the system GPU from the matlab application so that it does not recognise it and runs the programs only using the cpu. Could you tell me if it is possible to do it and how to do it? I would like to do it from the application itself, as disabling the gpu from the system is more laborious and I just want matlab to not recognise it.
Thank you.


Joss Knight
Joss Knight 2023년 1월 15일
As soon as you start MATLAB type
MATLAB will no longer recognise any GPU for computation.
  댓글 수: 2
Joss Knight
Joss Knight 2023년 1월 15일
This is a variable recognised by the CUDA driver and only checked when the driver is initialized, which happens the first time you use or query the GPU. So correct, there is no way to reset this without restarting MATLAB. Alternatively, use a process pool which can be stopped and restarted at will.

댓글을 달려면 로그인하십시오.

Luca Ferro
Luca Ferro 2023년 1월 13일
the command:
should do the trick.
Mind that it requires that the Parallel Computing Toolbox is installed.
For more informations you can check here
  댓글 수: 1
Walter Roberson
Walter Roberson 2023년 1월 13일
If you have code along the lines of
if gpu is detected
run deep learning on gpu
run deep learning on cpu
and you want to calculate the timings both ways without changing the detection test... then selecting the empty gpu is probably not going to be enough. But it would depend on how the gpu detection is coded.

댓글을 달려면 로그인하십시오.

Matt J
Matt J 2023년 1월 13일
편집: Matt J 2023년 1월 13일
Matlab will use the CPU by default unless you have in some way told it to use the GPU for a specific computation.
An exception might be the trainNetwork and predict commands, if you are doing DNN training or inference. Those commands have an option, however, called ExecutionEnvironment that you can use to specify CPU-only computation.

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by