Hi all, I have been testing the GPU computing feature in MATLAB. The code below is running and timing large matrix multiplications (1024×1024) using CPU and GPU computing:
A=rand(1024); gA=gpuArray(A); %warming up
for i=1:10 C=A*A; gC=gA*gA; end tic,C=A*A;toc; tic,gC=gA*gA; toc;
After many trials, the results using CPU turns out to be faster than GPU time. I am surprised because this guy on stackoverflow forum did the exact testing and he proved that using GPU is faster:
>> A = rand(1024); gA = gpuArray(A); % warm up by executing the operations a couple of times, and then:
>> tic, C = A * A; toc Elapsed time is 0.075396 seconds. >> tic, gC = gA * gA; toc Elapsed time is 0.008621 seconds.
The only reason I can think of is that we are using different GPUs. The other guy has a Tesla C2070 while the laptop I am using is Dell Inspirion17R (NVIDIA GeForce GT 525M).
Could it be possible that by using a lesser GPU, the computation is actually slower than using CPU ?
Thank you! Ruby
Best Answer