Accelerate eig with GPUs
21 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
Hi all, I need to diagonalize a lot of matrices. The problem is similar to:
A = rand(5000, 5000, 500); %this snipped is just a demo. It is real logic in the program
EVs = zeros(5000, 500);
for idx = 1:500
EVs(:, idx) = eig(A(:,:,idx));
end
This is fine on CPUs and easily scalable with parfor and MDCS. As eig is faster on GPUs I tried this
A = rand(5000, 5000, 500); %this snipped is just a demo. It is real logic in the program
EVs = zeros(5000, 500, 'gpuArray');
for idx = 1:500
B = gpuArray(A(:, :, idx));
EVs(:, idx) = eig(B);
end
EVs = gather(EVs);
This does not lead to a much better performance. Is there a way to get around the gpuArray statement in each loop? Some kind of pagefun with eig would be the solution I guess. (unfortunately, eig is not supported by pagefun)
Best wishes Niklas
1 Commento
Matt J
il 16 Lug 2019
Birk Andreas's comment moved here:
Please Mathworks, implement eig for use with pagefun as soon as possible!!!
Risposta accettata
Matt J
il 16 Ott 2018
Modificato: Matt J
il 16 Ott 2018
You need to build A directly on the GPU, for example,
EVs = zeros(5000, 500, 'gpuArray');
A=gpuArray.rand(5000,5000,500);
for idx = 1:500
B = A(:, :, idx);
EVs(:, idx) = eig(B);
end
EVs = gather(EVs);
For the case of your real A, you have to examine what operations you are currently using to build A on the host, and which of those operations would not also be available on the GPU.
3 Commenti
Matt J
il 16 Ott 2018
Yeah, I can't see that there would be a lot of parallelism in eigenvalue computation.
Più risposte (0)
Vedere anche
Categorie
Scopri di più su GPU Computing in Help Center e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!