# faspxx **Repository Path**: faspdevteam/faspxx ## Basic Information - **Project Name**: faspxx - **Description**: FASP methods for fleXible and eXtensible solver development. - **Primary Language**: Unknown - **License**: LGPL-3.0 - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 2 - **Forks**: 1 - **Created**: 2024-01-18 - **Last Updated**: 2025-11-14 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # FASPXX: Fast Auxiliary Subspace Preconditioned, fleXible and eXtensible solvers FASPXX is a package of fleXible and eXtensible solvers/preconditioners, capable of solving large-scale sparse linear systems using MPI and OpenMP. The solvers can be synthesized based on the user's input defined by a JSON file. ## Directory Structure FASPXX is built upon three main abstract classes: `MAT`, `LS`, and `ITM`. - `MAT`: Matrix class - `LS` : Linear solver class - `ITM`: Iterative method class The source files are organized as follows: ```txt FASPXX ├── FASPXX_config.h ├── LICENSE ├── Makefile ├── README.md ├── config.mk ├── data // Some test data ├── example // Demonstration example ├── include // Header files ├── interface // User interface for practical applications ├── lib // library ├── src │ ├── ITM // Iterative Methods, whose implementations are fully abstracted │ ├── JSON // JSON Parser │ ├── LS // Linear Solvers' Framework and Implementations of components │ └── MAT // Matrices' Data Structure and Implementations of components └── utilities // Utilities ``` ## Build ### 1. Requirements Before starting the installation process, make sure you have the following system requirements: - MPI compiler (e.g., [OpenMPI](https://www.open-mpi.org/) or [MPICH](https://www.mpich.org/downloads/)) or Intel compiler (e.g., [oneAPI](https://www.intel.com/content/www/us/en/developer/tools/oneapi/toolkits.html#base-kit)). The latter is recommended for better performance. ### 2. Optionals - [SuperLU_DIST](https://github.com/xiaoyeli/superlu_dist) ### 3. Installation To compile the source code, modify `config.mk` to specify the compiler and flags, then run `make`. Each directory contains a `Makefile` to compile the source code in that directory and generate the corresponding library. The root `Makefile` is used to call the `Makefile` in each subdirectory to compile or clean the entire project. ### 4. Examples After installation, you can test the demo by running the following command in the example directory: ``` cd example make make run # or make mpirun4 or mpirun -np 4 ./demo demo.json ``` ### 5. Results ```txt mpirun -np 4 ./demo demo.json info: use json file: demo.json warning: Failed to get rhs_path from json file: demo.json info: use random rhs info: Read matrix from ../data/fem_small.dat on proc 0 Multilevel information (C-AMG, ParCSR): Mat A: | Level | Size | Nonzeros | nnz/row | |-------|-------------------|------------|---------| | 0 | 3969x3969 | 27281 | 6.87 | | 1 | 1471x1471 | 14267 | 9.70 | | 2 | 371x371 | 4261 | 11.49 | | 3 | 78x78 | 820 | 10.51 | | 4 | 18x18 | 148 | 8.22 | | 5 | 5x5 | 23 | 4.60 | MAT P: | Level | Size | Nonzeros | nnz/row | |-------|-------------------|------------|---------| | 0 | 3969x1471 | 6467 | 1.63 | | 1 | 1471x371 | 2547 | 1.73 | | 2 | 371x78 | 642 | 1.73 | | 3 | 78x18 | 127 | 1.63 | | 4 | 18x5 | 25 | 1.39 | MAT R: | Level | Size | Nonzeros | nnz/row | |-------|-------------------|------------|---------| | 0 | 1471x3969 | 6467 | 4.40 | | 1 | 371x1471 | 2547 | 6.87 | | 2 | 78x371 | 642 | 8.23 | | 3 | 18x78 | 127 | 7.06 | | 4 | 5x18 | 25 | 5.00 | LS: | Level | sweeps | relax_type | coarsen | interp | |-------|--------|------------------|---------|--------| | 0 | 2 | HGS | HMIS | ext+i | | 1 | 2 | HGS | HMIS | ext+i | | 2 | 2 | HGS | HMIS | ext+i | | 3 | 2 | HGS | HMIS | ext+i | | 4 | 2 | HGS | HMIS | ext+i | | 5 | 1 | LU | HMIS | ext+i | Grid complexity: 1.4895 Operator complexity: 1.7155 ============================================= Setup phase time: ============================================= ITM Setup: wall clock time = 0.009239 seconds cpu clock time = 0.008265 seconds Calling PCG solver (ParCSR) ... =================================================== Iters ||r||_2/||b||_2 ||r||_2 conv.rate ----- --------------- ----------- --------- 0 1.000000e+00 3.604860e+01 ---- 1 2.367284e-01 8.533728e+00 0.236728 2 6.975564e-02 2.514593e+00 0.294665 3 1.749831e-02 6.307896e-01 0.250852 4 3.682087e-03 1.327341e-01 0.210425 5 7.741008e-04 2.790525e-02 0.210234 6 1.785510e-04 6.436515e-03 0.230656 7 3.652557e-05 1.316696e-03 0.204567 8 7.238342e-06 2.609321e-04 0.198172 9 1.405025e-06 5.064920e-05 0.194109 10 3.502475e-07 1.262593e-05 0.249282 11 9.197399e-08 3.315534e-06 0.262597 12 2.040534e-08 7.355839e-07 0.221860 13 4.274671e-09 1.540959e-07 0.209488 ============================================= Solve phase time: ============================================= ITM Solve: wall clock time = 0.003312 seconds cpu clock time = 0.003313 seconds Iterations = 13 Final Relative Residual Norm = 4.274671e-09 info: replace named value with int to new json file: new_demo.json success: DONE ``` ## Usage Using FASPXX is straightforward. Simply provide a JSON file to set up a specific linear solver for your problem. > Note: - Users can write comment in json files by using `//` or `/* */`. However, vscode default mode does not support it. To enable it, please change the language mode to `JSON with Comments`: ``` 1. Open your JSON file in Visual Studio Code. 2. In the lower right corner, you'll see the current language mode ("JSON"). Click on it. 3. In the "Select Language Mode" dropdown, select "Configure File Association for '.json'". 4. In the list of languages that appears, select "JSON with Comments (jsonc)". ``` ## Source Code Naming Convention - `FASPXX_` is the prefix for user level API; - `faspxx_` is the prefix for internal level API; - Data structures begin with `faspxx_`, and pointers to them begin with `FASPXX_`; - All capital letters are used for the abstract class names, e.g., `MAT`, `LS`, `ITM` or some other class names, e.g., `MPI`, `OMP`, `JSON`, etc. ## Acknowledgement This project draws knowledge and experience from several existing projects, including: - faspsolver: https://github.com/FaspDevTeam/faspsolver - hypre: https://github.com/hypre-space/hypre - JXPAMG: https://math.xtu.edu.cn/solver/jxpamg.html ## License This software is free software distributed under the Lesser General Public License or LGPL, version 3.0 or any later versions. This software distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with FASPXX. If not, see .