for loop and data in GPU memory
3 ビュー (過去 30 日間)
古いコメントを表示
If the for loop is parallelizable, does the Parallel Computing Toolbox execute for loop in a parallel fashion when it is acting on data stored in GPU memory?
2 件のコメント
Jill Reese
2012 年 11 月 8 日
It would be a bit easier to answer your question if you provided some sample code.
Thanks, Jill
採用された回答
Jill Reese
2012 年 11 月 9 日
The for loop is not performed in parallel when you write code like this:
A = gpuArray(X);
for i = 1:length(A)
B(i) = f(A(i));
end
However, if your function f contains only elementwise operations, then you could achieve more parallelism by using arrayfun like so:
B = arrayfun(@f, A);
0 件のコメント
その他の回答 (0 件)
参考
カテゴリ
Help Center および File Exchange で GPU Computing についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!