TridiagLU  1.0
Scalable, parallel solver for tridiagonal system of equations
tridiagLU.h
Go to the documentation of this file.
1 
6 /*
7 
8  Parallel direct solver for tridiagonal systems
9 
10  tridiagLU (a,b,c,x,n,ns,r,m) - Parallel tridiagonal solver
11 
12  Solves the tridiagonal system in parallel by reordering the
13  points such that the first point of each subdomain is placed
14  at the end.
15 
16  The interior points are eliminated in parallel, resulting in
17  a reduced system consisting of the first point of each sub-
18  domain.
19 
20  This reduced system is solved either by the gather-and-
21  solve (tridiagLUGS) or the recursive-doubling (tridiagLURD)
22  algorithms.
23 
24  tridiagLUGS(a,b,c,x,n,ns,r,m) - Tridiagonal solver based on
25  "gather and solve"
26 
27  Each of the "ns" systems is gathered on one processor,
28  solved in serial, and the solution scattered back. The
29  parallelism lies in solving the "ns" different systems
30  by multiple processors (i.e., each processor solves
31  ~ns/nproc number of systems in serial).
32 
33  Arguments:-
34  a [0,ns-1]x[0,n-1] double* subdiagonal entries
35  b [0,ns-1]x[0,n-1] double* diagonal entries
36  c [0,ns-1]x[0,n-1] double* superdiagonal entries
37  x [0,ns-1]x[0,n-1] double* right-hand side (solution)
38  n int local size of the system
39  ns int number of systems to solve
40  r TridiagLU* structure containing paramters
41  for the tridiagonal solve and
42  the walltimes:
43  total_time
44  stage1_time
45  stage2_time
46  stage3_time
47  stage4_time
48  ** Note that these are process-specific. Calling
49  function needs to do something to add/average
50  them to get some global value.
51  ** Can be NULL if runtimes are not needed.
52  m MPI_Comm* MPI Communicator
53 
54  For a,b,c, and x, [0,ns-1] is the inner loop, i.e., the i-th row of the
55  d-th system is a[i*ns+d], b[i*ns+d], c[i*ns+d] and x[i*ns+d].
56 
57  Return value (int) -> 0 (successful solve), -1 (singular system)
58 
59  Note:-
60  x contains the final solution (right-hand side is replaced)
61  a,b,c are not preserved
62  On rank=0, a[0*ns+d] has to be zero for all d.
63  On rank=nproc-1, c[(n-1)*ns+d] has to be zero for all d.
64 
65  For a serial tridiagonal solver, compile with the flag "-Dserial"
66  or send NULL as the argument for the MPI communicator.
67 
68 */
69 
71 #define _TRIDIAG_JACOBI_ "jacobi"
72 
73 #define _TRIDIAG_GS_ "gather-and-solve"
74 
81 typedef struct _tridiagLU_ {
82 
83  /* Parameters for tridiagLU() */
84 
88  char reducedsolvetype[50];
89 
91  int maxiter;
92  double atol,
93  rtol;
94  int exititer;
95  double exitnorm;
96  int verbose;
98  double total_time;
99  double stage1_time;
100  double stage2_time;
101  double stage3_time;
102  double stage4_time;
104 #ifdef with_scalapack
107 #endif
108 
109 } TridiagLU;
110 
111 int tridiagLU (double*,double*,double*,double*,int,int,void*,void*);
112 int tridiagLUGS (double*,double*,double*,double*,int,int,void*,void*);
113 int tridiagIterJacobi (double*,double*,double*,double*,int,int,void*,void*);
114 int tridiagLUInit (void*,void*);
115 
116 /* Block solvers */
117 int blocktridiagLU (double*,double*,double*,double*,int,int,int,void*,void*);
118 int blocktridiagIterJacobi (double*,double*,double*,double*,int,int,int,void*,void*);
119 
120 #ifdef with_scalapack
121 /* ScaLAPACK interface */
122 int tridiagScaLPK (double*,double*,double*,double*,int,int,void*,void*);
123 #endif
double stage3_time
Definition: tridiagLU.h:101
int tridiagLUGS(double *, double *, double *, double *, int, int, void *, void *)
Definition: tridiagLUGS.c:64
int maxiter
Definition: tridiagLU.h:91
int tridiagScaLPK(double *, double *, double *, double *, int, int, void *, void *)
Definition: tridiagScaLPK.c:71
int tridiagLUInit(void *, void *)
Definition: tridiagLUInit.c:39
double stage2_time
Definition: tridiagLU.h:100
int blacs_ctxt
Definition: tridiagLU.h:105
double rtol
Definition: tridiagLU.h:92
int tridiagLU(double *, double *, double *, double *, int, int, void *, void *)
Definition: tridiagLU.c:83
int exititer
Definition: tridiagLU.h:94
double stage1_time
Definition: tridiagLU.h:99
int evaluate_norm
Definition: tridiagLU.h:90
double stage4_time
Definition: tridiagLU.h:102
int blocktridiagIterJacobi(double *, double *, double *, double *, int, int, int, void *, void *)
int tridiagIterJacobi(double *, double *, double *, double *, int, int, void *, void *)
int verbose
Definition: tridiagLU.h:96
double total_time
Definition: tridiagLU.h:98
double exitnorm
Definition: tridiagLU.h:95
int blocktridiagLU(double *, double *, double *, double *, int, int, int, void *, void *)