Hypredrive
High-level interface for solving linear systems with hypre
Install / Use
/learn @hypre-space/HypredriveREADME
hypredrive
High-level interface to hypre for solving sparse linear systems of equations. It can be used as:
- Driver:
hypredrive-cliexecutable with YAML input files, for exampleexamples/ex2.yml - Library: C API via
include/HYPREDRV.hdriven by YAML input (file or in-memory), seeexamples/src/
Build
git clone --depth 1 https://github.com/hypre-space/hypredrive.git
cmake -DHYPREDRV_ENABLE_DATA=ON -S hypredrive -B build && cmake --build build -j -t check
- hypre is fetched automatically if not found. Pass
-DHYPRE_ROOT=<path>to use an existing install. - Check installation instructions for details, including the available library options.
Examples
Driver -- solve a system from a YAML file (see examples files in the docs).
mpirun -np 1 ./build/hypredrive-cli examples/ex2.yml -q
Library -- call the API from your own code (see example drivers in the docs).
// 1. Setup hypredrive options from YAML input
HYPREDRV_t hdrv = NULL;
HYPREDRV_Initialize();
HYPREDRV_Create(MPI_COMM_WORLD, &hdrv);
HYPREDRV_SetLibraryMode(hdrv);
HYPREDRV_InputArgsParse(1, yaml_text, hdrv); // Solver options are parsed here
// 2. Setup linear system ("A" and "b" are built previously)
HYPREDRV_LinearSystemSetMatrix(hdrv, (HYPRE_Matrix) A);
HYPREDRV_LinearSystemSetRHS(hdrv, (HYPRE_Vector) b);
// 3. Solve lifecycle (Solve for "x" in "A x = b")
HYPREDRV_LinearSolverCreate(hdrv);
HYPREDRV_LinearSolverSetup(hdrv);
HYPREDRV_LinearSolverApply(hdrv);
HYPREDRV_LinearSolverDestroy(hdrv);
// 4. Cleanup
HYPREDRV_Destroy(&hdrv);
HYPREDRV_Finalize();
Documentation is available at hypredrive.readthedocs.io. For contribution instructions, see CONTRIBUTING.md.
Citation
Magri, V. A. P. (2024). Hypredrive: High-level interface for solving linear systems with hypre. JOSS, 9(98), 6654. https://doi.org/10.21105/joss.06654
See also CITATION.cff.
License
This project is licensed under the MIT License - see the LICENSE file for details. All new contributions must be made under this license.
SPDX-License-Identifier: MIT
LLNL-CODE-861860
