hipsparsesprunedense2csrbypercentage_buffersizeext Interface Reference

hipsparsesprunedense2csrbypercentage_buffersizeext Interface Reference#

HIPFORT API Reference: hipfort_hipsparse::hipsparsesprunedense2csrbypercentage_buffersizeext Interface Reference
hipfort_hipsparse::hipsparsesprunedense2csrbypercentage_buffersizeext Interface Reference

This function computes the size of the user-allocated temporary storage buffer used when converting and pruning by percentage a dense matrix to a CSR matrix. More...

Public Member Functions

integer(kind(hipsparse_status_success)) function hipsparsesprunedense2csrbypercentage_buffersizeext_ (handle, m, n, a, lda, percentage, descr, csrval, csrrowptr, csrcolind, myinfo, pbuffersizeinbytes)
 
integer(kind(hipsparse_status_success)) function hipsparsesprunedense2csrbypercentage_buffersizeext_rank_0 (handle, m, n, a, lda, percentage, descr, csrval, csrrowptr, csrcolind, myinfo, pbuffersizeinbytes)
 
integer(kind(hipsparse_status_success)) function hipsparsesprunedense2csrbypercentage_buffersizeext_rank_1 (handle, m, n, a, lda, percentage, descr, csrval, csrrowptr, csrcolind, myinfo, pbuffersizeinbytes)
 
integer(kind(hipsparse_status_success)) function hipsparsesprunedense2csrbypercentage_buffersizeext_full_rank (handle, m, n, a, lda, percentage, descr, csrval, csrrowptr, csrcolind, myinfo, pbuffersizeinbytes)
 

Detailed Description

This function computes the size of the user-allocated temporary storage buffer used when converting and pruning by percentage a dense matrix to a CSR matrix.

When converting and pruning a dense matrix A to a CSR matrix by percentage, the following steps are performed. First, the user calls hipsparseXpruneDense2csrByPercentage_bufferSizeExt, which determines the size of the temporary storage buffer. After this is determined, this buffer must be allocated by the user. Next, the user allocates the csrRowPtr array to have m+1 elements and calls hipsparseSpruneDense2csrNnzByPercentage "hipsparseXpruneDense2csrNnzByPercentage()". Finally, the user finishes the conversion by allocating the csrColInd and csrVal arrays (whose size is determined by the value at nnzTotalDevHostPtr) and calling hipsparseSpruneDense2csrByPercentage "hipsparseXpruneDense2csrByPercentage()".

The pruning by percentage works by first sorting the absolute values of the dense matrix A. Users can then determine a position in this sorted array by

\[ pos = ceil(m \cdot n \cdot (percentage/100)) - 1 \\% pos = \min(pos, m \cdot n-1) \\% pos = \max(pos, 0) \\% threshold = sorted_A[pos] \]

After users have this threshold, they can prune values in the dense matrix A, as in hipsparseSpruneDense2csr "hipsparseXpruneDense2csr()".

Note
This function is executed asynchronously with respect to the host and can return control to the application on the host before the entire result is ready.
Parameters
[in]handle- handle to the hipSPARSE library context queue.
[in]m- number of rows of the dense matrix A.
[in]n- number of columns of the dense matrix A.
[in]A- array of dimensions (lda, n).
[in]lda- leading dimension of dense array A.
[in]percentage- percentage>=0 and percentage<=100.
[in]descr- the descriptor of the dense matrix A. The supported matrix type is HIPSPARSE_MATRIX_TYPE_GENERAL and any valid value of the hipsparseIndexBase_t.
[in]csrVal- array of nnz ( = csrRowPtr[m] - csrRowPtr[0] ) non-zero elements of matrix A.
[in]csrRowPtr- integer array of m+1 elements that contains the start of every row and the end of the last row plus one.
[in]csrColInd- integer array of nnz ( = csrRowPtr[m] - csrRowPtr[0] ) column indices of the non-zero elements of matrix A.
[in]myInfo- prune information structure.
[out]pBufferSizeInBytes- number of bytes of the temporary storage buffer required by hipsparseSpruneDense2csrNnzByPercentage() and hipsparseDpruneDense2csrNnzByPercentage().
Return values
HIPSPARSE_STATUS_SUCCESSthe operation completed successfully.
HIPSPARSE_STATUS_INVALID_VALUEthe handle or pBufferSizeInBytes pointer is invalid.
HIPSPARSE_STATUS_INTERNAL_ERRORan internal error occurred.

Member Function/Subroutine Documentation

◆ hipsparsesprunedense2csrbypercentage_buffersizeext_()

integer(kind(hipsparse_status_success)) function hipfort_hipsparse::hipsparsesprunedense2csrbypercentage_buffersizeext::hipsparsesprunedense2csrbypercentage_buffersizeext_ ( type(c_ptr), value  handle,
integer(c_int), value  m,
integer(c_int), value  n,
type(c_ptr), value  a,
integer(c_int), value  lda,
real(c_float), value  percentage,
type(c_ptr), value  descr,
type(c_ptr), value  csrval,
type(c_ptr), value  csrrowptr,
type(c_ptr), value  csrcolind,
type(c_ptr), value  myinfo,
integer(c_size_t)  pbuffersizeinbytes 
)

◆ hipsparsesprunedense2csrbypercentage_buffersizeext_full_rank()

integer(kind(hipsparse_status_success)) function hipfort_hipsparse::hipsparsesprunedense2csrbypercentage_buffersizeext::hipsparsesprunedense2csrbypercentage_buffersizeext_full_rank ( type(c_ptr)  handle,
integer(c_int)  m,
integer(c_int)  n,
real(c_float), dimension(:,:), target  a,
integer(c_int)  lda,
real(c_float)  percentage,
type(c_ptr)  descr,
real(c_float), dimension(:), target  csrval,
integer(c_int), dimension(:), target  csrrowptr,
integer(c_int), dimension(:), target  csrcolind,
type(c_ptr)  myinfo,
integer(c_size_t)  pbuffersizeinbytes 
)

◆ hipsparsesprunedense2csrbypercentage_buffersizeext_rank_0()

integer(kind(hipsparse_status_success)) function hipfort_hipsparse::hipsparsesprunedense2csrbypercentage_buffersizeext::hipsparsesprunedense2csrbypercentage_buffersizeext_rank_0 ( type(c_ptr)  handle,
integer(c_int)  m,
integer(c_int)  n,
real(c_float), target  a,
integer(c_int)  lda,
real(c_float)  percentage,
type(c_ptr)  descr,
real(c_float), target  csrval,
integer(c_int), target  csrrowptr,
integer(c_int), target  csrcolind,
type(c_ptr)  myinfo,
integer(c_size_t)  pbuffersizeinbytes 
)

◆ hipsparsesprunedense2csrbypercentage_buffersizeext_rank_1()

integer(kind(hipsparse_status_success)) function hipfort_hipsparse::hipsparsesprunedense2csrbypercentage_buffersizeext::hipsparsesprunedense2csrbypercentage_buffersizeext_rank_1 ( type(c_ptr)  handle,
integer(c_int)  m,
integer(c_int)  n,
real(c_float), dimension(:), target  a,
integer(c_int)  lda,
real(c_float)  percentage,
type(c_ptr)  descr,
real(c_float), dimension(:), target  csrval,
integer(c_int), dimension(:), target  csrrowptr,
integer(c_int), dimension(:), target  csrcolind,
type(c_ptr)  myinfo,
integer(c_size_t)  pbuffersizeinbytes 
)

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