| 124 | } |
| 125 | |
| 126 | int main(int argc, char *argv[]) |
| 127 | { |
| 128 | struct testOpts opts; |
| 129 | cusolverRfHandle_t cusolverRfH = NULL; // refactorization |
| 130 | cusolverSpHandle_t cusolverSpH = NULL; // reordering, permutation and 1st LU factorization |
| 131 | cusparseHandle_t cusparseH = NULL; // residual evaluation |
| 132 | cudaStream_t stream = NULL; |
| 133 | cusparseMatDescr_t descrA = NULL; // A is a base-0 general matrix |
| 134 | |
| 135 | csrluInfoHost_t info = NULL; // opaque info structure for LU with parital pivoting |
| 136 | |
| 137 | int rowsA = 0; // number of rows of A |
| 138 | int colsA = 0; // number of columns of A |
| 139 | int nnzA = 0; // number of nonzeros of A |
| 140 | int baseA = 0; // base index in CSR format |
| 141 | // cusolverRf only works for base-0 |
| 142 | |
| 143 | // cusolverRf only works for square matrix, |
| 144 | // assume n = rowsA = colsA |
| 145 | |
| 146 | // CSR(A) from I/O |
| 147 | int *h_csrRowPtrA = NULL; // <int> n+1 |
| 148 | int *h_csrColIndA = NULL; // <int> nnzA |
| 149 | double *h_csrValA = NULL; // <double> nnzA |
| 150 | |
| 151 | int *h_Qreorder = NULL; // <int> n |
| 152 | // reorder to reduce zero fill-in |
| 153 | // Qreorder = symrcm(A) or Qreroder = symamd(A) |
| 154 | // B = Q*A*Q^T |
| 155 | int *h_csrRowPtrB = NULL; // <int> n+1 |
| 156 | int *h_csrColIndB = NULL; // <int> nnzA |
| 157 | double *h_csrValB = NULL; // <double> nnzA |
| 158 | int *h_mapBfromA = NULL; // <int> nnzA |
| 159 | |
| 160 | double *h_x = NULL; // <double> n, x = A \ b |
| 161 | double *h_b = NULL; // <double> n, b = ones(m,1) |
| 162 | double *h_r = NULL; // <double> n, r = b - A*x |
| 163 | |
| 164 | // solve B*(Qx) = Q*b |
| 165 | double *h_xhat = NULL; // <double> n, Q*x_hat = x |
| 166 | double *h_bhat = NULL; // <double> n, b_hat = Q*b |
| 167 | |
| 168 | size_t size_perm = 0; |
| 169 | size_t size_internal = 0; |
| 170 | size_t size_lu = 0; // size of working space for csrlu |
| 171 | void *buffer_cpu = NULL; // working space for |
| 172 | // - permutation: B = Q*A*Q^T |
| 173 | // - LU with partial pivoting in cusolverSp |
| 174 | |
| 175 | // cusolverSp computes LU with partial pivoting |
| 176 | // Plu*B*Qlu^T = L*U |
| 177 | // where B = Q*A*Q^T |
| 178 | // |
| 179 | // nnzL and nnzU are not known until factorization is done. |
| 180 | // However upper bound of L+U is known after symbolic analysis of LU. |
| 181 | int *h_Plu = NULL; // <int> n |
| 182 | int *h_Qlu = NULL; // <int> n |
| 183 |
nothing calls this directly
no test coverage detected