using eig to find the eigenvalues and eigenvectors of a large matrix on GPU

17 次查看(过去 30 天)
Hi,
I have matrix A with 7936*7936 dimensions. I use eig to find its eigenvalues and eigenvectors, the command is [vect,eigen]=eig(A). But if I perform this calculations on GPU, it is more slower than cpu. My code on GPU is as follows
A=rand(7936,7936,'gpuArray');
[vect,eigen]=eig(A);
I do not know why is this calculations on GPU is so slowly? Are there some other good methods to accelerate the eig on GPU?
Thanks very much!
  2 个评论
Qiu Xu
Qiu Xu 2021-10-23
Thanks for your reply. I have tested for swithc the matrix to single, but is also very slowly, it looks like the GPU does not work, and the calclulation is still performed on CPU.

请先登录,再进行评论。

采纳的回答

Matt J
Matt J 2021-10-23
编辑:Matt J 2021-10-23
It might be a question of your hardware. On the GTX 1050 in R2020b, I see only about a 10% speed-up in double precision and about 50% in single-precision. On the GTX 1080 Ti in R2020a, I see a factor of 2 speed-up at both precisions.
gd=gpuDevice;
Ac=rand(2500);
Ag=gpuArray(Ac);
tic;
[vect,eigen]=eig(Ac);
toc;
tic;
[vect,eigen]=eig(Ag);
wait(gd)
toc
Elapsed time is 9.484250 seconds.
Elapsed time is 5.183906 seconds.
  7 个评论
Walter Roberson
Walter Roberson 2021-10-26
If gpuArray(1) returns a value, then MATLAB detected your GPU and an acceptable driver.
You might want to look at gpubench in the Add-On Explorer

请先登录,再进行评论。

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 GPU Computing 的更多信息

标签

Community Treasure Hunt

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

Start Hunting!

Translated by