|
| void | initialize (bool use_gpu_backend) |
| | Initialize the Hypre library and set memory/execution policy.
|
| HYPRE_Solver | createAMGSolver () |
| | Create Hypre solver (BoomerAMG).
|
| void | setSolverParameters (HYPRE_Solver solver, const PropertyTree &prm, bool use_gpu_backend) |
| | Set solver parameters from property tree.
|
| template<typename CommType> |
| HYPRE_IJMatrix | createMatrix (HYPRE_Int N, HYPRE_Int dof_offset, const CommType &comm) |
| | Create Hypre matrix.
|
| template<typename CommType> |
| HYPRE_IJVector | createVector (HYPRE_Int N, HYPRE_Int dof_offset, const CommType &comm) |
| | Create Hypre vector.
|
| void | destroySolver (HYPRE_Solver solver) |
| | Destroy Hypre solver.
|
| void | destroyMatrix (HYPRE_IJMatrix matrix) |
| | Destroy Hypre matrix.
|
| void | destroyVector (HYPRE_IJVector vector) |
| | Destroy Hypre vector.
|
| template<typename CommType, typename MatrixType> |
| ParallelInfo | setupHypreParallelInfo (const CommType &comm, const MatrixType &matrix) |
| | Setup parallel information for Hypre (automatically detects serial/parallel).
|
| template<typename MatrixType> |
| SparsityPattern | setupSparsityPattern (const MatrixType &matrix, const ParallelInfo &par_info, bool owner_first) |
| | Setup sparsity pattern from matrix (automatically detects CPU/GPU type).
|
| template<typename MatrixType> |
| 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.
|
|
template<typename VectorType> |
| 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).
|
|
template<typename VectorType> |
| 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).
|
|
template<typename MatrixType> |
| 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.
|
|
template<typename VectorType> |
| void | setContinuousVectorForHypre (const VectorType &v, std::vector< HYPRE_Real > &continuous_vector_values, const std::vector< int > &local_hypre_to_local_dune) |
| | Extract owned vector values in the order expected by HYPRE.
|
|
template<typename VectorType> |
| void | setDuneVectorFromContinuousVector (VectorType &v, const std::vector< HYPRE_Real > &continuous_vector_values, const std::vector< int > &local_hypre_to_local_dune) |
| | Distribute HYPRE vector values back to original vector positions.
|
|
template<typename VectorType> |
| void | transferCpuVectorToHypre (const VectorType &cpu_vec, HYPRE_IJVector hypre_vec, HypreHostDataArrays &host_arrays, const HypreDeviceDataArrays &device_arrays, const ParallelInfo &par_info, bool use_gpu_backend) |
| | Transfer CPU vector to Hypre vector.
|
|
template<typename VectorType> |
| void | transferHypreToCpuVector (HYPRE_IJVector hypre_vec, VectorType &cpu_vec, HypreHostDataArrays &host_arrays, const HypreDeviceDataArrays &device_arrays, const ParallelInfo &par_info, bool use_gpu_backend) |
| | Transfer Hypre vector to CPU vector.
|
|
template<typename MatrixType> |
| void | updateMatrixFromCpuMatrix (const MatrixType &cpu_matrix, HYPRE_IJMatrix hypre_matrix, const SparsityPattern &sparsity_pattern, const HypreHostDataArrays &host_arrays, const HypreDeviceDataArrays &device_arrays, bool use_gpu_backend) |
| | 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.
|
|
template<typename VectorType> |
| void | setContinuousGpuVectorForHypre (const VectorType &v, std::vector< HYPRE_Real > &continuous_vector_values, const std::vector< int > &local_hypre_to_local_dune) |
|
template<typename VectorType> |
| void | setGpuVectorFromContinuousVector (VectorType &v, const std::vector< HYPRE_Real > &continuous_vector_values, const std::vector< int > &local_hypre_to_local_dune) |
|
template<typename T, bool ForceLegacy> |
| SparsityPattern | setupSparsityPatternFromGpuMatrix (const GpuSparseMatrixWrapper< T, ForceLegacy > &gpu_matrix, const ParallelInfo &par_info, bool owner_first) |
|
template<typename T, bool ForceLegacy> |
| std::vector< HYPRE_Int > | computeRowIndexesWithMappingGpu (const GpuSparseMatrixWrapper< T, ForceLegacy > &gpu_matrix, const std::vector< int > &local_dune_to_local_hypre) |
| ParallelInfo | setupHypreParallelInfoSerial (HYPRE_Int N) |
| | Setup parallel information for Hypre in serial case.
|
| template<typename CommType, typename MatrixType> |
| ParallelInfo | setupHypreParallelInfoParallel (const CommType &comm, const MatrixType &matrix) |
| | Create mappings between Dune and HYPRE indexing for parallel decomposition.
|
| template<typename MatrixType> |
| SparsityPattern | setupSparsityPatternFromCpuMatrix (const MatrixType &matrix, const ParallelInfo &par_info, bool owner_first) |
| | Setup sparsity pattern from CPU matrix (BCRSMatrix).
|
|
template<typename MatrixType> |
| std::vector< HYPRE_Int > | computeRowIndexesWithMappingCpu (const MatrixType &matrix, const std::vector< HYPRE_Int > &ncols, const std::vector< int > &local_dune_to_local_hypre, bool owner_first) |
| template<typename MatrixType> |
| std::vector< HYPRE_Int > | computeRowIndexesWithMappingCpu (const MatrixType &matrix, const std::vector< int > &local_dune_to_local_hypre) |
| | Compute row indexes for CPU matrix with ownership mapping.
|
| std::vector< HYPRE_Real > | getMatrixValues (HYPRE_IJMatrix hypre_matrix, const std::vector< HYPRE_Int > &ncols, const std::vector< HYPRE_BigInt > &rows, const std::vector< HYPRE_BigInt > &cols, bool use_gpu_backend=false) |
| | Get matrix values from Hypre matrix.
|
Unified 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:
- For GPU types: Zero-copy device-to-device transfers when using GPU backend
- For CPU types: Host-to-device transfers when using GPU backend
- For CPU types with CPU backend: Direct host memory usage
Supports four use cases:
- Input type is CPU and backend acceleration is CPU
- Input type is CPU and backend acceleration is GPU
- Input type is GPU and backend acceleration is GPU
- Input type is GPU and backend acceleration is CPU
- Note
- Error handling: All functions throw HypreError exceptions when Hypre operations fail.
-
This is a consolidated version that includes all functionality across multiple files.