|
| integer(c_int) 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_typed (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_0_devptr (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) |
| |
| integer(kind(rocsparse_status_success)) function | rocsparse_sprune_csr2csr_rank_1_devptr (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) |
| |
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_general is supported. |
| [in] | csr_val_A | - array of nnz_A elements containing the values of the sparse CSR matrix \(A\). |
| [in] | csr_row_ptr_A | - array of m+1 elements that point to the start of every row of the sparse CSR matrix \(A\). |
| [in] | csr_col_ind_A | - array of nnz_A elements 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_general is supported. |
| [out] | csr_val_C | - array of nnz_C elements containing the values of the sparse CSR matrix \(C\). |
| [in] | csr_row_ptr_C | - array of m+1 elements that point to the start of every row of the sparse CSR matrix \(C\). |
| [out] | csr_col_ind_C | - array of nnz_C elements 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, or nnz_A is 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, or temp_buffer pointer is invalid. |
- Example