8 #ifdef MFEM_USE_MKL_CPARDISO
42 mtype = MatType::REAL_NONSYMMETRIC;
51 MFEM_ASSERT(hypreParMat,
"Must pass HypreParMatrix as Operator");
53 auto parcsr_op =
static_cast<hypre_ParCSRMatrix *
>(
56 hypre_CSRMatrix *csr_op = hypre_MergeDiagAndOffd(parcsr_op);
57 #if MFEM_HYPRE_VERSION >= 21600
58 hypre_CSRMatrixBigJtoJ(csr_op);
61 m = parcsr_op->global_num_rows;
62 first_row = parcsr_op->first_row_index;
63 nnz_loc = csr_op->num_nonzeros;
64 m_loc = csr_op->num_rows;
69 double *csr_nzval = csr_op->data;
70 int *csr_colind = csr_op->j;
73 delete[] reordered_csr_colind;
74 delete[] reordered_csr_nzval;
75 csr_rowptr =
new int[m_loc + 1];
76 reordered_csr_colind =
new int[nnz_loc];
77 reordered_csr_nzval =
new double[nnz_loc];
79 for (
int i = 0; i <= m_loc; i++)
81 csr_rowptr[i] = (csr_op->i)[i];
85 std::vector<int> permutation_idx(nnz_loc);
86 std::iota(permutation_idx.begin(), permutation_idx.end(), 0);
87 for (
int i = 0; i < m_loc; i++)
89 std::sort(permutation_idx.begin() + csr_rowptr[i],
90 permutation_idx.begin() + csr_rowptr[i + 1],
91 [csr_colind](
int i1,
int i2)
93 return csr_colind[i1] < csr_colind[i2];
97 for (
int i = 0; i < nnz_loc; i++)
99 reordered_csr_colind[i] = csr_colind[permutation_idx[i]];
100 reordered_csr_nzval[i] = csr_nzval[permutation_idx[i]];
103 hypre_CSRMatrixDestroy(csr_op);
107 iparm[40] = first_row;
111 iparm[41] = first_row + m_loc - 1;
115 cluster_sparse_solver(pt,
123 reordered_csr_colind,
133 MFEM_ASSERT(error == 0,
"CPardiso analyze input error");
137 cluster_sparse_solver(pt,
145 reordered_csr_colind,
155 MFEM_ASSERT(error == 0,
"CPardiso factorization input error");
162 cluster_sparse_solver(pt,
170 reordered_csr_colind,
180 MFEM_ASSERT(error == 0,
"Pardiso solve error");
185 msglvl = print_level;
197 cluster_sparse_solver(pt,
205 reordered_csr_colind,
215 MFEM_ASSERT(error == 0,
"CPardiso free error");
218 delete[] reordered_csr_colind;
219 delete[] reordered_csr_nzval;
224 #endif // MFEM_USE_MKL_CPARDISO
225 #endif // MFEM_USE_MPI
void Mult(const Vector &b, Vector &x) const override
Solve.
CPardisoSolver(MPI_Comm comm)
Construct a new CPardisoSolver object.
double * GetData() const
Return a pointer to the beginning of the Vector data.
int height
Dimension of the output / number of rows in the matrix.
void SetOperator(const Operator &op) override
Set the Operator object and perform factorization.
void SetPrintLevel(int print_lvl)
Set the print level for MKL CPardiso.
void SetMatrixType(MatType mat_type)
Set the matrix type.
Wrapper for hypre's ParCSR matrix class.
int width
Dimension of the input / number of columns in the matrix.