Matlab + CUDA slow in solving matrix-vector equation A*x=B
8 views (last 30 days)
I am calculating an equation A*x=B, where A is a matrix and B is a vector, x is answer (unknown) vector.
Hardware specs: Intel i7 3630QM (4 cores), nVidia GeForce GT 640M (384 CUDA cores)
Here's an example:
Elapsed time is 1.382281 seconds.
Elapsed time is 4.775395 seconds.
Somehow GPU is much slower... Why? It is also slower in FFT, INV, LU calculations, which should be related with matrix division.
However, GPU is much faster in matrix multiplication (with the same data):
Elapsed time is 0.014700 seconds.
Elapsed time is 0.000505 seconds.
The main question is why GPU A\B (mldivide) is so slow comparing to CPU?
Jill Reese on 19 Feb 2013
To get accurate timings for GPU calculations you need to be sure to wait for the GPU to finish. You should modify all your timings accordingly:
g = gpuDevice();
f = fft(A);
Also, not all GPUs are created equal. To get a sense of what performance you can expect from your GPU in relation to other devices out there, you may want to run gpuBench which can be found here: