HypreDataStructures.hpp
Go to the documentation of this file.
1/*
2 Copyright 2025 Equinor ASA
3
4 This file is part of the Open Porous Media project (OPM).
5
6 OPM is free software: you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation, either version 3 of the License, or
9 (at your option) any later version.
10
11 OPM is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
15
16 You should have received a copy of the GNU General Public License
17 along with OPM. If not, see <http://www.gnu.org/licenses/>.
18*/
19
20#ifndef OPM_HYPRE_DATA_STRUCTURES_HPP
21#define OPM_HYPRE_DATA_STRUCTURES_HPP
22
23#include <HYPRE.h>
24#include <HYPRE_parcsr_ls.h>
25#include <_hypre_utilities.h>
26#include <vector>
27
28namespace Opm::gpuistl
29{
30
37 struct ParallelInfo {
44 std::vector<int> local_dune_to_local_hypre;
45
52
59 std::vector<int> local_hypre_to_local_dune;
60
62 HYPRE_Int N_owned;
63
69 HYPRE_Int dof_offset;
70
78};
79
88 std::vector<HYPRE_Int> ncols;
89
91 std::vector<HYPRE_BigInt> rows;
92
94 std::vector<HYPRE_BigInt> cols;
95
97 HYPRE_Int nnz;
98};
99
113 std::vector<HYPRE_Int> row_indexes;
114
120 std::vector<HYPRE_BigInt> indices;
121
128 std::vector<HYPRE_Real> continuous_vector_values;
129};
130
139 HYPRE_Int* ncols_device = nullptr;
140 HYPRE_BigInt* rows_device = nullptr;
141 HYPRE_BigInt* cols_device = nullptr;
142 HYPRE_Int* row_indexes_device = nullptr;
143 HYPRE_BigInt* indices_device = nullptr;
144
149 HYPRE_Real* vector_buffer_device = nullptr;
150
155 HYPRE_Real* matrix_buffer_device = nullptr;
156};
157} // namespace Opm::gpuistl
158
159#endif // OPM_HYPRE_DATA_STRUCTURES_HPP
Definition: AmgxInterface.hpp:38
GPU device memory arrays for HYPRE operations with GPU backend.
Definition: HypreDataStructures.hpp:137
HYPRE_BigInt * rows_device
Definition: HypreDataStructures.hpp:140
HYPRE_Real * vector_buffer_device
Device buffer for vector operations Used when input type and backend are different,...
Definition: HypreDataStructures.hpp:149
HYPRE_Int * ncols_device
Mirrors host data arrays.
Definition: HypreDataStructures.hpp:139
HYPRE_Int * row_indexes_device
Definition: HypreDataStructures.hpp:142
HYPRE_BigInt * indices_device
Definition: HypreDataStructures.hpp:143
HYPRE_Real * matrix_buffer_device
Device buffer for matrix values, only needed for CPU input + GPU backend.
Definition: HypreDataStructures.hpp:155
HYPRE_BigInt * cols_device
Definition: HypreDataStructures.hpp:141
Host arrays for HYPRE matrix and vector data transfers.
Definition: HypreDataStructures.hpp:106
std::vector< HYPRE_BigInt > indices
Global DOF indices for owned degrees of freedom.
Definition: HypreDataStructures.hpp:120
std::vector< HYPRE_Real > continuous_vector_values
Temporary buffer for vector values in non-owner-first ordering.
Definition: HypreDataStructures.hpp:128
std::vector< HYPRE_Int > row_indexes
Pre-computed row start indexes for HYPRE_IJMatrixSetValues2.
Definition: HypreDataStructures.hpp:113
Parallel domain decomposition information for HYPRE-Dune interface.
Definition: HypreDataStructures.hpp:37
bool owner_first
Whether owned DOFs appear first in local Dune ordering.
Definition: HypreDataStructures.hpp:77
std::vector< int > local_dune_to_global_hypre
Mapping from local Dune indices to global HYPRE indices.
Definition: HypreDataStructures.hpp:51
std::vector< int > local_dune_to_local_hypre
Mapping from local Dune indices to local HYPRE indices.
Definition: HypreDataStructures.hpp:44
std::vector< int > local_hypre_to_local_dune
Mapping from local HYPRE indices to local Dune indices.
Definition: HypreDataStructures.hpp:59
HYPRE_Int dof_offset
Global index offset for this process's owned DOFs.
Definition: HypreDataStructures.hpp:69
HYPRE_Int N_owned
Number of DOFs owned by this MPI process.
Definition: HypreDataStructures.hpp:62
Compressed Sparse Row (CSR) sparsity pattern for HYPRE matrix assembly.
Definition: HypreDataStructures.hpp:86
std::vector< HYPRE_BigInt > rows
Global row indices for owned rows (size: N_owned)
Definition: HypreDataStructures.hpp:91
std::vector< HYPRE_Int > ncols
Non-zero entries per owned row (size: N_owned)
Definition: HypreDataStructures.hpp:88
HYPRE_Int nnz
Number of non-zero entries in matrix.
Definition: HypreDataStructures.hpp:97
std::vector< HYPRE_BigInt > cols
Global column indices in CSR format (size: nnz)
Definition: HypreDataStructures.hpp:94