Domanda

I am trying to run LU Decomposition on MATLAB such that it will use the GPU. According to NVidia/MATLAB documentation, LU is supposed to be supported by CUDA (see, for example http://www.nvidia.com/content/GTC-2010/pdfs/2267_GTC2010.pdf).

Now, I have compared the speeds between CPU and GPU, and while GPU is indeed faster for matrix multiplication and FFT it seems to give pretty much the same results for LU decomposition, which is very important to me.

I have tried it for different sizes, but it remains pretty much the same.

For instance,

On GPU:

A=gpuArray(randn(1000));
tic; [l,u,p]=lu(A); toc
Elapsed time is 0.056832 seconds.

On CPU:

B=randn(1000);
tic; [l,u,p]=lu(B); toc
Elapsed time is 0.031463 seconds.

CPU is even faster. My CPU is i7-2630QM and my GPU is GT-550M (Laptop). I also tried it on a stronger computer that has GTX-660 and the results were the same.

My MATLAB version is 2012b

È stato utile?

Soluzione

Using MATLAB R2013a on a Tesla C2070, I see this:

A = gpuArray.randn(1000);
tic; [l,u,p]=lu(A); toc
Elapsed time is 0.016663 seconds.

which is about 2x faster than my CPU. As the matrix size increases further, the speedup increases, on my machine peaking at about 5x faster on the GPU - this is typical for a high-end (albeit slightly old) GPU compared to a decent 6-core CPU.

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top