How to parallelize many small SVD's on a GPU

I'm computing SVD's of millions of small (e.g. 5 x 10) matrices. It is surprisingly fast as a for-loop on the CPU, however I need the computation to be even faster and would like to know if parallelization can be leveraged on a GPU. SVD doesn't currently appear to be a function supported by pagefun for gpuArray objects. I'm using R2020a and the Parallel Computing toolbox. Thanks

 Risposta accettata

As of R2021b, there is a function pagesvd which is supported on both CPU and distributed arrays. It's not supported for gpuArray as of now.

7 Commenti

Thanks for letting me know; unfortunately the distributed case doesn't really help me much since I assume SVD is already multithreaded and I'm limited to a single laptop with a high-power GPU. But I have a couple questions:
  • Does pagesvd offer much in the way of a speedup vs. a loop for the CPU case?
  • Are there plans to extend the pagesvd function to gpuArrays?
Does pagesvd offer much in the way of a speedup vs. a loop for the CPU case?
We can try it right here:
A=rand(5,10,1e6);
tic
pagesvd(A);
toc
Elapsed time is 2.531096 seconds.
tic
for i=1:size(A,3)
svd(A(:,:,i));
end
toc
Elapsed time is 8.363056 seconds.
Brilliant - I know we can write formatted code in the answer/comment boxes but somehow it skipped me that we can actually evaluate the code as well. 3x is a nontrivial improvement but what I would really like to know is if there is a GPU implementation coming soon.
Thanks for your interest, I've passed this information along to the gpuArray team.
Matt J
Matt J il 9 Dic 2021
Modificato: Matt J il 9 Dic 2021
On my laptop ( Intel(R) Core(TM) i5-7300HQ CPU @ 2.50GHz, 2501 Mhz, 4 Core(s), 4 Logical Processor(s) )
Elapsed time is 1.379264 seconds. %pagesvd
Elapsed time is 7.861928 seconds. %for loop
gpuArray/pagesvd coming next year, watch this space...
Great news, thank you Joss

Accedi per commentare.

Più risposte (1)

Matt J
Matt J il 9 Dic 2021
Modificato: Matt J il 9 Dic 2021
SVD doesn't currently appear to be a function supported by pagefun for gpuArray objects
Perhaps not for gpuArrays, but it is supported for distributed arrays:

Prodotti

Release

R2020a

Richiesto:

Tim
il 8 Dic 2021

Commentato:

Tim
il 18 Dic 2021

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by