フィルターのクリア

GPU time slower than CPU

1 回表示 (過去 30 日間)
Tiki Tiki
Tiki Tiki 2018 年 7 月 20 日
コメント済み: Joss Knight 2018 年 7 月 21 日
Hi everyone
Can you explain to me my code about gpu time?.
why gpu time is slower than CPU time.
this is my code:
tic
n = 4096;
m = 1000;
A1 = ones(1,m);
B1 = 2*ones(m,n);
C1 = sum(A1*B1);
% wait(gpu)
toc
tic
n = 4096;
m = 1000;
A2 = ones(1,m);
B2 = 2*ones(m,n);
C2 = sum(sum(bsxfun(@times,A2',B2)));
% wait(gpu)
toc
tic
n = 4096;
m = 1000;
A3 = gpuArray(ones(1,m));
B3 = gpuArray(2*ones(m,n));
C3 = sum(A3*B3);
% CB = sum(bsxfun(@times,AB',BB));
% wait(gpu)
toc
Thank
  1 件のコメント
Joss Knight
Joss Knight 2018 年 7 月 21 日
Can you double-check your code? Because you're not actually doing the same thing on the GPU. For instance, you do a matrix multiplication on the GPU that you don't do on the CPU. The results aren't even the same dimensions.

サインインしてコメントする。

回答 (0 件)

カテゴリ

Help Center および File ExchangeGPU Computing についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by