### Build Examples Source: https://hypre.readthedocs.io/en/latest/_sources/ch-misc.rst.txt Enable the build of HYPRE examples. This is controlled by a CMake variable. ```bash -DHYPRE_BUILD_EXAMPLES=ON ``` -------------------------------- ### Build HYPRE Examples with Makefiles Source: https://hypre.readthedocs.io/en/latest/_sources/ch-misc.rst.txt Navigate to the 'examples' subdirectory and use the 'make' command to build the HYPRE example codes directly. This method is used when not configuring the entire HYPRE project with CMake. ```bash cd examples make ``` -------------------------------- ### Install Spack and HYPRE Source: https://hypre.readthedocs.io/en/latest/_sources/ch-misc.rst.txt Instructions for installing Spack and then installing HYPRE with default options. Spack simplifies dependency management for HPC environments. ```bash # Install Spack if you haven't already git clone -c feature.manyFiles=true --depth=2 https://github.com/spack/spack.git . spack/share/spack/setup-env.sh # Install hypre with default options spack install hypre ``` -------------------------------- ### Euclid Configuration File Format Source: https://hypre.readthedocs.io/en/latest/_sources/solvers-euclid.rst.txt Example of a 'database' configuration file for Euclid. Lines starting with '#' are comments. Options begin with '-' followed by a value. ```bash cat database #this is an optional comment -level 3 ``` -------------------------------- ### Configure and Use BoomerAMG Preconditioner with PCG Source: https://hypre.readthedocs.io/en/latest/_sources/solvers-boomeramg.rst.txt This example shows the setup of an IJ matrix and its subsequent use with the BoomerAMG preconditioner within the PCG solver. It includes essential steps like creating the matrix, adding values, assembling it, and configuring various BoomerAMG parameters such as relaxation type, coarsening type, and interpolation type. ```c /* setup IJ matrix A */ HYPRE_IJMatrixCreate(comm, first_row, last_row, first_col, last_col, &ij_A); HYPRE_IJMatrixSetObjectType(ij_A, HYPRE_PARCSR); /* GPU pointers; efficient in large chunks */ HYPRE_IJMatrixAddToValues(ij_A, num_rows, num_cols, rows, cols, data); HYPRE_IJMatrixAssemble(ij_A); HYPRE_IJMatrixGetObject(ij_A, (void **) &parcsr_A); ... /* setup AMG */ HYPRE_ParCSRPCGCreate(comm, &solver); HYPRE_BoomerAMGCreate(&precon); HYPRE_BoomerAMGSetRelaxType(precon, rlx_type); /* 3, 4, 6, 7, 18, 11, 12 */ HYPRE_BoomerAMGSetRelaxOrder(precon, FALSE); /* must be false */ HYPRE_BoomerAMGSetCoarsenType(precon, coarsen_type); /* 8 */ HYPRE_BoomerAMGSetInterpType(precon, interp_type); /* 3, 15, 6, 14, 18 */ HYPRE_BoomerAMGSetAggNumLevels(precon, agg_num_levels); HYPRE_BoomerAMGSetAggInterpType(precon, agg_interp_type); /* 4, 5, 6, 7, 8 */ HYPRE_BoomerAMGSetKeepTranspose(precon, TRUE); /* keep transpose to avoid SpMTV */ HYPRE_BoomerAMGSetRAP2(precon, FALSE); /* RAP in two multiplications (default: FALSE) */ HYPRE_ParCSRPCGSetPrecond(solver, HYPRE_BoomerAMGSolve, HYPRE_BoomerAMGSetup, precon); HYPRE_PCGSetup(solver, parcsr_A, b, x); ... /* solve */ HYPRE_PCGSolve(solver, parcsr_A, b, x); ... HYPRE_Finalize(); /* must be the last HYPRE function call */ ``` -------------------------------- ### Install HYPRE with Spack and CUDA Source: https://hypre.readthedocs.io/en/latest/_sources/ch-misc.rst.txt Example of installing HYPRE using Spack with specific build options, such as enabling CUDA support. ```bash spack install hypre+cuda ``` -------------------------------- ### HYPRE_SStructFlexGMRESSetup Source: https://hypre.readthedocs.io/en/latest/api-sol-sstruct.html Setup routine for the SStruct FlexGMRES solver. ```APIDOC ## HYPRE_SStructFlexGMRESSetup ### Description Setup routine for the SStruct FlexGMRES solver. ### Method Not applicable (C function signature) ### Endpoint Not applicable (C function signature) ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Request Example None ### Response #### Success Response Returns HYPRE_Int indicating success or failure. #### Response Example None ``` -------------------------------- ### Build HYPRE Examples with CMake Source: https://hypre.readthedocs.io/en/latest/_sources/ch-misc.rst.txt Enable the HYPRE_BUILD_EXAMPLES option during CMake configuration to build the example codes. This is followed by a standard make command to compile them. ```bash cmake -DHYPRE_BUILD_EXAMPLES=ON .. make ``` -------------------------------- ### Setup and Solve ILU as Standalone Solver Source: https://hypre.readthedocs.io/en/latest/_sources/solvers-ilu.rst.txt Performs the setup and solve steps when ILU is used as a standalone iterative solver. These calls are exclusively required for this usage mode. ```c HYPRE_ILUSetup(ilu_solver, parcsr_M, b, x); HYPRE_ILUSolve(ilu_solver, parcsr_A, b, x); ``` -------------------------------- ### Build HYPRE using Autotools Source: https://hypre.readthedocs.io/en/latest/_sources/ch-misc.rst.txt Build and install HYPRE using the traditional configure and make system. Use 'make -j 4' for a faster parallel build. The optional 'make install' command installs HYPRE to a user-specified path. ```bash cd ${HYPRE_HOME}/src # Move to the source directory ./configure # Configure the build system make -j 4 # Use threads for a faster parallel build make install # (Optional) Install hypre on a user-specified path via --prefix= ``` -------------------------------- ### HYPRE Make Targets Source: https://hypre.readthedocs.io/en/latest/_sources/ch-misc.rst.txt Overview of common make targets for building HYPRE, including 'help', 'all', 'clean', 'distclean', 'install', 'uninstall', 'tags', and 'test'. These targets manage the build, installation, and testing process of the HYPRE library. ```none help prints the details of each target all default target in all directories compile the entire library does NOT rebuild documentation clean deletes all files from the current directory that are created by building the library distclean deletes all files from the current directory that are created by configuring or building the library install compile the source code, build the library and copy executables, libraries, etc to the appropriate directories for user access uninstall deletes all files that the install target created tags runs etags to create a tags table file is named TAGS and is saved in the top-level directory test depends on the all target to be completed removes existing temporary installation directories creates temporary installation directories copies all libHYPRE* and *.h files to the temporary locations builds the test drivers; linking to the temporary locations to simulate how application codes will link to HYPRE ``` -------------------------------- ### HYPRE ParCSR Setup Functions Source: https://hypre.readthedocs.io/en/latest/api-sol-parcsr.html Functions for setting up the ParCSR solver, including interpreter and matrix-vector multiplication setup. ```APIDOC ## HYPRE ParCSR Setup Functions ### Description Core functions for initializing and configuring the ParCSR solver for matrix operations. ### Functions - `HYPRE_ParCSRSetupInterpreter()` - `HYPRE_ParCSRSetupMatvec()` - `HYPRE_TempParCSRSetupInterpreter()` ``` -------------------------------- ### HYPRE_SStructGMRESSetup Source: https://hypre.readthedocs.io/en/latest/api-sol-sstruct.html Setup routine for the SStruct GMRES solver. ```APIDOC ## HYPRE_SStructGMRESSetup ### Description Setup routine for the SStruct GMRES solver. ### Method Not applicable (C function signature) ### Endpoint Not applicable (C function signature) ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Request Example None ### Response #### Success Response Returns HYPRE_Int indicating success or failure. #### Response Example None ``` -------------------------------- ### HYPRE BoomerAMG Iterative ILU Setup Settings Source: https://hypre.readthedocs.io/en/latest/api-sol-parcsr.html Functions to configure iterative setup options for the ILU preconditioner in BoomerAMG. ```APIDOC ## HYPRE BoomerAMG Iterative ILU Setup Settings ### Description Configure the iterative setup process for the ILU preconditioner. This includes setting the type of iterative setup, specific options, maximum iterations, and the desired tolerance. ### Functions - `HYPRE_BoomerAMGSetILUIterSetupType(A, type)` - `HYPRE_BoomerAMGSetILUIterSetupOption(A, option)` - `HYPRE_BoomerAMGSetILUIterSetupMaxIter(A, max_iter)` - `HYPRE_BoomerAMGSetILUIterSetupTolerance(A, tolerance)` ``` -------------------------------- ### Setup ADS Solver Source: https://hypre.readthedocs.io/en/latest/_sources/solvers-ads.rst.txt Performs the setup for the ADS solver using the stiffness matrix A and parallel vectors b and x. This must be called after other setup functions like HYPRE_ADSSetCoordinateVectors. ```c HYPRE_ADSSetup(solver, A, b, x); ``` -------------------------------- ### HYPRE_ParCSROnProcTriSetup Source: https://hypre.readthedocs.io/en/latest/api-sol-parcsr.html Setup routine for on-processor triangular solve as preconditioning in ParCSR solvers. ```APIDOC ## HYPRE_ParCSROnProcTriSetup ### Description Setup routine for on-processor triangular solve as preconditioning. ### Method `HYPRE_Int HYPRE_ParCSROnProcTriSetup(HYPRE_Solver solver, HYPRE_ParCSRMatrix HA, HYPRE_ParVector Hy, HYPRE_ParVector Hx)` ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Request Example None ### Response #### Success Response (0) None specified. ``` -------------------------------- ### HYPRE_FSAISetPrintLevel Source: https://hypre.readthedocs.io/en/latest/api-sol-parcsr.html Requests automatic printing of setup information for FSAI. 0 for no printout (default), 1 for printing setup information. ```APIDOC ## HYPRE_FSAISetPrintLevel ### Description Requests automatic printing of setup information for FSAI. ### Parameters - **solver** (HYPRE_Solver) - The solver object. - **print_level** (HYPRE_Int) - The print level (0 or 1). ``` -------------------------------- ### HYPRE_SStructDiagScaleSetup Source: https://hypre.readthedocs.io/en/latest/api-sol-sstruct.html Setup routine for diagonal preconditioning in SStruct solvers. ```APIDOC ## HYPRE_SStructDiagScaleSetup ### Description Setup routine for diagonal preconditioning. ### Method Not applicable (C function signature) ### Endpoint Not applicable (C function signature) ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Request Example None ### Response #### Success Response Returns HYPRE_Int indicating success or failure. #### Response Example None ``` -------------------------------- ### HYPRE_ParCSRDiagScaleSetup Source: https://hypre.readthedocs.io/en/latest/api-sol-parcsr.html Setup routine for diagonal preconditioning in ParCSR solvers. ```APIDOC ## HYPRE_ParCSRDiagScaleSetup ### Description Setup routine for diagonal preconditioning. ### Method `HYPRE_Int HYPRE_ParCSRDiagScaleSetup(HYPRE_Solver solver, HYPRE_ParCSRMatrix A, HYPRE_ParVector y, HYPRE_ParVector x)` ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Request Example None ### Response #### Success Response (0) None specified. ``` -------------------------------- ### HYPRE_ParCSRHybridGetSetupSolveTime Source: https://hypre.readthedocs.io/en/latest/api-sol-parcsr.html Retrieves the setup and solve time for the Hybrid solver. ```APIDOC ## HYPRE_ParCSRHybridGetSetupSolveTime ### Description Retrieves the setup and solve time for the Hybrid solver. ### Method (Not specified, likely a C function call) ### Endpoint (Not applicable, C API) ### Parameters #### Path Parameters (Not applicable) #### Query Parameters (Not applicable) #### Request Body (Not applicable) ### Request Example (Not applicable) ### Response #### Success Response (Not specified) #### Response Example (Not applicable) ``` -------------------------------- ### Install Umpire with Spack Source: https://hypre.readthedocs.io/en/latest/_sources/ch-misc.rst.txt Install Umpire using the Spack package manager, with an example of enabling CUDA support. Spack simplifies the installation of complex software dependencies. ```bash spack install umpire+cuda # or +hip, +sycl ``` -------------------------------- ### HYPRE_EuclidSetup Source: https://hypre.readthedocs.io/en/latest/api-sol-parcsr.html Sets up the Euclid preconditioner. ```APIDOC ## HYPRE_EuclidSetup Solver Setup ### Description Sets up the Euclid preconditioner. This function should be passed to the iterative solver _SetPrecond_ function. ### Parameters #### Input Parameters * **solver** (HYPRE_Solver) - Preconditioner object to set up. * **A** (HYPRE_ParCSRMatrix) - ParCSR matrix used to construct the preconditioner. * **b** (HYPRE_ParVector) - Ignored by this function. * **x** (HYPRE_ParVector) - Ignored by this function. ``` -------------------------------- ### Manual Umpire Build Configuration Source: https://hypre.readthedocs.io/en/latest/_sources/ch-misc.rst.txt Configure Umpire using CMake for a manual build. This allows for specific Umpire configurations, including enabling or disabling various features like CUDA, HIP, SYCL, benchmarks, examples, documentation, and tests. It also specifies build type, library directory, and installation prefix. ```bash cd Umpire cmake -S . -B build \ -DUMPIRE_ENABLE_C=ON \ -DUMPIRE_ENABLE_TOOLS=OFF \ -DENABLE_CUDA=${ENABLE_CUDA} \ -DENABLE_HIP=${ENABLE_HIP} \ -DENABLE_SYCL=${ENABLE_SYCL} \ -DENABLE_BENCHMARKS=OFF \ -DENABLE_EXAMPLES=OFF \ -DENABLE_DOCS=OFF \ -DENABLE_TESTS=OFF \ -DCMAKE_BUILD_TYPE=Release \ -DCMAKE_INSTALL_LIBDIR=/path-to-umpire-install/lib \ -DCMAKE_INSTALL_PREFIX=/path-to-umpire-install ``` -------------------------------- ### Basic Solver Workflow Source: https://hypre.readthedocs.io/en/latest/_sources/ch-solvers.rst.txt Demonstrates the fundamental steps for using a HYPRE solver: setting tolerance, setup, solving, and destruction. Ensure the solver object is properly initialized before use. ```c HYPRE_SOLVERSetTol(solver, 1.e-8); /* Set up Solver */ HYPRE_SOLVERSetup(solver, A, b, x); /* Solve the system */ HYPRE_SOLVERSolve(solver, A, b, x); /* Destroy the solver */ HYPRE_SOLVERDestroy(solver); ``` -------------------------------- ### Basic Euclid Preconditioning Setup in HYPRE Source: https://hypre.readthedocs.io/en/latest/_sources/solvers-euclid.rst.txt Illustrates the minimum C code required to initialize, configure, and use Euclid as a preconditioner for another HYPRE solver like PCG. It shows how to create, set parameters, assign Euclid to a solver, and destroy the Euclid object. ```c #include "HYPRE_parcsr_ls.h" HYPRE_Solver eu; HYPRE_Solver pcg_solver; HYPRE_ParVector b, x; HYPRE_ParCSRMatrix A; //Instantiate the preconditioner. HYPRE_EuclidCreate(comm, &eu); //Optionally use the following three methods to set runtime options. // 1. pass options from command line or string array. HYPRE_EuclidSetParams(eu, argc, argv); // 2. pass options from a configuration file. HYPRE_EuclidSetParamsFromFile(eu, "filename"); // 3. pass options using interface functions. HYPRE_EuclidSetLevel(eu, 3); ... //Set Euclid as the preconditioning method for some //other solver, using the function calls HYPRE_EuclidSetup //and HYPRE_EuclidSolve. We assume that the pcg_solver //has been properly initialized. HYPRE_PCGSetPrecond(pcg_solver, (HYPRE_PtrToSolverFcn) HYPRE_EuclidSolve, (HYPRE_PtrToSolverFcn) HYPRE_EuclidSetup, eu); //Solve the system by calling the Setup and Solve methods for, //in this case, the HYPRE_PCG solver. We assume that A, b, and x //have been properly initialized. HYPRE_PCGSetup(pcg_solver, (HYPRE_Matrix)A, (HYPRE_Vector)b, (HYPRE_Vector)x); HYPRE_PCGSolve(pcg_solver, (HYPRE_Matrix)parcsr_A, (HYPRE_Vector)b, (HYPRE_Vector)x); //Destroy the Euclid preconditioning object. HYPRE_EuclidDestroy(eu); ``` -------------------------------- ### Build and Install Umpire Source: https://hypre.readthedocs.io/en/latest/_sources/ch-misc.rst.txt Build and install Umpire after configuring it with CMake. This command compiles the Umpire library and installs it to the specified prefix. ```bash cmake --build build -j cmake --install build ``` -------------------------------- ### GPU Accelerated BoomerAMG Solver Setup Source: https://hypre.readthedocs.io/en/latest/solvers-boomeramg.html Demonstrates setting up and using the BoomerAMG solver with GPU acceleration. It covers initializing Hypre, setting memory locations and execution policies for the device, configuring SpGEMM and RNG for GPU, and optionally using Hypre's or Umpire's GPU memory pools. Includes matrix setup and solving a linear system using PCG with BoomerAMG preconditioning. ```c cudaSetDevice(device_id); /* GPU binding */ ... HYPRE_Initialize(); /* must be the first HYPRE function call */ ... /* AMG in GPU memory (default) */ HYPRE_SetMemoryLocation(HYPRE_MEMORY_DEVICE); /* setup AMG on GPUs */ HYPRE_SetExecutionPolicy(HYPRE_EXEC_DEVICE); /* use hypre's SpGEMM instead of vendor implementation */ HYPRE_SetSpGemmUseVendor(FALSE); /* use GPU RNG */ HYPRE_SetUseGpuRand(TRUE); if (useHypreGpuMemPool) { /* use hypre's GPU memory pool */ HYPRE_SetGPUMemoryPoolSize(bin_growth, min_bin, max_bin, max_bytes); } else if (useUmpireGpuMemPool) { /* or use Umpire GPU memory pool */ HYPRE_SetUmpireUMPoolName("HYPRE_UM_POOL_TEST"); HYPRE_SetUmpireDevicePoolName("HYPRE_DEVICE_POOL_TEST"); } ... /* setup IJ matrix A */ HYPRE_IJMatrixCreate(comm, first_row, last_row, first_col, last_col, &ij_A); HYPRE_IJMatrixSetObjectType(ij_A, HYPRE_PARCSR); /* GPU pointers; efficient in large chunks */ HYPRE_IJMatrixAddToValues(ij_A, num_rows, num_cols, rows, cols, data); HYPRE_IJMatrixAssemble(ij_A); HYPRE_IJMatrixGetObject(ij_A, (void **) &parcsr_A); ... /* setup AMG */ HYPRE_ParCSRPCGCreate(comm, &solver); HYPRE_BoomerAMGCreate(&precon); HYPRE_BoomerAMGSetRelaxType(precon, rlx_type); /* 3, 4, 6, 7, 18, 11, 12 */ HYPRE_BoomerAMGSetRelaxOrder(precon, FALSE); /* must be false */ HYPRE_BoomerAMGSetCoarsenType(precon, coarsen_type); /* 8 */ HYPRE_BoomerAMGSetInterpType(precon, interp_type); /* 3, 15, 6, 14, 18 */ HYPRE_BoomerAMGSetAggNumLevels(precon, agg_num_levels); HYPRE_BoomerAMGSetAggInterpType(precon, agg_interp_type); /* 4, 5, 6, 7, 8 */ HYPRE_BoomerAMGSetKeepTranspose(precon, TRUE); /* keep transpose to avoid SpMTV */ HYPRE_BoomerAMGSetRAP2(precon, FALSE); /* RAP in two multiplications (default: FALSE) */ HYPRE_ParCSRPCGSetPrecond(solver, HYPRE_BoomerAMGSolve, HYPRE_BoomerAMGSetup, precon); HYPRE_PCGSetup(solver, parcsr_A, b, x); ... /* solve */ HYPRE_PCGSolve(solver, parcsr_A, b, x); ... HYPRE_Finalize(); /* must be the last HYPRE function call */ ``` -------------------------------- ### Running Euclid with Command Line Options Source: https://hypre.readthedocs.io/en/latest/_sources/solvers-euclid.rst.txt Example of executing an application 'phoo' with Euclid options specified on the mpirun command line. ```bash mpirun -np 2 phoo -level 3 ``` -------------------------------- ### Setup LOBPCG Solver with Matrix A Source: https://hypre.readthedocs.io/en/latest/api-sol-eigen.html Sets up the LOBPCG solver, including the matrix A and the preconditioner if one is specified. ```c HYPRE_Int HYPRE_LOBPCGSetup(HYPRE_Solver solver, HYPRE_Matrix A, HYPRE_Vector b, HYPRE_Vector x) ``` -------------------------------- ### Set Up Block-Structured Grid for FEM Source: https://hypre.readthedocs.io/en/latest/_sources/ch-sstruct.rst.txt This C code demonstrates the initialization of an SStruct grid for a 2D, 6-part problem using FEM. It includes setting grid extents, variables, FEM ordering, and defining shared parts between blocks. ```c HYPRE_SStructGrid grid; int ndim = 2, nparts = 6, nvars = 1, part = 0; int ilower[2] = {1,1}, iupper[2] = {9,9}; int vartypes[] = {HYPRE_SSTRUCT_VARIABLE_NODE}; int ordering[12] = {0,-1,-1, 0,+1,-1, 0,+1,+1, 0,-1,+1}; int s_part = 2; int ilo[2] = {1,1}, iup[2] = {1,9}, offset[2] = {-1,0}; int s_ilo[2] = {1,1}, s_iup[2] = {9,1}, s_offset[2] = {0,-1}; int map[2] = {1,0}; int dir[2] = {-1,1}; 1: HYPRE_SStructGridCreate(MPI_COMM_WORLD, ndim, nparts, &grid); /* Set grid extents, grid variables, and FEM ordering for part 0 */ 2: HYPRE_SStructGridSetExtents(grid, part, ilower, iupper); 3: HYPRE_SStructGridSetVariables(grid, part, nvars, vartypes); 4: HYPRE_SStructGridSetFEMOrdering(grid, part, ordering); /* Set shared variables for parts 0 and 1 (0 and 2/3/4/5 not shown) */ 5: HYPRE_SStructGridSetSharedPart(grid, part, ilo, iup, offset, s_part, s_ilo, s_iup, s_offset, map, dir); 6: HYPRE_SStructGridAssemble(grid); ``` -------------------------------- ### Configure HYPRE Install Path with Autotools Source: https://hypre.readthedocs.io/en/latest/_sources/ch-misc.rst.txt Setting the installation path for HYPRE when using the autotools build system. ```bash --prefix= ``` -------------------------------- ### Configure HYPRE Install Path with CMake Source: https://hypre.readthedocs.io/en/latest/_sources/ch-misc.rst.txt Setting the installation path for HYPRE when using the CMake build system. ```bash -DCMAKE_INSTALL_PREFIX= ``` -------------------------------- ### Setting Up Block-Structured Grid Source: https://hypre.readthedocs.io/en/latest/ch-sstruct.html This code demonstrates how to set up a block-structured grid using the HYPRE_SStruct interface on a specific process. It includes creating the grid, defining extents and variables for a part, and specifying neighbor relationships between parts. ```c HYPRE_SStructGridCreate(MPI_COMM_WORLD, ndim, nparts, &grid); /* Set grid extents and grid variables for part 3 */ HYPRE_SStructGridSetExtents(grid, part, extents[0], extents[1]); HYPRE_SStructGridSetVariables(grid, part, nvars, vartypes); /* Set spatial relationship between parts 3 and 2, then parts 3 and 4 */ HYPRE_SStructGridSetNeighborPart(grid, part, nb2_exts[0], nb2_exts[1], nb2_n_part, nb2_n_exts[0], nb2_n_exts[1], nb2_map, nb2_dir); HYPRE_SStructGridSetNeighborPart(grid, part, nb4_exts[0], nb4_exts[1], nb4_n_part, nb4_n_exts[0], nb4_n_exts[1], nb4_map, nb4_dir); HYPRE_SStructGridAssemble(grid); ``` -------------------------------- ### HYPRE_FSAISetup Source: https://hypre.readthedocs.io/en/latest/api-sol-parcsr.html Set up the ParCSR FSAI solver or preconditioner. ```APIDOC ## HYPRE_FSAISetup ### Description Set up the FSAI solver or preconditioner. If used as a preconditioner, this function should be passed to the iterative solver _SetPrecond_ function. ### Method ``` HYPRE_Int HYPRE_FSAISetup(HYPRE_Solver solver, HYPRE_ParCSRMatrix A, HYPRE_ParVector b, HYPRE_ParVector x) ``` ### Parameters * **solver** - [IN] object to be set up. * **A** - [IN] ParCSR matrix used to construct the solver/preconditioner. * **b** - Ignored by this function. * **x** - Ignored by this function. ``` -------------------------------- ### Install hypre using Spack Source: https://hypre.readthedocs.io/en/latest/ch-misc.html Installs hypre using the Spack package manager. This is recommended for HPC environments as it handles dependencies automatically. ```bash # Install Spack if you haven't already git clone -c feature.manyFiles=true --depth=2 https://github.com/spack/spack.git . spack/share/spack/setup-env.sh # Install hypre with default options spack install hypre # Or install with specific options (e.g., with CUDA support) spack install hypre+cuda ``` -------------------------------- ### HYPRE_ParChebySetPrintLevel Source: https://hypre.readthedocs.io/en/latest/api-sol-parcsr.html Requests automatic printing of setup information for the ParCSR Chebyshev solver. 0 for no printout (default), 1 for printing setup information. ```APIDOC ## HYPRE_ParChebySetPrintLevel ### Description Requests automatic printing of setup information for Chebyshev. ### Parameters - **solver** (HYPRE_Solver) - The solver object. - **print_level** (HYPRE_Int) - The print level (0 or 1). ``` -------------------------------- ### HYPRE_ParCSRPilutSetup Source: https://hypre.readthedocs.io/en/latest/api-sol-parcsr.html Sets up the ParCSR Pilut preconditioner. ```APIDOC ## HYPRE_ParCSRPilutSetup ### Description Sets up the ParCSR Pilut preconditioner. ### Method (Not specified, likely a function call in a C API) ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Request Example None ### Response #### Success Response (0) (Not specified, likely an integer return code) #### Response Example None ``` -------------------------------- ### Set Iterative Setup Tolerance for ILU Source: https://hypre.readthedocs.io/en/latest/api-sol-parcsr.html Sets the stop tolerance for the iterative ILU algorithm's setup phase. This is optional and depends on rocSPARSE. ```c HYPRE_Int HYPRE_ILUSetIterativeSetupTolerance(HYPRE_Solver solver, HYPRE_Real iter_setup_tolerance); ``` -------------------------------- ### HYPRE_SStructVectorGetValues Source: https://hypre.readthedocs.io/en/latest/api-int-sstruct.html Get vector coefficients index by index. Users must first call the routine HYPRE_SStructVectorGather to ensure that data owned by multiple processes is correct. NOTE: For better efficiency, use HYPRE_SStructVectorGetBoxValues to get coefficients a box at a time. NOTE: Users may only get values on processes that own the associated variables. ```APIDOC ## HYPRE_SStructVectorGetValues ### Description Get vector coefficients index by index. ### Method (Not specified, likely a function call in a C API) ### Parameters - **vector** (HYPRE_SStructVector) - The vector object. - **part** (HYPRE_Int) - The part of the grid. - **index** (HYPRE_Int *) - The index of the coefficient. - **var** (HYPRE_Int) - The variable. - **value** (HYPRE_Complex *) - A pointer to store the retrieved value. ``` -------------------------------- ### HYPRE_LOBPCGSetup Source: https://hypre.readthedocs.io/en/latest/api-sol-eigen.html Sets up the matrix A and the preconditioner for the LOBPCG solver. ```APIDOC ## HYPRE_LOBPCGSetup ### Description Set up _A_ and the preconditioner (if there is one). ### Method HYPRE_Int ### Parameters - **solver** (HYPRE_Solver) - - **A** (HYPRE_Matrix) - - **b** (HYPRE_Vector) - - **x** (HYPRE_Vector) - ``` -------------------------------- ### Set Iterative Setup Maximum Iterations for ILU Source: https://hypre.readthedocs.io/en/latest/api-sol-parcsr.html Sets the maximum number of iterations for the iterative ILU algorithm's setup phase. This is optional and depends on rocSPARSE. ```c HYPRE_Int HYPRE_ILUSetIterativeSetupMaxIter(HYPRE_Solver solver, HYPRE_Int iter_setup_max_iter); ``` -------------------------------- ### Create a Solver Instance Source: https://hypre.readthedocs.io/en/latest/_sources/ch-solvers.rst.txt This snippet shows the initial step of creating a solver instance using the HYPRE_SOLVERCreate routine. Ensure you have the correct MPI communicator. ```c /* Create Solver */ int HYPRE_SOLVERCreate(MPI_COMM_WORLD, &solver); ``` -------------------------------- ### Create and Initialize IJ Matrix Source: https://hypre.readthedocs.io/en/latest/_sources/ch-ij.rst.txt Illustrates the basic usage of the IJ interface for building matrices, including creation, setting object type, and initialization. ```c MPI_Comm comm; HYPRE_IJMatrix ij_matrix; HYPRE_ParCSRMatrix parcsr_matrix; int ilower, iupper; int jlower, jupper; int nrows; int *ncols; int *rows; int *cols; double *values; HYPRE_IJMatrixCreate(comm, ilower, iupper, jlower, jupper, &ij_matrix); HYPRE_IJMatrixSetObjectType(ij_matrix, HYPRE_PARCSR); HYPRE_IJMatrixInitialize(ij_matrix); /* set matrix coefficients */ HYPRE_IJMatrixSetValues(ij_matrix, nrows, ncols, rows, cols, values); ... /* add-to matrix cofficients, if desired */ HYPRE_IJMatrixAddToValues(ij_matrix, nrows, ncols, rows, cols, values); ... HYPRE_IJMatrixAssemble(ij_matrix); HYPRE_IJMatrixGetObject(ij_matrix, (void **) &parcsr_matrix); ``` -------------------------------- ### Install Umpire with Spack Source: https://hypre.readthedocs.io/en/latest/ch-misc.html Install Umpire using the Spack package manager, specifying the desired GPU backend (cuda, hip, or sycl). This is a convenient method for managing Umpire within an existing Spack environment. ```bash # Install Umpire with Spack spack install umpire+cuda # or +hip, +sycl ``` -------------------------------- ### HYPRE_ILUSetPrintLevel Source: https://hypre.readthedocs.io/en/latest/_sources/solvers-ilu.rst.txt Sets the verbosity level for ILU algorithm statistics. Level 0 means no output, 1 prints setup info, 2 prints solve info, and 3 prints both setup and solve info. ```APIDOC ## HYPRE_ILUSetPrintLevel ### Description Sets the verbosity level for algorithm statistics. * 0: No output. * 1: Print setup info. * 2: Print solve info. * 3: Print setup and solve info. ### Method Not specified (assumed C function call) ### Endpoint Not applicable ``` -------------------------------- ### Running Application with Euclid Options Source: https://hypre.readthedocs.io/en/latest/solvers-euclid.html Example of executing an application ('phoo') with two MPI processes, passing the '-level 3' option to Euclid via the command line. ```bash mpirun -np 2 phoo -level 3 ``` -------------------------------- ### HYPRE_StructDiagScaleSetup Source: https://hypre.readthedocs.io/en/latest/api-sol-struct.html Setup routine for diagonal preconditioning. ```APIDOC ## HYPRE_StructDiagScaleSetup ### Description Setup routine for diagonal preconditioning. ### Method Function Call ### Parameters - **solver** (HYPRE_StructSolver) - The solver object. - **A** (HYPRE_StructMatrix) - The coefficient matrix. - **y** (HYPRE_StructVector) - The vector for diagonal scaling. - **x** (HYPRE_StructVector) - The solution vector. ``` -------------------------------- ### HYPRE_LGMRESSetup Source: https://hypre.readthedocs.io/en/latest/api-sol-krylov.html Prepares the LGMRES solver to solve the system. ```APIDOC ## HYPRE_LGMRESSetup ### Description Prepare to solve the system using LGMRES. ### Method (Not specified, likely a setup function) ### Endpoint (Not applicable, SDK function) ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Request Example None ### Response #### Success Response None #### Response Example None ``` -------------------------------- ### HYPRE_BoomerAMGSetSetupType Source: https://hypre.readthedocs.io/en/latest/ch-api.html Sets the setup type for the BoomerAMG solver. ```APIDOC ## HYPRE_BoomerAMGSetSetupType ### Description Sets the setup type for the BoomerAMG solver. ### Method Not specified (assumed to be a function call in a C API) ### Endpoint Not applicable (C API function) ### Parameters * **setup_type** (int) - Description not provided in source. ``` -------------------------------- ### Setup and Solve with GMRES Preconditioner Source: https://hypre.readthedocs.io/en/latest/_sources/solvers-ilu.rst.txt Sets up and solves a system using GMRES, with ILU configured as a preconditioner. These calls are exclusively required when ILU is used as a preconditioner for GMRES or other Krylov methods. ```c HYPRE_GMRESSetup(gmres_solver, (HYPRE_Matrix)A, (HYPRE_Vector)b, (HYPRE_Vector)x); HYPRE_GMRESSolve(gmres_solver, (HYPRE_Matrix)A, (HYPRE_Vector)b, (HYPRE_Vector)x); ``` -------------------------------- ### Setup Hypre for GPU Execution with BoomerAMG Source: https://hypre.readthedocs.io/en/latest/_sources/solvers-boomeramg.rst.txt This snippet demonstrates initializing Hypre, setting the memory location to device, and configuring the execution policy for GPU computations. It also shows how to enable GPU-specific features like vendor SpGEMM, GPU random number generation, and optional GPU memory pooling. ```c cudaSetDevice(device_id); /* GPU binding */ ... HYPRE_Initialize(); /* must be the first HYPRE function call */ ... /* AMG in GPU memory (default) */ HYPRE_SetMemoryLocation(HYPRE_MEMORY_DEVICE); /* setup AMG on GPUs */ HYPRE_SetExecutionPolicy(HYPRE_EXEC_DEVICE); /* use hypre's SpGEMM instead of vendor implementation */ HYPRE_SetSpGemmUseVendor(FALSE); /* use GPU RNG */ HYPRE_SetUseGpuRand(TRUE); if (useHypreGpuMemPool) { /* use hypre's GPU memory pool */ HYPRE_SetGPUMemoryPoolSize(bin_growth, min_bin, max_bin, max_bytes); } else if (useUmpireGpuMemPool) { /* or use Umpire GPU memory pool */ HYPRE_SetUmpireUMPoolName("HYPRE_UM_POOL_TEST"); HYPRE_SetUmpireDevicePoolName("HYPRE_DEVICE_POOL_TEST"); } ... ``` -------------------------------- ### Setup AMS Solver Source: https://hypre.readthedocs.io/en/latest/_sources/solvers-ams.rst.txt Initializes the AMS solver with the stiffness matrix and parallel vectors. Ensure prerequisite functions like HYPRE_AMSSetDiscreteGradient are called before this. ```c HYPRE_AMSSetup(solver, A, b, x); ``` -------------------------------- ### HYPRE_ParCSRCGNRSetup Source: https://hypre.readthedocs.io/en/latest/api-sol-parcsr.html Sets up the CGNR solver for a given problem. This typically involves preconditioning or other initialization steps. ```APIDOC ## HYPRE_ParCSRCGNRSetup ### Description Sets up the CGNR solver for a given problem. ### Method Not specified (likely a function call in a C API) ### Endpoint Not applicable (C API function) ### Parameters - **solver** (HYPRE_Solver) - The solver object. - **A** (HYPRE_ParCSRMatrix) - The coefficient matrix. - **b** (HYPRE_ParVector) - The right-hand side vector. - **x** (HYPRE_ParVector) - The solution vector. ### Response - **Return Value** (HYPRE_Int) - Success or error code. ``` -------------------------------- ### HYPRE_ParaSailsGetLogging Source: https://hypre.readthedocs.io/en/latest/api-sol-parcsr.html Gets the logging parameter for the ParaSails preconditioner. ```APIDOC ## HYPRE_ParaSailsGetLogging Logging Getting ### Description Gets the logging parameter for the ParaSails preconditioner. ### Parameters #### Input Parameters * **solver** (HYPRE_Solver) - Solver object. #### Output Parameters * **logging** (HYPRE_Int *) - Pointer to the logging flag. ``` -------------------------------- ### Setup ParCSRParaSails Solver Source: https://hypre.readthedocs.io/en/latest/api-sol-parcsr.html Sets up the ParCSRParaSails solver with the given matrix and vectors. This function prepares the preconditioner for use. ```c HYPRE_Int HYPRE_ParCSRParaSailsSetup(HYPRE_Solver solver, HYPRE_ParCSRMatrix A, HYPRE_ParVector b, HYPRE_ParVector x) ``` -------------------------------- ### HYPRE_ParaSailsGetReuse Source: https://hypre.readthedocs.io/en/latest/api-sol-parcsr.html Gets the reuse parameter for the ParaSails preconditioner. ```APIDOC ## HYPRE_ParaSailsGetReuse Reuse Getting ### Description Gets the reuse parameter for the ParaSails preconditioner. ### Parameters #### Input Parameters * **solver** (HYPRE_Solver) - Solver object. #### Output Parameters * **reuse** (HYPRE_Int *) - Pointer to the reuse flag. ``` -------------------------------- ### HYPRE_ParaSailsGetSym Source: https://hypre.readthedocs.io/en/latest/api-sol-parcsr.html Gets the symmetry parameter for the ParaSails preconditioner. ```APIDOC ## HYPRE_ParaSailsGetSym Symmetry Getting ### Description Gets the symmetry parameter for the ParaSails preconditioner. ### Parameters #### Input Parameters * **solver** (HYPRE_Solver) - Solver object. #### Output Parameters * **sym** (HYPRE_Int *) - Pointer to the symmetry flag. ``` -------------------------------- ### HYPRE_AMESetup Source: https://hypre.readthedocs.io/en/latest/api-sol-parcsr.html Sets up the AME eigensolver. ```APIDOC ## HYPRE_AMESetup ### Description Sets up the AME eigensolver. ### Method Not applicable (C function) ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Parameters * **esolver** (HYPRE_Solver) - The solver object. ### Request Example None ### Response #### Success Response * **Return Value** (HYPRE_Int) - Success code. ``` -------------------------------- ### HYPRE_ILUSetup Source: https://hypre.readthedocs.io/en/latest/api-sol-parcsr.html Setup the ILU solver or preconditioner. If used as a preconditioner, this function should be passed to the iterative solver _SetPrecond_ function. ```APIDOC ## HYPRE_ILUSetup ### Description Setup the ILU solver or preconditioner. If used as a preconditioner, this function should be passed to the iterative solver _SetPrecond_ function. ### Method (Not specified, likely a C function call) ### Endpoint (Not applicable, this is an SDK function) ### Parameters #### Path Parameters (Not applicable) #### Query Parameters (Not applicable) #### Request Body (Not applicable) ### Request Example (Not provided in source) ### Response #### Success Response (200) (Not specified, likely an integer return code) #### Response Example (Not provided in source) ``` -------------------------------- ### HYPRE_ParaSailsGetFilter Source: https://hypre.readthedocs.io/en/latest/api-sol-parcsr.html Gets the filter parameter for the ParaSails preconditioner. ```APIDOC ## HYPRE_ParaSailsGetFilter Filter Getting ### Description Gets the filter parameter for the ParaSails preconditioner. ### Parameters #### Input Parameters * **solver** (HYPRE_Solver) - Solver object. #### Output Parameters * **filter** (HYPRE_Real *) - Pointer to the filter value. ``` -------------------------------- ### HYPRE_BoomerAMGDDSetup Source: https://hypre.readthedocs.io/en/latest/api-sol-parcsr.html Sets up the BoomerAMGDD solver or preconditioner using a ParCSR matrix and vectors. ```APIDOC ## HYPRE_BoomerAMGDDSetup ### Description Set up the BoomerAMGDD solver or preconditioner. If used as a preconditioner, this function should be passed to the iterative solver _SetPrecond_ function. ### Method (Not specified, likely a C function call) ### Endpoint (Not applicable, this is an SDK function) ### Parameters #### Path Parameters (Not applicable) #### Query Parameters (Not applicable) #### Request Body (Not applicable) ### Request Example (Not applicable) ### Response #### Success Response (0) (Not specified, likely returns HYPRE_Int) #### Response Example (Not applicable) ``` -------------------------------- ### HYPRE_ParaSailsGetNlevels Source: https://hypre.readthedocs.io/en/latest/api-sol-parcsr.html Gets the number of levels for the ParaSails preconditioner. ```APIDOC ## HYPRE_ParaSailsGetNlevels Levels Getting ### Description Gets the number of levels for the ParaSails preconditioner. ### Parameters #### Input Parameters * **solver** (HYPRE_Solver) - Solver object. #### Output Parameters * **nlevels** (HYPRE_Int *) - Pointer to the number of levels. ``` -------------------------------- ### HYPRE_ParaSailsGetThresh Source: https://hypre.readthedocs.io/en/latest/api-sol-parcsr.html Gets the threshold parameter for the ParaSails preconditioner. ```APIDOC ## HYPRE_ParaSailsGetThresh Threshold Getting ### Description Gets the threshold parameter for the ParaSails preconditioner. ### Parameters #### Input Parameters * **solver** (HYPRE_Solver) - Solver object. #### Output Parameters * **thresh** (HYPRE_Real *) - Pointer to the threshold value. ``` -------------------------------- ### HYPRE_SStructVectorGetObject Source: https://hypre.readthedocs.io/en/latest/api-int-sstruct.html Get a reference to the constructed vector object. ```APIDOC ## HYPRE_SStructVectorGetObject ### Description Get a reference to the constructed vector object. ### See also `HYPRE_SStructVectorSetObjectType` ### Method (Not specified, likely a C function call) ### Parameters - **vector** (HYPRE_SStructVector) - The SStruct vector. - **object** (void **) - Pointer to store the reference to the vector object. ``` -------------------------------- ### HYPRE_ParCSRParaSailsSetup Source: https://hypre.readthedocs.io/en/latest/api-sol-parcsr.html Sets up the ParCSR ParaSails solver. ```APIDOC ## HYPRE_ParCSRParaSailsSetup Solver Setup ### Description Sets up the ParCSR ParaSails solver. ### Parameters #### Input Parameters * **solver** (HYPRE_Solver) - Solver object. * **A** (HYPRE_ParCSRMatrix) - ParCSR matrix. * **b** (HYPRE_ParVector) - ParVector for the right-hand side. * **x** (HYPRE_ParVector) - ParVector for the solution. ``` -------------------------------- ### HYPRE_SStructMatrixGetObject Source: https://hypre.readthedocs.io/en/latest/api-int-sstruct.html Get a reference to the constructed matrix object. ```APIDOC ## HYPRE_SStructMatrixGetObject ### Description Get a reference to the constructed matrix object. ### Method (Not specified, likely a function call in a C API) ### Parameters - **matrix** (HYPRE_SStructMatrix) - The SStruct matrix. - **object** (void **) - A pointer to store the reference to the constructed matrix object. ``` -------------------------------- ### Setup Euclid Preconditioner Source: https://hypre.readthedocs.io/en/latest/api-sol-parcsr.html Sets up the Euclid preconditioner using the provided ParCSR matrix. This function should be passed to the iterative solver's _SetPrecond_ function. ```c HYPRE_Int HYPRE_EuclidSetup(HYPRE_Solver solver, HYPRE_ParCSRMatrix A, HYPRE_ParVector b, HYPRE_ParVector x) ``` -------------------------------- ### HYPRE_IJVectorGetObject Source: https://hypre.readthedocs.io/en/latest/api-int-ij.html Gets a reference to the constructed vector object. ```APIDOC ## HYPRE_IJVectorGetObject ### Description Gets a reference to the constructed vector object. ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body - **vector** (HYPRE_IJVector) - The IJVector object. - **object** (void **) - A pointer to store the reference to the constructed vector object. ### Request Example None provided in source. ### Response #### Success Response (0) - **Return Value** (HYPRE_Int) - Returns 0 on success. #### Response Example None provided in source. ``` -------------------------------- ### HYPRE_SStructLGMRESSetup Source: https://hypre.readthedocs.io/en/latest/api-sol-sstruct.html Sets up the SStruct LGMRES solver for a given system. ```APIDOC ## HYPRE_SStructLGMRESSetup ### Description Sets up the SStruct LGMRES solver for a given SStructMatrix A, SStructVector b, and SStructVector x. ### Method Not specified (likely a C function call). ### Endpoint Not applicable (SDK function). ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Request Example ```c HYPRE_Int HYPRE_SStructLGMRESSetup(HYPRE_SStructSolver solver, HYPRE_SStructMatrix A, HYPRE_SStructVector b, HYPRE_SStructVector x); ``` ### Response #### Success Response Returns HYPRE_Int, indicating success or error code. #### Response Example ```c HYPRE_Int status; ``` ``` -------------------------------- ### HYPRE_ParCSRHybridSetSetupType Source: https://hypre.readthedocs.io/en/latest/api-sol-parcsr.html Sets the setup type for the ParCSR Hybrid solver. ```APIDOC ## HYPRE_ParCSRHybridSetSetupType ### Description Sets the setup type for the ParCSR Hybrid solver. ### Method Not specified (likely a C function call) ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Request Example None ### Response #### Success Response Returns HYPRE_Int indicating success or error. #### Response Example None ``` -------------------------------- ### Basic IJ Matrix Creation and Assembly Source: https://hypre.readthedocs.io/en/latest/ch-ij.html Illustrates the fundamental steps for creating, configuring, setting values, and assembling an IJ matrix. Ensure all processes call these routines collectively. ```c MPI_Comm comm; HYPRE_IJMatrix ij_matrix; HYPRE_ParCSRMatrix parcsr_matrix; int ilower, iupper; int jlower, jupper; int nrows; int *ncols; int *rows; int *cols; double *values; HYPRE_IJMatrixCreate(comm, ilower, iupper, jlower, jupper, &ij_matrix); HYPRE_IJMatrixSetObjectType(ij_matrix, HYPRE_PARCSR); HYPRE_IJMatrixInitialize(ij_matrix); /* set matrix coefficients */ HYPRE_IJMatrixSetValues(ij_matrix, nrows, ncols, rows, cols, values); ... /* add-to matrix cofficients, if desired */ HYPRE_IJMatrixAddToValues(ij_matrix, nrows, ncols, rows, cols, values); ... HYPRE_IJMatrixAssemble(ij_matrix); HYPRE_IJMatrixGetObject(ij_matrix, (void **) &parcsr_matrix); ```