rocsparse_sprune_csr2csr Interface Reference#
Convert and prune sparse CSR matrix \(A\) into a sparse CSR matrix \(C\). More...
Public Member Functions | |
| integer(kind(rocsparse_status_success)) function | rocsparse_sprune_csr2csr_ (handle, m, n, nnz_a, csr_descr_a, csr_val_a, csr_row_ptr_a, csr_col_ind_a, threshold, csr_descr_c, csr_val_c, csr_row_ptr_c, csr_col_ind_c, temp_buffer) |
| integer(kind(rocsparse_status_success)) function | rocsparse_sprune_csr2csr_rank_0 (handle, m, n, nnz_a, csr_descr_a, csr_val_a, csr_row_ptr_a, csr_col_ind_a, threshold, csr_descr_c, csr_val_c, csr_row_ptr_c, csr_col_ind_c, temp_buffer) |
| integer(kind(rocsparse_status_success)) function | rocsparse_sprune_csr2csr_rank_1 (handle, m, n, nnz_a, csr_descr_a, csr_val_a, csr_row_ptr_a, csr_col_ind_a, threshold, csr_descr_c, csr_val_c, csr_row_ptr_c, csr_col_ind_c, temp_buffer) |
Detailed Description
Convert and prune sparse CSR matrix \(A\) into a sparse CSR matrix \(C\).
This function converts the sparse CSR matrix \(A\) into a sparse CSR matrix \(C\) by pruning values in \(A\) that are less than a threshold.
The conversion involves three steps. First, call rocsparse_Xprune_csr2csr_buffer_size() to determine the size of the temporary storage buffer. Allocate this buffer as well as the array csr_row_ptr_C to have m+1 elements. Then call rocsparse_Xprune_csr2csr_nnz(), which fills in the csr_row_ptr_C array and stores the number of elements that are larger than the pruning threshold in nnz_total_dev_host_ptr. Now that the number of non-zeros larger than the pruning threshold is known, use this information to allocate the csr_col_ind_C and csr_val_C arrays and then call rocsparse_prune_csr2csr to complete the conversion. After the conversion is complete, the temporary storage buffer can be freed.
- Note
- This function is blocking with respect to the host.
- This routine does not support execution in a hipGraph context.
- Parameters
-
[in] handle - handle to the rocSPARSE library context queue. [in] m - number of rows in the sparse CSR matrix. [in] n - number of columns in the sparse CSR matrix. [in] nnz_A - number of non-zeros in the sparse CSR matrix \(A\). [in] csr_descr_A - descriptor of the sparse CSR matrix \(A\). Currently, only rocsparse_matrix_type_generalis supported.[in] csr_val_A - array of nnz_Aelements containing the values of the sparse CSR matrix \(A\).[in] csr_row_ptr_A - array of m+1elements that point to the start of every row of the sparse CSR matrix \(A\).[in] csr_col_ind_A - array of nnz_Aelements containing the column indices of the sparse CSR matrix \(A\).[in] threshold - pointer to the non-negative pruning threshold, which can exist in either host or device memory. [in] csr_descr_C - descriptor of the sparse CSR matrix \(C\). Currently, only rocsparse_matrix_type_generalis supported.[out] csr_val_C - array of nnz_Celements containing the values of the sparse CSR matrix \(C\).[in] csr_row_ptr_C - array of m+1elements that point to the start of every row of the sparse CSR matrix \(C\).[out] csr_col_ind_C - array of nnz_Celements containing the column indices of the sparse CSR matrix \(C\).[in] temp_buffer - buffer allocated by the user. Its size is determined by calling rocsparse_Xprune_csr2csr_buffer_size().
- Return values
-
rocsparse_status_success the operation completed successfully. rocsparse_status_invalid_handle the library context was not initialized. rocsparse_status_invalid_size m,n, ornnz_Ais invalid.rocsparse_status_invalid_pointer threshold,csr_descr_A,csr_descr_C,csr_val_A,csr_row_ptr_A,csr_col_ind_A,csr_val_C,csr_row_ptr_C,csr_col_ind_C, ortemp_bufferpointer is invalid.
- Example
Member Function/Subroutine Documentation
◆ rocsparse_sprune_csr2csr_()
| integer(kind(rocsparse_status_success)) function hipfort_rocsparse::rocsparse_sprune_csr2csr::rocsparse_sprune_csr2csr_ | ( | type(c_ptr), value | handle, |
| integer(c_int), value | m, | ||
| integer(c_int), value | n, | ||
| integer(c_int), value | nnz_a, | ||
| type(c_ptr), value | csr_descr_a, | ||
| type(c_ptr), value | csr_val_a, | ||
| type(c_ptr), value | csr_row_ptr_a, | ||
| type(c_ptr), value | csr_col_ind_a, | ||
| real(c_float) | threshold, | ||
| type(c_ptr), value | csr_descr_c, | ||
| type(c_ptr), value | csr_val_c, | ||
| type(c_ptr), value | csr_row_ptr_c, | ||
| type(c_ptr), value | csr_col_ind_c, | ||
| type(c_ptr), value | temp_buffer | ||
| ) |
◆ rocsparse_sprune_csr2csr_rank_0()
| integer(kind(rocsparse_status_success)) function hipfort_rocsparse::rocsparse_sprune_csr2csr::rocsparse_sprune_csr2csr_rank_0 | ( | type(c_ptr) | handle, |
| integer(c_int) | m, | ||
| integer(c_int) | n, | ||
| integer(c_int) | nnz_a, | ||
| type(c_ptr) | csr_descr_a, | ||
| real(c_float), target | csr_val_a, | ||
| integer(c_int), target | csr_row_ptr_a, | ||
| integer(c_int), target | csr_col_ind_a, | ||
| real(c_float) | threshold, | ||
| type(c_ptr) | csr_descr_c, | ||
| real(c_float), target | csr_val_c, | ||
| integer(c_int), target | csr_row_ptr_c, | ||
| integer(c_int), target | csr_col_ind_c, | ||
| type(c_ptr) | temp_buffer | ||
| ) |
◆ rocsparse_sprune_csr2csr_rank_1()
| integer(kind(rocsparse_status_success)) function hipfort_rocsparse::rocsparse_sprune_csr2csr::rocsparse_sprune_csr2csr_rank_1 | ( | type(c_ptr) | handle, |
| integer(c_int) | m, | ||
| integer(c_int) | n, | ||
| integer(c_int) | nnz_a, | ||
| type(c_ptr) | csr_descr_a, | ||
| real(c_float), dimension(:), target | csr_val_a, | ||
| integer(c_int), dimension(:), target | csr_row_ptr_a, | ||
| integer(c_int), dimension(:), target | csr_col_ind_a, | ||
| real(c_float) | threshold, | ||
| type(c_ptr) | csr_descr_c, | ||
| real(c_float), dimension(:), target | csr_val_c, | ||
| integer(c_int), dimension(:), target | csr_row_ptr_c, | ||
| integer(c_int), dimension(:), target | csr_col_ind_c, | ||
| type(c_ptr) | temp_buffer | ||
| ) |
The documentation for this interface was generated from the following file: