2つの行列の和のような簡単な計算をGPUで行っても高速化できないのはなぜですか?
Mostrar comentarios más antiguos
大きなサイズの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
Respuesta aceptada
Más respuestas (0)
Categorías
Más información sobre GPU 計算 en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!