What is the best way to determine if a usable GPU is available?

조회 수: 1 (최근 30일)
Joseph Areeda
Joseph Areeda 2012년 11월 11일
I have an app that is used by many people in our collaboration some with GPU's and parallel toolbox and some without.
I can't seem to the find the canUseGPU() function that returns true if the parallel toolbox is loaded and a compatible GPU is available to the program.
I know it is probably simple and the problem is I'm probably too simple to find it.
Thanks, Joe

채택된 답변

Matt J
Matt J 2012년 11월 11일
Maybe this
try
gpuArray(1);
canUseGPU=true;
catch
canUseGPU=false;
end

추가 답변 (1개)

James Lebak
James Lebak 2012년 11월 16일
Hi Joe,
There is not presently a function called 'canUseGPU' in Parallel Computing Toolbox. Matt's answer will work. You could also use the function parallel.gpu.GPUDevice.isAvailable instead of gpuArray, e.g.
try
canUseGPU = parallel.gpu.GPUDevice.isAvailable;
catch ME
canUseGPU = false;
end
James
  댓글 수: 1
Joseph Areeda
Joseph Areeda 2012년 11월 16일
Thanks James,
What I ended up doing was putting try catch around the gpuDevice function and also checking if enough memory is available for my job.
As with most programming problems once you get it it's obvious.

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

카테고리

Help CenterFile Exchange에서 Parallel Computing Fundamentals에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by