Unified interface for Hypre operations with both CPU and GPU data structures. More...
Detailed DescriptionUnified interface for Hypre operations with both CPU and GPU data structures. This namespace provides utilities for working with Hypre resources and transferring data between CPU/GPU data structures and Hypre handles. It handles type detection and automatically chooses the most efficient transfer method:
Supports four use cases:
Typedef Documentation◆ DeviceArrays◆ HostArrays◆ ParallelInfo◆ SparsityPatternFunction Documentation◆ computeRowIndexes()
template<typename MatrixType >
Compute row indexes for HYPRE_IJMatrixSetValues2. Chooses the appropriate row index computation method based on owner_first and matrix type.
References computeRowIndexesWithMappingCpu(), and computeRowIndexesWithMappingGpu(). Referenced by Hypre::HyprePreconditioner< M, X, Y, Comm >::HyprePreconditioner(). ◆ computeRowIndexesWithMappingCpu() [1/2]
template<typename MatrixType >
Referenced by computeRowIndexes(). ◆ computeRowIndexesWithMappingCpu() [2/2]
template<typename MatrixType >
Compute row indexes for CPU matrix with ownership mapping. Creates row_indexes that point directly into the FULL matrix data, enabling using the original matrix data without any data copying. This is necessary for some cases where ghost rows can come before all owned rows. Example with local_dune_to_local_hypre = [-1, 0, -1, 1]: Original matrix data (with gaps for ghost rows): Row 0 (ghost): {_, _} at positions 0-1 (skipped) Row 1 (owned): {1.0, 2.0} at positions 2-3 Row 2 (ghost): {_} at position 4 (skipped) Row 3 (owned): {3.0} at position 5 Resulting row_indexes: {2, 5} This tells HYPRE that Row 0 data starts at position 2, Row 1 data starts at position 5
◆ computeRowIndexesWithMappingGpu()
template<typename T >
Referenced by computeRowIndexes(). ◆ createAMGSolver()
Create Hypre solver (BoomerAMG) Create Hypre BoomerAMG solver.
References OPM_HYPRE_SAFE_CALL. Referenced by Hypre::HyprePreconditioner< M, X, Y, Comm >::HyprePreconditioner(). ◆ createMatrix()
template<typename CommType >
Create Hypre matrix.
References OPM_HYPRE_SAFE_CALL. Referenced by Opm::getMatrixRowColoring(), and Hypre::HyprePreconditioner< M, X, Y, Comm >::HyprePreconditioner(). ◆ createVector()
template<typename CommType >
Create Hypre vector.
References OPM_HYPRE_SAFE_CALL. Referenced by Hypre::HyprePreconditioner< M, X, Y, Comm >::HyprePreconditioner(). ◆ destroyMatrix()
Destroy Hypre matrix.
References OPM_HYPRE_SAFE_CALL. Referenced by Hypre::HyprePreconditioner< M, X, Y, Comm >::~HyprePreconditioner(). ◆ destroySolver()
Destroy Hypre solver.
References OPM_HYPRE_SAFE_CALL. Referenced by Hypre::HyprePreconditioner< M, X, Y, Comm >::~HyprePreconditioner(). ◆ destroyVector()
Destroy Hypre vector.
References OPM_HYPRE_SAFE_CALL. Referenced by Hypre::HyprePreconditioner< M, X, Y, Comm >::~HyprePreconditioner(). ◆ getMatrixValues()
Get matrix values from Hypre matrix. Retrieves the values from a Hypre matrix for verification or debugging purposes.
References OPM_HYPRE_SAFE_CALL. ◆ initialize()
Initialize the Hypre library and set memory/execution policy.
References OPM_HYPRE_SAFE_CALL. Referenced by Dune::CartesianIndexMapper< Dune::ALUGrid< 3, 3, Dune::cube, Dune::nonconforming > >::GlobalIndexDataHandle::GlobalIndexDataHandle(), Hypre::HyprePreconditioner< M, X, Y, Comm >::HyprePreconditioner(), Opm::CopyRestrictProlong< Grid, Container >::prolongLocal(), and Opm::CopyRestrictProlong< Grid, Container >::restrictLocal(). ◆ setContinuousGpuVectorForHypre()
template<typename VectorType >
◆ setContinuousVectorForHypre()
template<typename VectorType >
Extract owned vector values in the order expected by HYPRE. Referenced by transferCpuVectorToHypre(). ◆ setDuneVectorFromContinuousVector()
template<typename VectorType >
Distribute HYPRE vector values back to original vector positions. Referenced by transferHypreToCpuVector(). ◆ setGpuVectorFromContinuousVector()
template<typename VectorType >
◆ setSolverParameters()
Set solver parameters from property tree.
References Opm::PropertyTree::get(), and HYPRE_SAFE_CALL. Referenced by Hypre::HyprePreconditioner< M, X, Y, Comm >::HyprePreconditioner(). ◆ setupHypreParallelInfo()
template<typename CommType , typename MatrixType >
Setup parallel information for Hypre (automatically detects serial/parallel)
References setupHypreParallelInfoParallel(), and setupHypreParallelInfoSerial(). Referenced by Hypre::HyprePreconditioner< M, X, Y, Comm >::HyprePreconditioner(). ◆ setupHypreParallelInfoParallel()
template<typename CommType , typename MatrixType >
Create mappings between Dune and HYPRE indexing for parallel decomposition. This function interfaces between Dune's distributed matrix representation and HYPRE's global indexing requirements. Note that Dune uses local indices with owner/ghost classification, while HYPRE requires globally consistent indices for all DOFs. Index System Overview:Dune Local Indices: Each MPI process has local DOFs indexed 0..N_local-1, where:
HYPRE Global Indices: All DOFs across all processes have unique global indices:
Index Mappings Created:
Algorithm Steps:
Example (2 processes, 3 DOFs each):Process 0: Dune local [0,1,2] → owned=[0,1], ghost=[2 from P1]
Process 1: Dune local [0,1,2] → owned=[1,2], ghost=[0 from P0]
References Opm::gpuistl::ParallelInfo::dof_offset, Opm::gpuistl::ParallelInfo::local_dune_to_global_hypre, Opm::gpuistl::ParallelInfo::local_dune_to_local_hypre, Opm::gpuistl::ParallelInfo::local_hypre_to_local_dune, Opm::gpuistl::ParallelInfo::N_owned, and Opm::gpuistl::ParallelInfo::owner_first. Referenced by setupHypreParallelInfo(). ◆ setupHypreParallelInfoSerial()
Setup parallel information for Hypre in serial case.
References Opm::gpuistl::ParallelInfo::dof_offset, Opm::gpuistl::ParallelInfo::local_dune_to_global_hypre, Opm::gpuistl::ParallelInfo::local_dune_to_local_hypre, Opm::gpuistl::ParallelInfo::local_hypre_to_local_dune, Opm::gpuistl::ParallelInfo::N_owned, and Opm::gpuistl::ParallelInfo::owner_first. Referenced by setupHypreParallelInfo(). ◆ setupSparsityPattern()
template<typename MatrixType >
Setup sparsity pattern from matrix (automatically detects CPU/GPU type)
References setupSparsityPatternFromCpuMatrix(), and setupSparsityPatternFromGpuMatrix(). Referenced by Hypre::HyprePreconditioner< M, X, Y, Comm >::HyprePreconditioner(). ◆ setupSparsityPatternFromCpuMatrix()
template<typename MatrixType >
Setup sparsity pattern from CPU matrix (BCRSMatrix)
References Opm::gpuistl::SparsityPattern::cols, Opm::gpuistl::ParallelInfo::local_dune_to_global_hypre, Opm::gpuistl::ParallelInfo::local_dune_to_local_hypre, Opm::gpuistl::ParallelInfo::N_owned, Opm::gpuistl::SparsityPattern::ncols, Opm::gpuistl::SparsityPattern::nnz, and Opm::gpuistl::SparsityPattern::rows. Referenced by setupSparsityPattern(). ◆ setupSparsityPatternFromGpuMatrix()
template<typename T >
Referenced by setupSparsityPattern(). ◆ transferCpuVectorToHypre()
template<typename VectorType >
Transfer CPU vector to Hypre vector. References Opm::gpuistl::HypreHostDataArrays::continuous_vector_values, Opm::gpuistl::HypreHostDataArrays::indices, Opm::gpuistl::HypreDeviceDataArrays::indices_device, Opm::gpuistl::ParallelInfo::local_hypre_to_local_dune, OPM_HYPRE_SAFE_CALL, Opm::gpuistl::ParallelInfo::owner_first, setContinuousVectorForHypre(), and Opm::gpuistl::HypreDeviceDataArrays::vector_buffer_device. Referenced by transferVectorToHypre(). ◆ transferHypreToCpuVector()
template<typename VectorType >
Transfer Hypre vector to CPU vector. References Opm::gpuistl::HypreHostDataArrays::continuous_vector_values, Opm::gpuistl::HypreHostDataArrays::indices, Opm::gpuistl::HypreDeviceDataArrays::indices_device, Opm::gpuistl::ParallelInfo::local_hypre_to_local_dune, OPM_HYPRE_SAFE_CALL, Opm::gpuistl::ParallelInfo::owner_first, setDuneVectorFromContinuousVector(), and Opm::gpuistl::HypreDeviceDataArrays::vector_buffer_device. Referenced by transferVectorFromHypre(). ◆ transferVectorFromHypre()
template<typename VectorType >
Transfer vector from Hypre to any vector type (CPU or GPU) References transferHypreToCpuVector(). Referenced by Hypre::HyprePreconditioner< M, X, Y, Comm >::apply(). ◆ transferVectorToHypre()
template<typename VectorType >
Transfer vector to Hypre from any vector type (CPU or GPU) References transferCpuVectorToHypre(). Referenced by Hypre::HyprePreconditioner< M, X, Y, Comm >::apply(). ◆ updateMatrixFromCpuMatrix()
template<typename MatrixType >
Update Hypre matrix from CPU matrix Uses HYPRE_IJMatrixSetValues2 with pre-computed row_indexes, which allows us to use the original CPU matrix data (with potential ghost values) directly. References Opm::gpuistl::SparsityPattern::cols, Opm::gpuistl::HypreDeviceDataArrays::cols_device, Opm::gpuistl::HypreDeviceDataArrays::matrix_buffer_device, Opm::gpuistl::SparsityPattern::ncols, Opm::gpuistl::HypreDeviceDataArrays::ncols_device, OPM_HYPRE_SAFE_CALL, Opm::gpuistl::HypreHostDataArrays::row_indexes, Opm::gpuistl::HypreDeviceDataArrays::row_indexes_device, Opm::gpuistl::SparsityPattern::rows, and Opm::gpuistl::HypreDeviceDataArrays::rows_device. Referenced by updateMatrixValues(). ◆ updateMatrixValues()
template<typename MatrixType >
Update matrix values in Hypre. References updateMatrixFromCpuMatrix(). Referenced by Hypre::HyprePreconditioner< M, X, Y, Comm >::update(). |
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||