| 31 | // here we assume mat_csr's memory has already been allocated |
| 32 | template <typename T> |
| 33 | inline size_t CSC2CSR_get_buffersize( |
| 34 | DeviceSparseHandle& cusparse_H, |
| 35 | const DeviceSpMatCSC<T>& mat_csc, DeviceSpMatCSR<T>& mat_csr |
| 36 | ) { |
| 37 | size_t buffer_size; |
| 38 | CHECK_CUSPARSE( cusparseCsr2cscEx2_bufferSize( |
| 39 | cusparse_H.cusparse_handle, |
| 40 | mat_csc.col_size, mat_csc.row_size, mat_csc.nnz, |
| 41 | mat_csc.vals, mat_csc.col_ptrs, mat_csc.row_ids, |
| 42 | mat_csr.vals, mat_csr.row_ptrs, mat_csr.col_ids, |
| 43 | CudaTypeMapper<T>::value, CUSPARSE_ACTION_NUMERIC, CUSPARSE_INDEX_BASE_ZERO, CUSPARSE_CSR2CSC_ALG_DEFAULT, |
| 44 | &buffer_size |
| 45 | ) ); |
| 46 | return buffer_size; |
| 47 | } |
| 48 | |
| 49 | // suppose buffer already been allocated |
| 50 | template <typename T> |