2つの行列の和のような簡単な計算をGPUで行っても高速化できないのはなぜですか?
Ältere Kommentare anzeigen
大きなサイズの2つの行列をRANDNで作成し、それらの和を求める計算の所要時間を計測しましたが、CPUで計算した場合とGPUで計算した場合で大きな違いはありませんでした。
CPUでの計算のためのプログラムは以下の通りです。
size = 10000;
tic
x = rand(size);
y = rand(size);
z = x + y;
toc
一方、GPUでの計算のためのプログラムは以下の通りです。
size = 10000;
tic
xm = gpuArray(rand(size));
ym = gpuArray(rand(size));
zm = xm + ym;
toc
Akzeptierte Antwort
Weitere Antworten (0)
Kategorien
Mehr zu GPU 計算 finden Sie in Hilfe-Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!