StrumpackSparseSolver.h
1/*
2 * STRUMPACK -- STRUctured Matrices PACKage, Copyright (c) 2014, The
3 * Regents of the University of California, through Lawrence Berkeley
4 * National Laboratory (subject to receipt of any required approvals
5 * from the U.S. Dept. of Energy). All rights reserved.
6 *
7 * If you have questions about your rights to use or distribute this
8 * software, please contact Berkeley Lab's Technology Transfer
9 * Department at TTD@lbl.gov.
10 *
11 * NOTICE. This software is owned by the U.S. Department of Energy. As
12 * such, the U.S. Government has been granted for itself and others
13 * acting on its behalf a paid-up, nonexclusive, irrevocable,
14 * worldwide license in the Software to reproduce, prepare derivative
15 * works, and perform publicly and display publicly. Beginning five
16 * (5) years after the date permission to assert copyright is obtained
17 * from the U.S. Department of Energy, and subject to any subsequent
18 * five (5) year renewals, the U.S. Government is granted for itself
19 * and others acting on its behalf a paid-up, nonexclusive,
20 * irrevocable, worldwide license in the Software to reproduce,
21 * prepare derivative works, distribute copies to the public, perform
22 * publicly and display publicly, and to permit others to do so.
23 *
24 * Developers: Pieter Ghysels, Francois-Henry Rouet, Xiaoye S. Li.
25 * (Lawrence Berkeley National Lab, Computational Research
26 * Division).
27 *
28 */
29#ifndef STRUMPACK_SPARSE_SOLVER_H
30#define STRUMPACK_SPARSE_SOLVER_H
31
32#include <stdint.h>
33#include "StrumpackConfig.h"
34
35#if defined(STRUMPACK_USE_MPI)
36#define OMPI_SKIP_MPICXX 1
37#include "mpi.h"
38#endif
39
45typedef enum
46 {
47 STRUMPACK_FLOAT,
48 STRUMPACK_DOUBLE,
49 STRUMPACK_FLOATCOMPLEX,
50 STRUMPACK_DOUBLECOMPLEX,
51 STRUMPACK_FLOAT_64,
52 STRUMPACK_DOUBLE_64,
53 STRUMPACK_FLOATCOMPLEX_64,
54 STRUMPACK_DOUBLECOMPLEX_64
55 } STRUMPACK_PRECISION;
56
61typedef enum
62 {
63 STRUMPACK_MT,
64 STRUMPACK_MPI_DIST
65 } STRUMPACK_INTERFACE;
66
67typedef struct {
68 void* solver;
69 STRUMPACK_PRECISION precision;
70 STRUMPACK_INTERFACE interface;
72
73typedef enum
74 {
75 STRUMPACK_NONE=0,
76 STRUMPACK_HSS=1,
77 STRUMPACK_BLR=2,
78 STRUMPACK_HODLR=3,
79 STRUMPACK_BLR_HODLR=4,
80 STRUMPACK_ZFP_BLR_HODLR=5,
81 STRUMPACK_LOSSLESS=6,
82 STRUMPACK_LOSSY=7
83 } STRUMPACK_COMPRESSION_TYPE;
84
85typedef enum
86 {
87 STRUMPACK_MATCHING_NONE=0,
88 STRUMPACK_MATCHING_MAX_CARDINALITY=1,
89 STRUMPACK_MATCHING_MAX_SMALLEST_DIAGONAL=2,
90 STRUMPACK_MATCHING_MAX_SMALLEST_DIAGONAL_2=3,
91 STRUMPACK_MATCHING_MAX_DIAGONAL_SUM=4,
92 STRUMPACK_MATCHING_MAX_DIAGONAL_PRODUCT_SCALING=5,
93 STRUMPACK_MATCHING_COMBBLAS=6
94 } STRUMPACK_MATCHING_JOB;
95
96typedef enum
97 {
98 STRUMPACK_NATURAL=0,
99 STRUMPACK_METIS=1,
100 STRUMPACK_PARMETIS=2,
101 STRUMPACK_SCOTCH=3,
102 STRUMPACK_PTSCOTCH=4,
103 STRUMPACK_RCM=5,
104 STRUMPACK_GEOMETRIC=6,
105 STRUMPACK_AMD=7,
106 STRUMPACK_MMD=8,
107 STRUMPACK_AND=9,
108 STRUMPACK_MLF=10,
109 STRUMPACK_SPECTRAL=11,
110 } STRUMPACK_REORDERING_STRATEGY;
111
112typedef enum
113 {
114 STRUMPACK_CLASSICAL=0,
115 STRUMPACK_MODIFIED=1
116 } STRUMPACK_GRAM_SCHMIDT_TYPE;
117
118typedef enum
119 {
120 STRUMPACK_NORMAL=0,
121 STRUMPACK_UNIFORM=1
122 } STRUMPACK_RANDOM_DISTRIBUTION;
123
124typedef enum
125 {
126 STRUMPACK_LINEAR=0,
127 STRUMPACK_MERSENNE=1
128 } STRUMPACK_RANDOM_ENGINE;
129
130typedef enum
131 {
132 STRUMPACK_AUTO=0,
133 STRUMPACK_DIRECT=1,
134 STRUMPACK_REFINE=2,
135 STRUMPACK_PREC_GMRES=3,
136 STRUMPACK_GMRES=4,
137 STRUMPACK_PREC_BICGSTAB=5,
138 STRUMPACK_BICGSTAB=6
139 } STRUMPACK_KRYLOV_SOLVER;
140
141typedef enum
142 {
143 STRUMPACK_SUCCESS=0,
144 STRUMPACK_MATRIX_NOT_SET=1,
145 STRUMPACK_REORDERING_ERROR=2,
146 STRUMPACK_ZERO_PIVOT=3,
147 STRUMPACK_NO_CONVERGENCE=4,
148 STRUMPACK_INACCURATE_INERTIA=5
149 } STRUMPACK_RETURN_CODE;
150
151
152#ifdef __cplusplus
153extern "C" {
154#endif
155
156 void STRUMPACK_init_mt(STRUMPACK_SparseSolver* S,
157 STRUMPACK_PRECISION precision,
158 STRUMPACK_INTERFACE interface,
159 int argc, char* argv[], int verbose);
160
161#if defined(STRUMPACK_USE_MPI)
162 void STRUMPACK_init(STRUMPACK_SparseSolver* S, MPI_Comm comm,
163 STRUMPACK_PRECISION precision,
164 STRUMPACK_INTERFACE interface,
165 int argc, char* argv[], int verbose);
166#endif
167
168#if defined(STRUMPACK_USE_MPI) || defined(SWIG)
169 void STRUMPACK_set_distributed_csr_matrix(STRUMPACK_SparseSolver S,
170 const void* local_rows,
171 const void* row_ptr, const void* col_ind,
172 const void* values, const void* dist,
173 int symmetric_pattern);
174
175 void STRUMPACK_update_distributed_csr_matrix_values(STRUMPACK_SparseSolver S,
176 const void* local_rows,
177 const void* row_ptr, const void* col_ind,
178 const void* values, const void* dist,
179 int symmetric_pattern);
180
181 void STRUMPACK_set_MPIAIJ_matrix(STRUMPACK_SparseSolver S, const void* n,
182 const void* d_ptr, const void* d_ind, const void* d_val,
183 const void* o_ptr, const void* o_ind, const void* o_val,
184 const void* garray);
185
186 void STRUMPACK_update_MPIAIJ_matrix_values(STRUMPACK_SparseSolver S, const void* n,
187 const void* d_ptr, const void* d_ind, const void* d_val,
188 const void* o_ptr, const void* o_ind, const void* o_val,
189 const void* garray);
190#endif
191
192 void STRUMPACK_destroy(STRUMPACK_SparseSolver* S);
193
194 void STRUMPACK_set_csr_matrix(STRUMPACK_SparseSolver S,
195 const void* N, const void* row_ptr,
196 const void* col_ind, const void* values,
197 int symmetric_pattern);
198
199 void STRUMPACK_update_csr_matrix_values(STRUMPACK_SparseSolver S,
200 const void* N, const void* row_ptr,
201 const void* col_ind, const void* values,
202 int symmetric_pattern);
203
204 STRUMPACK_RETURN_CODE STRUMPACK_solve(STRUMPACK_SparseSolver S,
205 const void* b, void* x,
206 int use_initial_guess);
207
208 STRUMPACK_RETURN_CODE STRUMPACK_matsolve(STRUMPACK_SparseSolver S, int nrhs,
209 const void* b, int ldb,
210 void* x, int ldx, int use_initial_guess);
211
212 void STRUMPACK_set_from_options(STRUMPACK_SparseSolver S);
213
214 STRUMPACK_RETURN_CODE STRUMPACK_reorder(STRUMPACK_SparseSolver S);
215
216 STRUMPACK_RETURN_CODE STRUMPACK_reorder_regular(STRUMPACK_SparseSolver S,
217 int nx, int ny, int nz,
218 int components, int width);
219
220 STRUMPACK_RETURN_CODE STRUMPACK_factor(STRUMPACK_SparseSolver S);
221
222 STRUMPACK_RETURN_CODE STRUMPACK_inertia(STRUMPACK_SparseSolver S,
223 int* neg, int* zero, int* pos);
224
225 void STRUMPACK_move_to_gpu(STRUMPACK_SparseSolver S);
226
227 void STRUMPACK_remove_from_gpu(STRUMPACK_SparseSolver S);
228
229 void STRUMPACK_delete_factors(STRUMPACK_SparseSolver S);
230
231
232 /*************************************************************
233 ** Set options **********************************************
234 ************************************************************/
235 void STRUMPACK_set_verbose(STRUMPACK_SparseSolver S, int v);
236 void STRUMPACK_set_maxit(STRUMPACK_SparseSolver S, int maxit);
237 void STRUMPACK_set_gmres_restart(STRUMPACK_SparseSolver S, int m);
238 void STRUMPACK_set_rel_tol(STRUMPACK_SparseSolver S, double tol);
239 void STRUMPACK_set_abs_tol(STRUMPACK_SparseSolver S, double tol);
240 void STRUMPACK_set_nd_param(STRUMPACK_SparseSolver S, int nd_param);
241 void STRUMPACK_set_reordering_method(STRUMPACK_SparseSolver S, STRUMPACK_REORDERING_STRATEGY m);
242 void STRUMPACK_enable_METIS_NodeNDP(STRUMPACK_SparseSolver S);
243 void STRUMPACK_disable_METIS_NodeNDP(STRUMPACK_SparseSolver S);
244 void STRUMPACK_set_nx(STRUMPACK_SparseSolver S, int nx);
245 void STRUMPACK_set_ny(STRUMPACK_SparseSolver S, int ny);
246 void STRUMPACK_set_nz(STRUMPACK_SparseSolver S, int nz);
247 void STRUMPACK_set_components(STRUMPACK_SparseSolver S, int nc);
248 void STRUMPACK_set_separator_width(STRUMPACK_SparseSolver S, int w);
249 void STRUMPACK_set_GramSchmidt_type(STRUMPACK_SparseSolver S, STRUMPACK_GRAM_SCHMIDT_TYPE t);
250 void STRUMPACK_set_matching(STRUMPACK_SparseSolver S, STRUMPACK_MATCHING_JOB job);
251 void STRUMPACK_set_Krylov_solver(STRUMPACK_SparseSolver S, STRUMPACK_KRYLOV_SOLVER solver_type);
252 void STRUMPACK_enable_gpu(STRUMPACK_SparseSolver S);
253 void STRUMPACK_disable_gpu(STRUMPACK_SparseSolver S);
254 void STRUMPACK_set_compression(STRUMPACK_SparseSolver S, STRUMPACK_COMPRESSION_TYPE t);
255 void STRUMPACK_set_compression_min_sep_size(STRUMPACK_SparseSolver S, int size);
256 void STRUMPACK_set_compression_min_front_size(STRUMPACK_SparseSolver S, int size);
257 void STRUMPACK_set_compression_leaf_size(STRUMPACK_SparseSolver S, int size);
258 void STRUMPACK_set_compression_rel_tol(STRUMPACK_SparseSolver S, double rctol);
259 void STRUMPACK_set_compression_abs_tol(STRUMPACK_SparseSolver S, double actol);
260 void STRUMPACK_set_compression_butterfly_levels(STRUMPACK_SparseSolver S, int l);
261 void STRUMPACK_set_compression_lossy_precision(STRUMPACK_SparseSolver S, int p);
262
263 /*************************************************************
264 ** Get options **********************************************
265 ************************************************************/
266 int STRUMPACK_verbose(STRUMPACK_SparseSolver S);
267 int STRUMPACK_maxit(STRUMPACK_SparseSolver S);
268 int STRUMPACK_get_gmres_restart(STRUMPACK_SparseSolver S);
269 double STRUMPACK_rel_tol(STRUMPACK_SparseSolver S);
270 double STRUMPACK_abs_tol(STRUMPACK_SparseSolver S);
271 int STRUMPACK_nd_param(STRUMPACK_SparseSolver S);
272 STRUMPACK_REORDERING_STRATEGY STRUMPACK_reordering_method(STRUMPACK_SparseSolver S);
273 int STRUMPACK_use_METIS_NodeNDP(STRUMPACK_SparseSolver S);
274 STRUMPACK_MATCHING_JOB STRUMPACK_matching(STRUMPACK_SparseSolver S);
275 STRUMPACK_GRAM_SCHMIDT_TYPE STRUMPACK_GramSchmidt_type(STRUMPACK_SparseSolver S);
276 STRUMPACK_KRYLOV_SOLVER STRUMPACK_Krylov_solver(STRUMPACK_SparseSolver S);
277 int STRUMPACK_use_gpu(STRUMPACK_SparseSolver S);
278 STRUMPACK_COMPRESSION_TYPE STRUMPACK_compression(STRUMPACK_SparseSolver S);
279 int STRUMPACK_compression_min_sep_size(STRUMPACK_SparseSolver S);
280 int STRUMPACK_compression_min_front_size(STRUMPACK_SparseSolver S);
281 int STRUMPACK_compression_leaf_size(STRUMPACK_SparseSolver S);
282 double STRUMPACK_compression_rel_tol(STRUMPACK_SparseSolver S);
283 double STRUMPACK_compression_abs_tol(STRUMPACK_SparseSolver S);
284 int STRUMPACK_compression_butterfly_levels(STRUMPACK_SparseSolver S);
285 int STRUMPACK_compression_lossy_precision(STRUMPACK_SparseSolver S);
286
287 /*************************************************************
288 ** Get solve statistics *************************************
289 ************************************************************/
290 int STRUMPACK_its(STRUMPACK_SparseSolver S);
291 int STRUMPACK_rank(STRUMPACK_SparseSolver S);
292 long long STRUMPACK_factor_nonzeros(STRUMPACK_SparseSolver S);
293 long long STRUMPACK_factor_memory(STRUMPACK_SparseSolver S);
294
295
296
297 /*************************************************************
298 ** Deprecated routines **************************************
299 ************************************************************/
300 void STRUMPACK_set_mc64job(STRUMPACK_SparseSolver S, int job);
301 int STRUMPACK_mc64job(STRUMPACK_SparseSolver S);
302 void STRUMPACK_enable_HSS(STRUMPACK_SparseSolver S);
303 void STRUMPACK_disable_HSS(STRUMPACK_SparseSolver S);
304 void STRUMPACK_set_HSS_min_front_size(STRUMPACK_SparseSolver S, int size);
305 void STRUMPACK_set_HSS_min_sep_size(STRUMPACK_SparseSolver S, int size);
306 void STRUMPACK_set_HSS_max_rank(STRUMPACK_SparseSolver S, int max_rank);
307 void STRUMPACK_set_HSS_leaf_size(STRUMPACK_SparseSolver S, int leaf_size);
308 void STRUMPACK_set_HSS_rel_tol(STRUMPACK_SparseSolver S, double rctol);
309 void STRUMPACK_set_HSS_abs_tol(STRUMPACK_SparseSolver S, double actol);
310 int use_HSS(STRUMPACK_SparseSolver S);
311 int STRUMPACK_HSS_min_front_size(STRUMPACK_SparseSolver S);
312 int STRUMPACK_HSS_min_sep_size(STRUMPACK_SparseSolver S);
313 int STRUMPACK_HSS_max_rank(STRUMPACK_SparseSolver S);
314 int STRUMPACK_HSS_leaf_size(STRUMPACK_SparseSolver S);
315 double STRUMPACK_HSS_rel_tol(STRUMPACK_SparseSolver S);
316 double STRUMPACK_HSS_abs_tol(STRUMPACK_SparseSolver S);
317
318#ifdef __cplusplus
319}
320#endif
321
322#endif
Definition: StrumpackSparseSolver.h:67