rocsolver_sgesvd_batched Interface Reference

rocsolver_sgesvd_batched Interface Reference#

HIPFORT API Reference: hipfort_rocsolver::rocsolver_sgesvd_batched Interface Reference
hipfort_rocsolver::rocsolver_sgesvd_batched Interface Reference

The GESVD_BATCHED functions compute the singular values and optionally the singular vectors of a batch of general m-by-n matrices A_l (Singular Value Decomposition). More...

Public Member Functions

integer(kind(rocblas_status_success)) function rocsolver_sgesvd_batched_ (handle, left_svect, right_svect, m, n, a, lda, s, strides, u, ldu, strideu, v, ldv, stridev, e, stridee, fast_alg, myinfo, batch_count)
 
integer(kind(rocblas_status_success)) function rocsolver_sgesvd_batched_rank_0 (handle, left_svect, right_svect, m, n, a, lda, s, strides, u, ldu, strideu, v, ldv, stridev, e, stridee, fast_alg, myinfo, batch_count)
 
integer(kind(rocblas_status_success)) function rocsolver_sgesvd_batched_rank_1 (handle, left_svect, right_svect, m, n, a, lda, s, strides, u, ldu, strideu, v, ldv, stridev, e, stridee, fast_alg, myinfo, batch_count)
 
integer(kind(rocblas_status_success)) function rocsolver_sgesvd_batched_full_rank (handle, left_svect, right_svect, m, n, a, lda, s, strides, u, ldu, strideu, v, ldv, stridev, e, stridee, fast_alg, myinfo, batch_count)
 

Detailed Description

The GESVD_BATCHED functions compute the singular values and optionally the singular vectors of a batch of general m-by-n matrices A_l (Singular Value Decomposition).

The SVD of matrix A_l in the batch is given by:

\[ A_l^{} = U_l^{} S_l^{} V_l^H \]

where the m-by-n matrix \(S_l\) is zero except, possibly, for its min(m,n) diagonal elements, which are the singular values of \(A_l\). \(U_l\) and \(V_l\) are orthogonal (unitary) matrices. The first min(m,n) columns of \(U_l\) and \(V_l\) are the left and right singular vectors of \(A_l\), respectively.

The computation of the singular vectors is optional and is controlled by the function arguments left_svect and right_svect, as described below. When computed, this function returns the transpose (or transpose conjugate) of the right singular vectors, that is, the rows of \(V_l^H\).

left_svect and right_svect are rocblas_svect enums that can take the following values:

  • rocblas_svect_all: the entire matrix \(U_l\) (or \(V_l^H\)) is computed,
  • rocblas_svect_singular: only the singular vectors (first min(m,n) columns of \(U_l\) or rows of \(V_l^H\)) are computed,
  • rocblas_svect_overwrite: the first columns (or rows) of \(A_l\) are overwritten with the singular vectors, or
  • rocblas_svect_none: no columns (or rows) of \(U_l\) (or \(V_l^H\)) are computed, that is, no singular vectors.

left_svect and right_svect cannot both be set to overwrite. When neither is set to overwrite, the contents of \(A_l\) are destroyed by the time the function returns.

Note
When m >> n (or n >> m) the algorithm could be sped up by compressing the matrix \(A_l\) via a QR (or LQ) factorization and working with the triangular factor afterwards (thin-SVD). If the singular vectors are also requested, its computation could be sped up as well via executing some intermediate operations out-of-place and relying more on matrix multiplications (GEMMs), but this will require a larger memory workspace. The parameter fast_alg controls whether the fast algorithm is executed or not. For more details, see the "rocSOLVER performance tuning" and "Memory model" sections of the documentation.
In order to carry out calculations, this method could potentially synchronize the stream contained within the rocblas_handle.
A hybrid (CPU+GPU) approach is available for GESVD_BATCHED, primarily intended for homogeneous architectures. Use rocsolver_set_alg_mode to enable it.
Parameters
[in]handle- rocblas_handle.
[in]left_svect- rocblas_svect. Specifies how the left singular vectors are computed.
[in]right_svect- rocblas_svect. Specifies how the right singular vectors are computed.
[in]m- rocblas_int. m >= 0. The number of rows of all matrices A_l in the batch.
[in]n- rocblas_int. n >= 0. The number of columns of all matrices A_l in the batch.
[in,out]A- Array of pointers to type. Each pointer points to an array on the GPU of dimension lda*n. On entry, the matrices A_l. On exit, if left_svect (or right_svect) is equal to overwrite, the first columns (or rows) of A_l contain the left (or right) corresponding singular vectors. Otherwise, the contents of A_l are destroyed.
[in]lda- rocblas_int. lda >= m. The leading dimension of A_l.
[out]S- pointer to real type. Array on the GPU (the size depends on the value of strideS). The singular values of A_l in decreasing order.
[in]strideS- rocblas_stride. Stride from the start of one vector S_l to the next one S_(l+1). There is no restriction for the value of strideS. The normal use case is strideS >= min(m,n).
[out]U- pointer to type. Array on the GPU (the side depends on the value of strideU). The matrices U_l of left singular vectors stored as columns. Not referenced if left_svect is set to overwrite or none.
[in]ldu- rocblas_int. ldu >= m if left_svect is all or singular, and ldu >= 1 otherwise. The leading dimension of U_l.
[in]strideU- rocblas_stride. Stride from the start of one matrix U_l to the next one U_(l+1). There is no restriction for the value of strideU. The normal use case is strideU >= ldu*min(m,n) if left_svect is set to singular, or strideU >= ldu*m when left_svect is equal to all.
[out]V- pointer to type. Array on the GPU (the size depends on the value of strideV). The matrices V_l of right singular vectors stored as rows (transposed / conjugate-transposed). Not referenced if right_svect is set to overwrite or none.
[in]ldv- rocblas_int. ldv >= n if right_svect is all, and ldv >= min(m,n) if right_svect is set to singular or ldv >= 1 otherwise. The leading dimension of V_l.
[in]strideV- rocblas_stride. Stride from the start of one matrix V_l to the next one V_(l+1). There is no restriction for the value of strideV. The normal use case is strideV >= ldv*n.
[out]E- pointer to real type. Array on the GPU (the size depends on the value of strideE). This array is used to work internally with the bidiagonal matrix B_l associated with A_l (using BDSQR). On exit, if info[l] > 0, E_l contains the unconverged off-diagonal elements of B_l (or properly speaking, a bidiagonal matrix orthogonally equivalent to B_l). The diagonal elements of this matrix are in S_l. Those that converged correspond to a subset of the singular values of A_l (not necessarily ordered).
[in]strideE- rocblas_stride. Stride from the start of one vector E_l to the next one E_(l+1). There is no restriction for the value of strideE. The normal use case is strideE >= min(m,n)-1.
[in]fast_alg- rocblas_workmode. If set to rocblas_outofplace, the function will execute the fast thin-SVD version of the algorithm when possible.
[out]myInfo- pointer to a rocblas_int on the GPU. If info[l] = 0, successful exit. If info[l] = i > 0, BDSQR did not converge. i elements of E_l did not converge to zero.
[in]batch_count- rocblas_int. batch_count >= 0. Number of matrices in the batch.

Member Function/Subroutine Documentation

◆ rocsolver_sgesvd_batched_()

integer(kind(rocblas_status_success)) function hipfort_rocsolver::rocsolver_sgesvd_batched::rocsolver_sgesvd_batched_ ( type(c_ptr), value  handle,
integer(kind(rocblas_svect_all)), value  left_svect,
integer(kind(rocblas_svect_all)), value  right_svect,
integer(c_int), value  m,
integer(c_int), value  n,
type(c_ptr), value  a,
integer(c_int), value  lda,
type(c_ptr), value  s,
integer(c_int64_t), value  strides,
type(c_ptr), value  u,
integer(c_int), value  ldu,
integer(c_int64_t), value  strideu,
type(c_ptr), value  v,
integer(c_int), value  ldv,
integer(c_int64_t), value  stridev,
type(c_ptr), value  e,
integer(c_int64_t), value  stridee,
integer(kind(rocblas_outofplace)), value  fast_alg,
type(c_ptr), value  myinfo,
integer(c_int), value  batch_count 
)

◆ rocsolver_sgesvd_batched_full_rank()

integer(kind(rocblas_status_success)) function hipfort_rocsolver::rocsolver_sgesvd_batched::rocsolver_sgesvd_batched_full_rank ( type(c_ptr)  handle,
integer(kind(rocblas_svect_all))  left_svect,
integer(kind(rocblas_svect_all))  right_svect,
integer(c_int)  m,
integer(c_int)  n,
type(c_ptr)  a,
integer(c_int)  lda,
real(c_float), dimension(:), target  s,
integer(c_int64_t)  strides,
real(c_float), dimension(:,:), target  u,
integer(c_int)  ldu,
integer(c_int64_t)  strideu,
real(c_float), dimension(:,:), target  v,
integer(c_int)  ldv,
integer(c_int64_t)  stridev,
real(c_float), dimension(:), target  e,
integer(c_int64_t)  stridee,
integer(kind(rocblas_outofplace))  fast_alg,
type(c_ptr)  myinfo,
integer(c_int)  batch_count 
)

◆ rocsolver_sgesvd_batched_rank_0()

integer(kind(rocblas_status_success)) function hipfort_rocsolver::rocsolver_sgesvd_batched::rocsolver_sgesvd_batched_rank_0 ( type(c_ptr)  handle,
integer(kind(rocblas_svect_all))  left_svect,
integer(kind(rocblas_svect_all))  right_svect,
integer(c_int)  m,
integer(c_int)  n,
type(c_ptr)  a,
integer(c_int)  lda,
real(c_float), target  s,
integer(c_int64_t)  strides,
real(c_float), target  u,
integer(c_int)  ldu,
integer(c_int64_t)  strideu,
real(c_float), target  v,
integer(c_int)  ldv,
integer(c_int64_t)  stridev,
real(c_float), target  e,
integer(c_int64_t)  stridee,
integer(kind(rocblas_outofplace))  fast_alg,
type(c_ptr)  myinfo,
integer(c_int)  batch_count 
)

◆ rocsolver_sgesvd_batched_rank_1()

integer(kind(rocblas_status_success)) function hipfort_rocsolver::rocsolver_sgesvd_batched::rocsolver_sgesvd_batched_rank_1 ( type(c_ptr)  handle,
integer(kind(rocblas_svect_all))  left_svect,
integer(kind(rocblas_svect_all))  right_svect,
integer(c_int)  m,
integer(c_int)  n,
type(c_ptr)  a,
integer(c_int)  lda,
real(c_float), dimension(:), target  s,
integer(c_int64_t)  strides,
real(c_float), dimension(:), target  u,
integer(c_int)  ldu,
integer(c_int64_t)  strideu,
real(c_float), dimension(:), target  v,
integer(c_int)  ldv,
integer(c_int64_t)  stridev,
real(c_float), dimension(:), target  e,
integer(c_int64_t)  stridee,
integer(kind(rocblas_outofplace))  fast_alg,
type(c_ptr)  myinfo,
integer(c_int)  batch_count 
)

The documentation for this interface was generated from the following file: