HyprePreconditioner.hpp
Go to the documentation of this file.
89 // template <typename Prm = std::enable_if_t<std::is_same_v<Comm, Dune::Amg::SequentialInformation>, ::Opm::PropertyTree>>
145 device_arrays_.rows_device = hypre_CTAlloc(HYPRE_BigInt, par_info_.N_owned, HYPRE_MEMORY_DEVICE);
146 device_arrays_.cols_device = hypre_CTAlloc(HYPRE_BigInt, sparsity_pattern_.nnz, HYPRE_MEMORY_DEVICE);
147 device_arrays_.row_indexes_device = hypre_CTAlloc(HYPRE_Int, par_info_.N_owned, HYPRE_MEMORY_DEVICE);
148 device_arrays_.indices_device = hypre_CTAlloc(HYPRE_BigInt, par_info_.N_owned, HYPRE_MEMORY_DEVICE);
149 device_arrays_.vector_buffer_device = hypre_CTAlloc(HYPRE_Real, par_info_.N_owned, HYPRE_MEMORY_DEVICE);
153 // sparsity_pattern.nnz because we need to copy the entire matrix values from the host to the device.
154 device_arrays_.matrix_buffer_device = hypre_CTAlloc(HYPRE_Real, A_.nonzeroes(), HYPRE_MEMORY_DEVICE);
157 hypre_TMemcpy(device_arrays_.ncols_device, sparsity_pattern_.ncols.data(), HYPRE_Int, par_info_.N_owned, HYPRE_MEMORY_DEVICE, HYPRE_MEMORY_HOST);
158 hypre_TMemcpy(device_arrays_.rows_device, sparsity_pattern_.rows.data(), HYPRE_BigInt, par_info_.N_owned, HYPRE_MEMORY_DEVICE, HYPRE_MEMORY_HOST);
159 hypre_TMemcpy(device_arrays_.cols_device, sparsity_pattern_.cols.data(), HYPRE_BigInt, sparsity_pattern_.nnz, HYPRE_MEMORY_DEVICE, HYPRE_MEMORY_HOST);
160 hypre_TMemcpy(device_arrays_.row_indexes_device, host_arrays_.row_indexes.data(), HYPRE_Int, par_info_.N_owned, HYPRE_MEMORY_DEVICE, HYPRE_MEMORY_HOST);
161 hypre_TMemcpy(device_arrays_.indices_device, host_arrays_.indices.data(), HYPRE_BigInt, par_info_.N_owned, HYPRE_MEMORY_DEVICE, HYPRE_MEMORY_HOST);
268 HypreInterface::transferVectorToHypre(v, x_hypre_, host_arrays_, device_arrays_, par_info_, use_gpu_backend_);
269 HypreInterface::transferVectorToHypre(d, b_hypre_, host_arrays_, device_arrays_, par_info_, use_gpu_backend_);
282 HypreInterface::transferVectorFromHypre(x_hypre_, v, host_arrays_, device_arrays_, par_info_, use_gpu_backend_);
306 return std::is_same_v<Comm, Dune::Amg::SequentialInformation> ? Dune::SolverCategory::sequential
317 // The Hypre preconditioner can depend on the values of the matrix so it does not have perfect update.
318 // However, copying the matrix to Hypre requires to setup the solver again, so this is handled internally.
#define HYPRE_SAFE_CALL(expr) Short form macro for Hypre function calls (for backward compatibility) Definition: HypreErrorHandling.hpp:102 Interface class adding the update() method to the preconditioner interface. Definition: PreconditionerWithUpdate.hpp:32 Wrapper for Hypre's BoomerAMG preconditioner. Definition: HyprePreconditioner.hpp:67 M matrix_type The matrix type the preconditioner is for. Definition: HyprePreconditioner.hpp:70 void apply(X &v, const Y &d) override Applies the preconditioner to a vector. Definition: HyprePreconditioner.hpp:263 typename M::field_type matrix_field_type The field type of the matrix. Definition: HyprePreconditioner.hpp:72 X domain_type The domain type of the preconditioner. Definition: HyprePreconditioner.hpp:74 void update() override Updates the preconditioner with the current matrix values. Definition: HyprePreconditioner.hpp:219 ~HyprePreconditioner() Destructor for HyprePreconditioner. Definition: HyprePreconditioner.hpp:179 Dune::SolverCategory::Category category() const override Returns the solver category. Definition: HyprePreconditioner.hpp:304 typename X::field_type vector_field_type The field type of the vectors. Definition: HyprePreconditioner.hpp:78 void pre(X &v, Y &) override Pre-processing step before applying the preconditioner. Definition: HyprePreconditioner.hpp:248 bool hasPerfectUpdate() const override Checks if the preconditioner has a perfect update. Definition: HyprePreconditioner.hpp:315 HyprePreconditioner(const M &A, const Opm::PropertyTree prm, const Comm &comm) Constructor for the HyprePreconditioner class. Definition: HyprePreconditioner.hpp:96 Y range_type The range type of the preconditioner. Definition: HyprePreconditioner.hpp:76 void post(X &) override Post-processing step after applying the preconditioner. Definition: HyprePreconditioner.hpp:295 Definition: HyprePreconditioner.hpp:43 Unified interface for Hypre operations with both CPU and GPU data structures. Definition: HypreInterface.hpp:61 void destroySolver(HYPRE_Solver solver) Destroy Hypre solver. Definition: HypreSetup.hpp:219 void transferVectorToHypre(const VectorType &vec, HYPRE_IJVector hypre_vec, HostArrays &host_arrays, const DeviceArrays &device_arrays, const ParallelInfo &par_info, bool use_gpu_backend) Transfer vector to Hypre from any vector type (CPU or GPU) Definition: HypreInterface.hpp:164 ParallelInfo setupHypreParallelInfo(const CommType &comm, const MatrixType &matrix) Setup parallel information for Hypre (automatically detects serial/parallel) Definition: HypreSetup.hpp:263 void destroyMatrix(HYPRE_IJMatrix matrix) Destroy Hypre matrix. Definition: HypreSetup.hpp:233 HYPRE_Solver createAMGSolver() Create Hypre solver (BoomerAMG) Definition: HypreSetup.hpp:117 std::vector< HYPRE_Int > computeRowIndexes(const MatrixType &matrix, const std::vector< HYPRE_Int > &ncols, const std::vector< int > &local_dune_to_local_hypre, bool owner_first) Compute row indexes for HYPRE_IJMatrixSetValues2. Definition: HypreSetup.hpp:634 HYPRE_IJMatrix createMatrix(HYPRE_Int N, HYPRE_Int dof_offset, const CommType &comm) Create Hypre matrix. Definition: HypreSetup.hpp:170 void updateMatrixValues(const MatrixType &matrix, HYPRE_IJMatrix hypre_matrix, const SparsityPattern &sparsity_pattern, const HostArrays &host_arrays, const DeviceArrays &device_arrays, bool use_gpu_backend) Update matrix values in Hypre. Definition: HypreInterface.hpp:200 SparsityPattern setupSparsityPattern(const MatrixType &matrix, const ParallelInfo &par_info, bool owner_first) Setup sparsity pattern from matrix (automatically detects CPU/GPU type) Definition: HypreSetup.hpp:465 void initialize(bool use_gpu_backend) Initialize the Hypre library and set memory/execution policy. Definition: HypreSetup.hpp:89 HYPRE_IJVector createVector(HYPRE_Int N, HYPRE_Int dof_offset, const CommType &comm) Create Hypre vector. Definition: HypreSetup.hpp:197 void destroyVector(HYPRE_IJVector vector) Destroy Hypre vector. Definition: HypreSetup.hpp:247 void setSolverParameters(HYPRE_Solver solver, const PropertyTree &prm, bool use_gpu_backend) Set solver parameters from property tree. Definition: HypreSetup.hpp:133 void transferVectorFromHypre(HYPRE_IJVector hypre_vec, VectorType &vec, HostArrays &host_arrays, const DeviceArrays &device_arrays, const ParallelInfo &par_info, bool use_gpu_backend) Transfer vector from Hypre to any vector type (CPU or GPU) Definition: HypreInterface.hpp:182 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_local_hypre Mapping from local Dune indices to local HYPRE indices. Definition: HypreDataStructures.hpp:44 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 Type trait to detect if a type is a GPU type. Definition: gpu_type_detection.hpp:40 |