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 Center および File ExchangeGPU Computing in MATLAB についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by