MFEM v4.7.0
Finite element discretization library
Loading...
Searching...
No Matches
pardiso.hpp
Go to the documentation of this file.
1// Copyright (c) 2010-2024, Lawrence Livermore National Security, LLC. Produced
2// at the Lawrence Livermore National Laboratory. All Rights reserved. See files
3// LICENSE and NOTICE for details. LLNL-CODE-806117.
4//
5// This file is part of the MFEM library. For more information and source code
6// availability visit https://mfem.org.
7//
8// MFEM is free software; you can redistribute it and/or modify it under the
9// terms of the BSD-3 license. We welcome feedback and contributions, see file
10// CONTRIBUTING.md for details.
11
12#ifndef MFEM_PARDISO
13#define MFEM_PARDISO
14
15#include "../config/config.hpp"
16
17#ifdef MFEM_USE_MKL_PARDISO
18
19#include "mkl_pardiso.h"
20#include "operator.hpp"
21
22namespace mfem
23{
24/**
25 * @brief MKL Parallel Direct Sparse Solver PARDISO
26 *
27 * Interface to MKL PARDISO: the direct sparse solver based on PARDISO
28 */
30{
31public:
39
40 /**
41 * @brief Construct a new PardisoSolver object
42 *
43 */
45
46 /**
47 * @brief Set the Operator object and perform factorization
48 *
49 * @a op needs to be of type SparseMatrix.
50 *
51 * @param op Operator to use in factorization and solve
52 */
53 void SetOperator(const Operator &op) override;
54
55 /**
56 * @brief Solve
57 *
58 * @param b RHS vector
59 * @param x Solution vector
60 */
61 void Mult(const Vector &b, Vector &x) const override;
62
63 /**
64 * @brief Set the print level for MKL Pardiso
65 *
66 * Prints statistics after the factorization and after each solve.
67 *
68 * @param print_lvl Print level
69 */
70 void SetPrintLevel(int print_lvl);
71
72 /**
73 * @brief Set the matrix type
74 *
75 * The matrix type supported is either real and symmetric or real and
76 * non-symmetric.
77 *
78 * @param mat_type Matrix type
79 */
80 void SetMatrixType(MatType mat_type);
81
83
84private:
85 // Global number of rows
86 int m;
87
88 // Number of nonzero entries
89 int nnz;
90
91 // CSR data structure for the copy data of the local CSR matrix
92 int *csr_rowptr = nullptr;
93 real_t *reordered_csr_nzval = nullptr;
94 int *reordered_csr_colind = nullptr;
95
96 // Internal solver memory pointer pt,
97 // 32-bit: int pt[64]
98 // 64-bit: long int pt[64] or void *pt[64] should be OK on both architectures
99 mutable void *pt[64] = {0};
100
101 // Solver control parameters, detailed description can be found in the
102 // constructor.
103 mutable int iparm[64] = {0};
104 mutable int maxfct, mnum, msglvl, phase, error;
105 int mtype;
106 int nrhs;
107
108 // Dummy variables
109 mutable int idum;
110 mutable real_t ddum;
111};
112} // namespace mfem
113
114#endif // MFEM_USE_MKL_PARDISO
115
116#endif
Abstract operator.
Definition operator.hpp:25
MKL Parallel Direct Sparse Solver PARDISO.
Definition pardiso.hpp:30
@ REAL_SYMMETRIC_POSITIVE_DEFINITE
Definition pardiso.hpp:35
PardisoSolver()
Construct a new PardisoSolver object.
Definition pardiso.cpp:21
void SetMatrixType(MatType mat_type)
Set the matrix type.
Definition pardiso.cpp:127
void SetOperator(const Operator &op) override
Set the Operator object and perform factorization.
Definition pardiso.cpp:58
void SetPrintLevel(int print_lvl)
Set the print level for MKL Pardiso.
Definition pardiso.cpp:122
void Mult(const Vector &b, Vector &x) const override
Solve.
Definition pardiso.cpp:111
Base class for solvers.
Definition operator.hpp:683
Vector data type.
Definition vector.hpp:80
real_t b
Definition lissajous.cpp:42
float real_t
Definition config.hpp:43