Ifpack Package Browser (Single Doxygen Collection)
Development
Toggle main menu visibility
Loading...
Searching...
No Matches
src
euclid
Euclid_dh.h
Go to the documentation of this file.
1
/*@HEADER
2
// ***********************************************************************
3
//
4
// Ifpack: Object-Oriented Algebraic Preconditioner Package
5
// Copyright (2002) Sandia Corporation
6
//
7
// Under terms of Contract DE-AC04-94AL85000, there is a non-exclusive
8
// license for use of this work by or on behalf of the U.S. Government.
9
//
10
// Redistribution and use in source and binary forms, with or without
11
// modification, are permitted provided that the following conditions are
12
// met:
13
//
14
// 1. Redistributions of source code must retain the above copyright
15
// notice, this list of conditions and the following disclaimer.
16
//
17
// 2. Redistributions in binary form must reproduce the above copyright
18
// notice, this list of conditions and the following disclaimer in the
19
// documentation and/or other materials provided with the distribution.
20
//
21
// 3. Neither the name of the Corporation nor the names of the
22
// contributors may be used to endorse or promote products derived from
23
// this software without specific prior written permission.
24
//
25
// THIS SOFTWARE IS PROVIDED BY SANDIA CORPORATION "AS IS" AND ANY
26
// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
27
// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
28
// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL SANDIA CORPORATION OR THE
29
// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
30
// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
31
// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
32
// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
33
// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
34
// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
35
// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
36
//
37
// Questions? Contact Michael A. Heroux (maherou@sandia.gov)
38
//
39
// ***********************************************************************
40
//@HEADER
41
*/
42
43
#ifndef EUCLID_MPI_INTERFACE_DH
44
#define EUCLID_MPI_INTERFACE_DH
45
46
#define DEFAULT_DROP_TOL 0.01
47
48
#include "
euclid_common.h
"
49
50
/*======================================================================
51
* Naming convention: functions ending in _mpi are located in
52
* src/Euclid_mpi.c; those ending in _seq are in src/Euclid_seq.c;
53
* most others should be in Euclid_all.c.
54
*
55
* Exceptions: all Apply() (triangular solves) are in src/Euclid_apply.c;
56
* except for the Apply for MPI PILU, which is called
57
* Mat_dhSolve, and is in src/Mat_dh.c
58
*
59
* Users should only need to call functions with names of the form
60
* Euclid_dhXXX (public functions).
61
*
62
* Some of the functions whose names are of the form XXX_private_XXX,
63
* as could easily be static functions; similarly, the enums and
64
* structs do need to be public. They are, primarily, for ease in
65
* debugging and ready reference.
66
*
67
* Exceptions: the apply_private functions aren't listed here --- they're
68
* all static in src/Euclid_apply.c
69
*======================================================================*/
70
#ifdef __cplusplus
71
extern
"C"
72
{
73
#endif
74
75
extern
void
Euclid_dhCreate
(
Euclid_dh
* ctxOUT);
76
extern
void
Euclid_dhDestroy
(
Euclid_dh
ctx);
77
extern
void
Euclid_dhSetup
(
Euclid_dh
ctx);
78
extern
void
Euclid_dhSolve
(
Euclid_dh
ctx,
Vec_dh
lhs,
Vec_dh
rhs,
79
int
*its);
80
extern
void
Euclid_dhApply
(
Euclid_dh
ctx,
double
*lhs,
double
*rhs);
81
82
extern
void
Euclid_dhPrintTestData
(
Euclid_dh
ctx, FILE * fp);
83
extern
void
Euclid_dhPrintScaling
(
Euclid_dh
ctx, FILE * fp);
84
85
extern
void
Euclid_dhPrintStatsShort
(
Euclid_dh
ctx,
double
setup,
86
double
solve, FILE * fp);
87
88
89
extern
void
Euclid_dhPrintStatsShorter
(
Euclid_dh
ctx, FILE * fp);
90
/* on-line reporting, for making quick tables */
91
92
extern
void
Euclid_dhPrintHypreReport
(
Euclid_dh
ctx, FILE * fp);
93
94
extern
void
Euclid_dhPrintStats
(
Euclid_dh
ctx, FILE * fp);
95
/* prints same info as Euclid_dhPrintParams(), but also
96
prints timing information, number of iterations, etc;
97
may be called after solve is completed.
98
*/
99
100
101
/*----------------------------------------------------------------------
102
* Private data structures
103
*----------------------------------------------------------------------*/
104
105
#define MAX_OPT_LEN 20
106
107
/* for internal timing */
108
#define TIMING_BINS 10
109
enum
110
{
SOLVE_START_T
,
111
TRI_SOLVE_T
,
/* triangular solves */
112
SETUP_T
,
/* total setup */
113
SUB_GRAPH_T
,
/* setup SubdomainGraph_dh */
114
FACTOR_T
,
/* factorization */
115
SOLVE_SETUP_T
,
/* setup for solves */
116
COMPUTE_RHO_T
,
117
/* note: SETUP_T - (FACTOR_T + SUB_GRAPH_T) should be small! */
118
TOTAL_SOLVE_TEMP_T
,
119
TOTAL_SOLVE_T
120
};
121
122
/* for statistical reporting */
123
#define STATS_BINS 10
124
enum
125
{
NZA_STATS
,
/* cumulative nonzeros for all systems solved */
126
NZF_STATS
,
/* cumulative nonzeros for all systems solved */
127
NZA_USED_STATS
,
/* cumulative nonzeros NOT dropped by sparseA */
128
NZA_RATIO_STATS
/* NZA_USED_STATS/NZA_STATS, over all processors */
129
};
130
131
132
/* primary data structure: this is monstrously long; but it works.
133
Users must ensure the following fields are initialized prior
134
to calling Euclid_dhSetup(): m, n, beg_row, A
135
*/
136
struct
_mpi_interface_dh
137
{
138
bool
isSetup
;
139
140
double
rho_init
;
141
double
rho_final
;
142
/* Memory allocation for factor; will initially allocate space for
143
rho_init*nzA nonzeros; rho_final is computed after factorization,
144
and is the minimum that rho_init whoulc have been to avoid
145
memory reallocation; rho_final is a maximum across all processors.
146
*/
147
148
int
m
;
/* local rows in matrix */
149
int
n
;
/* global rows in matrix */
150
double
*
rhs
;
/* used for debugging; this vector is not owned! */
151
void
*
A
;
/* void-pointer to Epetra_CrsMatrix */
152
Factor_dh
F
;
/* data structure for the factor, F = L+U-I */
153
SubdomainGraph_dh
sg
;
154
155
REAL_DH
*
scale
;
/* row scaling vector */
156
bool
isScaled
;
/* set at runtime, turns scaling on or off */
157
158
/* workspace for factorization and triangular solves */
159
double
*
work
;
160
double
*
work2
;
161
int
from
,
to
;
/* which local rows to factor or solve */
162
163
/* runtime parameters (mostly) */
164
char
algo_par
[
MAX_OPT_LEN
];
/* parallelization strategy */
165
char
algo_ilu
[
MAX_OPT_LEN
];
/* ILU factorization method */
166
int
level
;
/* for ILU(k) */
167
double
droptol
;
/* for ILUT */
168
double
sparseTolA
;
/* for sparsifying A */
169
double
sparseTolF
;
/* for sparsifying the factors */
170
double
pivotMin
;
/* if pivots are <= to this value, fix 'em */
171
double
pivotFix
;
/* multiplier for adjusting small pivots */
172
double
maxVal
;
/* largest abs. value in matrix */
173
174
/* data structures for parallel ilu (pilu) */
175
SortedList_dh
slist
;
176
ExternalRows_dh
extRows
;
177
178
/* for use with Euclid's internal krylov solvers; */
179
char
krylovMethod
[
MAX_OPT_LEN
];
180
int
maxIts
;
181
double
rtol
;
182
double
atol
;
183
int
its
;
/* number of times preconditioner was applied since last call to Setup */
184
int
itsTotal
;
/* cululative number of times preconditioner was applied */
185
186
/* internal statistics */
187
int
setupCount
;
188
int
logging
;
189
double
timing
[
TIMING_BINS
];
190
double
stats
[
STATS_BINS
];
191
bool
timingsWereReduced
;
192
bool
printStats
;
/* if true, on 2nd and subsequent calls to Setup,
193
calls Euclid_dhPrintStatsShorter(). Intent is to
194
print out stats for each setup phase when
195
using Euclid, e.g, for nonlinear solves.
196
*/
197
};
198
199
#ifdef __cplusplus
200
}
201
#endif
202
#endif
/* #ifndef EUCLID_MPI_INTERFACE_DH */
Euclid_dhPrintStats
void Euclid_dhPrintStats(Euclid_dh ctx, FILE *fp)
Definition
Euclid_dh.c:868
STATS_BINS
#define STATS_BINS
Definition
Euclid_dh.h:123
Euclid_dhSolve
void Euclid_dhSolve(Euclid_dh ctx, Vec_dh lhs, Vec_dh rhs, int *its)
Definition
Euclid_dh.c:842
Euclid_dhPrintTestData
void Euclid_dhPrintTestData(Euclid_dh ctx, FILE *fp)
Definition
Euclid_dh.c:1177
MAX_OPT_LEN
#define MAX_OPT_LEN
Definition
Euclid_dh.h:105
TIMING_BINS
#define TIMING_BINS
Definition
Euclid_dh.h:108
Euclid_dhDestroy
void Euclid_dhDestroy(Euclid_dh ctx)
Definition
Euclid_dh.c:133
Euclid_dhSetup
void Euclid_dhSetup(Euclid_dh ctx)
Definition
Euclid_dh.c:199
Euclid_dhCreate
void Euclid_dhCreate(Euclid_dh *ctxOUT)
Definition
Euclid_dh.c:66
NZA_STATS
@ NZA_STATS
Definition
Euclid_dh.h:125
NZF_STATS
@ NZF_STATS
Definition
Euclid_dh.h:126
NZA_USED_STATS
@ NZA_USED_STATS
Definition
Euclid_dh.h:127
NZA_RATIO_STATS
@ NZA_RATIO_STATS
Definition
Euclid_dh.h:128
Euclid_dhApply
void Euclid_dhApply(Euclid_dh ctx, double *lhs, double *rhs)
Definition
Euclid_apply.c:60
Euclid_dhPrintStatsShort
void Euclid_dhPrintStatsShort(Euclid_dh ctx, double setup, double solve, FILE *fp)
Definition
Euclid_dh.c:945
Euclid_dhPrintHypreReport
void Euclid_dhPrintHypreReport(Euclid_dh ctx, FILE *fp)
Definition
Euclid_dh.c:1098
Euclid_dhPrintScaling
void Euclid_dhPrintScaling(Euclid_dh ctx, FILE *fp)
Definition
Euclid_dh.c:1058
Euclid_dhPrintStatsShorter
void Euclid_dhPrintStatsShorter(Euclid_dh ctx, FILE *fp)
Definition
Euclid_dh.c:1039
COMPUTE_RHO_T
@ COMPUTE_RHO_T
Definition
Euclid_dh.h:116
SUB_GRAPH_T
@ SUB_GRAPH_T
Definition
Euclid_dh.h:113
TRI_SOLVE_T
@ TRI_SOLVE_T
Definition
Euclid_dh.h:111
SOLVE_START_T
@ SOLVE_START_T
Definition
Euclid_dh.h:110
TOTAL_SOLVE_T
@ TOTAL_SOLVE_T
Definition
Euclid_dh.h:119
FACTOR_T
@ FACTOR_T
Definition
Euclid_dh.h:114
TOTAL_SOLVE_TEMP_T
@ TOTAL_SOLVE_TEMP_T
Definition
Euclid_dh.h:118
SETUP_T
@ SETUP_T
Definition
Euclid_dh.h:112
SOLVE_SETUP_T
@ SOLVE_SETUP_T
Definition
Euclid_dh.h:115
euclid_common.h
Euclid_dh
struct _mpi_interface_dh * Euclid_dh
Definition
euclid_common.h:91
Vec_dh
struct _vec_dh * Vec_dh
Definition
euclid_common.h:87
ExternalRows_dh
struct _extrows_dh * ExternalRows_dh
Definition
euclid_common.h:93
SortedList_dh
struct _sortedList_dh * SortedList_dh
Definition
euclid_common.h:92
SubdomainGraph_dh
struct _subdomain_dh * SubdomainGraph_dh
Definition
euclid_common.h:80
REAL_DH
#define REAL_DH
Definition
euclid_common.h:53
Factor_dh
struct _factor_dh * Factor_dh
Definition
euclid_common.h:86
_mpi_interface_dh
Definition
Euclid_dh.h:137
_mpi_interface_dh::printStats
bool printStats
Definition
Euclid_dh.h:192
_mpi_interface_dh::work
double * work
Definition
Euclid_dh.h:159
_mpi_interface_dh::timingsWereReduced
bool timingsWereReduced
Definition
Euclid_dh.h:191
_mpi_interface_dh::F
Factor_dh F
Definition
Euclid_dh.h:152
_mpi_interface_dh::itsTotal
int itsTotal
Definition
Euclid_dh.h:184
_mpi_interface_dh::atol
double atol
Definition
Euclid_dh.h:182
_mpi_interface_dh::logging
int logging
Definition
Euclid_dh.h:188
_mpi_interface_dh::m
int m
Definition
Euclid_dh.h:148
_mpi_interface_dh::n
int n
Definition
Euclid_dh.h:149
_mpi_interface_dh::droptol
double droptol
Definition
Euclid_dh.h:167
_mpi_interface_dh::sg
SubdomainGraph_dh sg
Definition
Euclid_dh.h:153
_mpi_interface_dh::maxIts
int maxIts
Definition
Euclid_dh.h:180
_mpi_interface_dh::slist
SortedList_dh slist
Definition
Euclid_dh.h:175
_mpi_interface_dh::rtol
double rtol
Definition
Euclid_dh.h:181
_mpi_interface_dh::sparseTolF
double sparseTolF
Definition
Euclid_dh.h:169
_mpi_interface_dh::krylovMethod
char krylovMethod[MAX_OPT_LEN]
Definition
Euclid_dh.h:179
_mpi_interface_dh::maxVal
double maxVal
Definition
Euclid_dh.h:172
_mpi_interface_dh::to
int to
Definition
Euclid_dh.h:161
_mpi_interface_dh::work2
double * work2
Definition
Euclid_dh.h:160
_mpi_interface_dh::algo_par
char algo_par[MAX_OPT_LEN]
Definition
Euclid_dh.h:164
_mpi_interface_dh::rho_init
double rho_init
Definition
Euclid_dh.h:140
_mpi_interface_dh::isScaled
bool isScaled
Definition
Euclid_dh.h:156
_mpi_interface_dh::timing
double timing[TIMING_BINS]
Definition
Euclid_dh.h:189
_mpi_interface_dh::pivotFix
double pivotFix
Definition
Euclid_dh.h:171
_mpi_interface_dh::scale
REAL_DH * scale
Definition
Euclid_dh.h:155
_mpi_interface_dh::rho_final
double rho_final
Definition
Euclid_dh.h:141
_mpi_interface_dh::from
int from
Definition
Euclid_dh.h:161
_mpi_interface_dh::rhs
double * rhs
Definition
Euclid_dh.h:150
_mpi_interface_dh::algo_ilu
char algo_ilu[MAX_OPT_LEN]
Definition
Euclid_dh.h:165
_mpi_interface_dh::sparseTolA
double sparseTolA
Definition
Euclid_dh.h:168
_mpi_interface_dh::its
int its
Definition
Euclid_dh.h:183
_mpi_interface_dh::level
int level
Definition
Euclid_dh.h:166
_mpi_interface_dh::stats
double stats[STATS_BINS]
Definition
Euclid_dh.h:190
_mpi_interface_dh::isSetup
bool isSetup
Definition
Euclid_dh.h:138
_mpi_interface_dh::setupCount
int setupCount
Definition
Euclid_dh.h:187
_mpi_interface_dh::A
void * A
Definition
Euclid_dh.h:151
_mpi_interface_dh::extRows
ExternalRows_dh extRows
Definition
Euclid_dh.h:176
_mpi_interface_dh::pivotMin
double pivotMin
Definition
Euclid_dh.h:170
Generated by
1.17.0