How do I make this code GPU capable

조회 수: 2 (최근 30일)
Mark Storrings
Mark Storrings 2017년 11월 15일
답변: Tony Mohan Varghese 2017년 11월 29일
We are trying to take advantage of the GPU for increase processing speed. As a test, we are trying to convert the following code to utilize the GPU:
clear all; close all; clc;
variables =1000; data = 60;
X = rand(variables, data);
Y = rand(data, 1);
distcomp.feature( 'LocalUseMpiexec', false ); delete(gcp('nocreate')); parpool(4); pctRunOnAll warning('off','all')
disp('CPU started'); tic;
parfor j= [1:variables]
mdl = fitlm( X([ j ],:) , Y , 'linear','RobustOpts','off');
Rsq(j) = mdl.Rsquared.Adjusted;
Rmse(j) =mdl.RMSE;
end
toc
disp('CPU ended');
Any assistance would be greatly appreciated.
  댓글 수: 1
Matt J
Matt J 2017년 11월 16일
편집: Matt J 2017년 11월 16일
It doesn't look to me like it would benefit from the GPU. Parfor is a good choice for the operations that you've shown.

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

답변 (1개)

Tony Mohan Varghese
Tony Mohan Varghese 2017년 11월 29일
Refer to GPU Capabilities and performance in MATLAB Documentation :
There are built in functions that you can use to improve your code :

카테고리

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

태그

Community Treasure Hunt

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

Start Hunting!

Translated by