| 49 | // suppose buffer already been allocated |
| 50 | template <typename T> |
| 51 | inline void CSC2CSR( |
| 52 | DeviceSparseHandle& cusparse_H, |
| 53 | const DeviceSpMatCSC<T>& mat_csc, DeviceSpMatCSR<T>& mat_csr |
| 54 | ) { |
| 55 | size_t buffer_size = CSC2CSR_get_buffersize(cusparse_H, mat_csc, mat_csr); |
| 56 | void* buffer; |
| 57 | CHECK_CUDA( cudaMalloc(&buffer, buffer_size) ); |
| 58 | CHECK_CUSPARSE( cusparseCsr2cscEx2( |
| 59 | cusparse_H.cusparse_handle, |
| 60 | mat_csc.col_size, mat_csc.row_size, mat_csc.nnz, |
| 61 | mat_csc.vals, mat_csc.col_ptrs, mat_csc.row_ids, |
| 62 | mat_csr.vals, mat_csr.row_ptrs, mat_csr.col_ids, |
| 63 | CudaTypeMapper<T>::value, CUSPARSE_ACTION_NUMERIC, CUSPARSE_INDEX_BASE_ZERO, CUSPARSE_CSR2CSC_ALG_DEFAULT, |
| 64 | buffer |
| 65 | ) ); |
| 66 | return; |
| 67 | } |
| 68 | |
| 69 | template <typename T> |
| 70 | inline size_t CSR2CSC_get_buffersize( |
no test coverage detected