Singular values calculation only with CUDA

As of CUDA 8.0, it is now possible to calculate the singular values only by cusolverDnSgesvd.

On our GitHub website,  we report an example code with two calls to cusolverDnSgesvd, one performing the singular values calculation only

cusolverDnSgesvd(solver_handle, 'N', 'N', M, N, d_A, M, d_S, NULL, M, NULL, N, work, work_size, NULL, devInfo)

and one performing the full SVD calculation

cusolverDnSgesvd(solver_handle, 'A', 'A', M, N, d_A, M, d_S, d_U, M, d_V, N, work, work_size, NULL, devInfo)

It is noted that the two ‘A’ fields for the full SVD case are changed to ‘N’ in the singular values only case.
It is also noted that, in the singular values only case, there is no need to store space for the singular vector matrices U and V.
Indeed, a NULL pointer is passed.

The singular values calculation only is faster than the full SVD calculation. On a GTX 960, for a 1000×1000 matrix, the timing has been the following:

Singular values only: 751 ms
Full SVD: 2559 ms

Leave a Reply

Your email address will not be published. Required fields are marked *