Skip to content

Commit 173c260

Browse files
committed
Double complex version added
1 parent 4fe9531 commit 173c260

36 files changed

+8760
-4527
lines changed

EXAMPLE/dcreate_matrix.c

Lines changed: 13 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -63,8 +63,7 @@ at the top-level directory.
6363
* </pre>
6464
*/
6565

66-
67-
int dcreate_matrix(SuperMatrix *A, int nrhs, double **rhs,
66+
int dcreate_matrix(SuperMatrix *A, int nrhs, double **rhs,
6867
int *ldb, double **x, int *ldx,
6968
FILE *fp, gridinfo_t *grid)
7069
{
@@ -90,14 +89,14 @@ at the top-level directory.
9089
#endif
9190

9291
if ( !iam ) {
93-
double t = SuperLU_timer_();
92+
double t = SuperLU_timer_();
93+
94+
/* Read the matrix stored on disk in Harwell-Boeing format. */
95+
dreadhb_dist(iam, fp, &m, &n, &nnz, &nzval, &rowind, &colptr);
9496

95-
/* Read the matrix stored on disk in Harwell-Boeing format. */
96-
dreadhb_dist(iam, fp, &m, &n, &nnz, &nzval, &rowind, &colptr);
97-
9897
printf("Time to read and distribute matrix %.2f\n",
99-
SuperLU_timer_() - t); fflush(stdout);
100-
98+
SuperLU_timer_() - t); fflush(stdout);
99+
101100
/* Broadcast matrix A to the other PEs. */
102101
MPI_Bcast( &m, 1, mpi_int_t, 0, grid->comm );
103102
MPI_Bcast( &n, 1, mpi_int_t, 0, grid->comm );
@@ -235,9 +234,8 @@ at the top-level directory.
235234
return 0;
236235
}
237236

238-
239-
240-
237+
238+
241239
int dcreate_matrix_postfix(SuperMatrix *A, int nrhs, double **rhs,
242240
int *ldb, double **x, int *ldx,
243241
FILE *fp, char * postfix, gridinfo_t *grid)
@@ -264,8 +262,9 @@ int dcreate_matrix_postfix(SuperMatrix *A, int nrhs, double **rhs,
264262
#endif
265263

266264
if ( !iam ) {
267-
double t = SuperLU_timer_();
268-
if(!strcmp(postfix,"rua")){
265+
double t = SuperLU_timer_();
266+
267+
if(!strcmp(postfix,"rua")){
269268
/* Read the matrix stored on disk in Harwell-Boeing format. */
270269
dreadhb_dist(iam, fp, &m, &n, &nnz, &nzval, &rowind, &colptr);
271270
}else if(!strcmp(postfix,"mtx")){
@@ -286,7 +285,7 @@ int dcreate_matrix_postfix(SuperMatrix *A, int nrhs, double **rhs,
286285

287286
printf("Time to read and distribute matrix %.2f\n",
288287
SuperLU_timer_() - t); fflush(stdout);
289-
288+
290289
/* Broadcast matrix A to the other PEs. */
291290
MPI_Bcast( &m, 1, mpi_int_t, 0, grid->comm );
292291
MPI_Bcast( &n, 1, mpi_int_t, 0, grid->comm );

EXAMPLE/dcreate_matrix_perturbed.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -258,7 +258,7 @@ int dcreate_matrix_perturbed_postfix(SuperMatrix *A, int nrhs, double **rhs,
258258

259259
if ( !iam ) {
260260
double t = SuperLU_timer_();
261-
if(!strcmp(postfix,"rua")){
261+
if(!strcmp(postfix,"rua")){
262262
/* Read the matrix stored on disk in Harwell-Boeing format. */
263263
dreadhb_dist(iam, fp, &m, &n, &nnz, &nzval, &rowind, &colptr);
264264
}else if(!strcmp(postfix,"mtx")){
@@ -279,7 +279,7 @@ int dcreate_matrix_perturbed_postfix(SuperMatrix *A, int nrhs, double **rhs,
279279

280280
printf("Time to read and distribute matrix %.2f\n",
281281
SuperLU_timer_() - t); fflush(stdout);
282-
282+
283283
/* Broadcast matrix A to the other PEs. */
284284
MPI_Bcast( &m, 1, mpi_int_t, 0, grid->comm );
285285
MPI_Bcast( &n, 1, mpi_int_t, 0, grid->comm );
@@ -416,4 +416,4 @@ int dcreate_matrix_perturbed_postfix(SuperMatrix *A, int nrhs, double **rhs,
416416
CHECK_MALLOC(iam, "Exit dcreate_matrix()");
417417
#endif
418418
return 0;
419-
}
419+
}

EXAMPLE/pddrive.c

Lines changed: 13 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@ at the top-level directory.
2222
*/
2323

2424
#include <math.h>
25-
#include <superlu_dist_config.h>
2625
#include "superlu_ddefs.h"
2726

2827
/*! \brief
@@ -62,16 +61,16 @@ int main(int argc, char *argv[])
6261
int m, n;
6362
int nprow, npcol;
6463
int iam, info, ldb, ldx, nrhs;
65-
char **cpp, c, *postfix;
64+
char **cpp, c, *postfix;;
6665
FILE *fp, *fopen();
6766
int cpp_defs();
6867
int ii;
6968
int omp_mpi_level;
7069

7170
nprow = 1; /* Default process rows. */
7271
npcol = 1; /* Default process columns. */
73-
nrhs =1; /* Number of right-hand side. */
74-
72+
nrhs = 1; /* Number of right-hand side. */
73+
7574
/* ------------------------------------------------------------
7675
INITIALIZE MPI ENVIRONMENT.
7776
------------------------------------------------------------*/
@@ -86,7 +85,7 @@ int main(int argc, char *argv[])
8685
#if ( VTUNE>=1 )
8786
__itt_pause();
8887
#endif
89-
88+
9089
/* Parse command line argv[]. */
9190
for (cpp = argv+1; *cpp; ++cpp) {
9291
if ( **cpp == '-' ) {
@@ -116,7 +115,7 @@ int main(int argc, char *argv[])
116115
INITIALIZE THE SUPERLU PROCESS GRID.
117116
------------------------------------------------------------*/
118117
superlu_gridinit(MPI_COMM_WORLD, nprow, npcol, &grid);
119-
118+
120119
if(grid.iam==0){
121120
MPI_Query_thread(&omp_mpi_level);
122121
switch (omp_mpi_level) {
@@ -138,7 +137,7 @@ int main(int argc, char *argv[])
138137
break;
139138
}
140139
}
141-
140+
142141
/* Bail out if I do not belong in the grid. */
143142
iam = grid.iam;
144143
if ( iam >= nprow * npcol ) goto out;
@@ -167,7 +166,6 @@ int main(int argc, char *argv[])
167166
}
168167
// printf("%s\n", postfix);
169168

170-
171169
/* ------------------------------------------------------------
172170
GET THE MATRIX FROM FILE AND SETUP THE RIGHT HAND SIDE.
173171
------------------------------------------------------------*/
@@ -192,24 +190,19 @@ int main(int argc, char *argv[])
192190
options.SolveInitialized = NO;
193191
options.RefineInitialized = NO;
194192
options.PrintStat = YES;
193+
options.DiagInv = NO;
195194
*/
196195
set_default_options_dist(&options);
196+
// options.DiagInv = YES;
197+
197198
#if 0
198-
options.ColPerm = PARMETIS;
199-
options.ParSymbFact = YES;
200199
options.RowPerm = NOROWPERM;
201200
options.IterRefine = NOREFINE;
201+
options.ColPerm = NATURAL;
202202
options.Equil = NO;
203+
options.ReplaceTinyPivot = YES;
203204
#endif
204205

205-
// // options.ParSymbFact = YES;
206-
// // options.ColPerm = PARMETIS;
207-
// // options.RowPerm = NOROWPERM;
208-
// options.IterRefine = 0;
209-
// // options.DiagInv = YES;
210-
// options.ReplaceTinyPivot = NO;
211-
// options.SymPattern = YES;
212-
213206
if (!iam) {
214207
print_sp_ienv_dist(&options);
215208
print_options_dist(&options);
@@ -244,7 +237,8 @@ int main(int argc, char *argv[])
244237
PStatFree(&stat);
245238
Destroy_CompRowLoc_Matrix_dist(&A);
246239
ScalePermstructFree(&ScalePermstruct);
247-
Destroy_LU(n, &grid, &LUstruct);
240+
dDestroy_Tree(n, &grid, &LUstruct);
241+
Destroy_LU(n, &grid, &LUstruct);
248242
LUstructFree(&LUstruct);
249243
if ( options.SolveInitialized ) {
250244
dSolveFinalize(&options, &SOLVEstruct);

EXAMPLE/pddrive1.c

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@ at the top-level directory.
2222
*/
2323

2424
#include <math.h>
25-
#include <superlu_dist_config.h>
2625
#include "superlu_ddefs.h"
2726

2827
/*! \brief
@@ -129,13 +128,12 @@ int main(int argc, char *argv[])
129128
}
130129
}
131130
// printf("%s\n", postfix);
132-
131+
133132
/* ------------------------------------------------------------
134133
GET THE MATRIX FROM FILE AND SETUP THE RIGHT HAND SIDE.
135134
------------------------------------------------------------*/
136135
dcreate_matrix_postfix(&A, nrhs, &b, &ldb, &xtrue, &ldx, fp, postfix, &grid);
137-
138-
if ( !(b1 = doubleMalloc_dist(ldb * nrhs)) )
136+
if ( !(b1 = doubleMalloc_dist(ldb * nrhs)) )
139137
ABORT("Malloc fails for b1[]");
140138
for (j = 0; j < nrhs; ++j)
141139
for (i = 0; i < ldb; ++i) b1[i+j*ldb] = b[i+j*ldb];
@@ -160,7 +158,6 @@ int main(int argc, char *argv[])
160158
options.PrintStat = YES;
161159
*/
162160
set_default_options_dist(&options);
163-
printf("options.ColPerm = %d\n", options.ColPerm);
164161

165162
if (!iam) {
166163
print_sp_ienv_dist(&options);
@@ -216,7 +213,8 @@ int main(int argc, char *argv[])
216213
PStatFree(&stat);
217214
Destroy_CompRowLoc_Matrix_dist(&A);
218215
ScalePermstructFree(&ScalePermstruct);
219-
Destroy_LU(n, &grid, &LUstruct);
216+
dDestroy_Tree(n, &grid, &LUstruct);
217+
Destroy_LU(n, &grid, &LUstruct);
220218
LUstructFree(&LUstruct);
221219
if ( options.SolveInitialized ) {
222220
dSolveFinalize(&options, &SOLVEstruct);

EXAMPLE/pddrive2.c

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@ at the top-level directory.
2323
*/
2424

2525
#include <math.h>
26-
#include <superlu_dist_config.h>
2726
#include "superlu_ddefs.h"
2827

2928
/*! \brief
@@ -70,8 +69,8 @@ int main(int argc, char *argv[])
7069
/* prototypes */
7170
extern int dcreate_matrix_perturbed
7271
(SuperMatrix *, int, double **, int *, double **, int *,
73-
FILE *, gridinfo_t *);
74-
extern int dcreate_matrix_perturbed_postfix
72+
FILE *, gridinfo_t *);
73+
extern int dcreate_matrix_perturbed_postfix
7574
(SuperMatrix *, int, double **, int *, double **, int *,
7675
FILE *, char *, gridinfo_t *);
7776

@@ -137,9 +136,9 @@ int main(int argc, char *argv[])
137136
}
138137
}
139138
// printf("%s\n", postfix);
140-
139+
141140
/* ------------------------------------------------------------
142-
GET THE MATRIX FROM FILE AND SETUP THE RIGHT HAND SIDE.
141+
GET THE MATRIX FROM FILE AND SETUP THE RIGHT-HAND SIDE.
143142
------------------------------------------------------------*/
144143
dcreate_matrix_postfix(&A, nrhs, &b, &ldb, &xtrue, &ldx, fp, postfix, &grid);
145144

@@ -191,7 +190,8 @@ int main(int argc, char *argv[])
191190
PStatPrint(&options, &stat, &grid); /* Print the statistics. */
192191
PStatFree(&stat);
193192
Destroy_CompRowLoc_Matrix_dist(&A); /* Deallocate storage of matrix A. */
194-
Destroy_LU(n, &grid, &LUstruct); /* Deallocate storage associated with
193+
dDestroy_Tree(n, &grid, &LUstruct);
194+
Destroy_LU(n, &grid, &LUstruct); /* Deallocate storage associated with
195195
the L and U matrices. */
196196
SUPERLU_FREE(b); /* Free storage of right-hand side. */
197197
SUPERLU_FREE(xtrue); /* Free storage of the exact solution. */
@@ -239,7 +239,8 @@ int main(int argc, char *argv[])
239239
------------------------------------------------------------*/
240240
PStatFree(&stat);
241241
Destroy_CompRowLoc_Matrix_dist(&A); /* Deallocate storage of matrix A. */
242-
Destroy_LU(n, &grid, &LUstruct); /* Deallocate storage associated with
242+
dDestroy_Tree(n, &grid, &LUstruct);
243+
Destroy_LU(n, &grid, &LUstruct); /* Deallocate storage associated with
243244
the L and U matrices. */
244245
ScalePermstructFree(&ScalePermstruct);
245246
LUstructFree(&LUstruct); /* Deallocate the structure of L and U.*/

EXAMPLE/pddrive3.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@ at the top-level directory.
2222
*/
2323

2424
#include <math.h>
25-
#include <superlu_dist_config.h>
2625
#include "superlu_ddefs.h"
2726

2827
/*! \brief
@@ -68,7 +67,7 @@ int main(int argc, char *argv[])
6867
int_t i, j, ii, m, n, nnz_loc, m_loc, fst_row;
6968
int nprow, npcol;
7069
int iam, info, ldb, ldx, nrhs;
71-
char **cpp, c, *postfix;;
70+
char **cpp, c, *postfix;
7271
FILE *fp, *fopen();
7372
int cpp_defs();
7473

@@ -134,7 +133,7 @@ int main(int argc, char *argv[])
134133
}
135134
}
136135
// printf("%s\n", postfix);
137-
136+
138137
/* ------------------------------------------------------------
139138
GET THE MATRIX FROM FILE AND SETUP THE RIGHT HAND SIDE.
140139
------------------------------------------------------------*/
@@ -240,7 +239,8 @@ int main(int argc, char *argv[])
240239
------------------------------------------------------------*/
241240
PStatFree(&stat);
242241
Destroy_CompRowLoc_Matrix_dist(&A); /* Deallocate storage of matrix A. */
243-
Destroy_LU(n, &grid, &LUstruct); /* Deallocate storage associated with
242+
dDestroy_Tree(n, &grid, &LUstruct);
243+
Destroy_LU(n, &grid, &LUstruct); /* Deallocate storage associated with
244244
the L and U matrices. */
245245
ScalePermstructFree(&ScalePermstruct);
246246
LUstructFree(&LUstruct); /* Deallocate the structure of L and U.*/

EXAMPLE/pddrive4.c

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ int main(int argc, char *argv[])
6464
int_t usermap[6];
6565
int iam, info, ldb, ldx, nprocs;
6666
int nrhs = 1; /* Number of right-hand side. */
67-
char **cpp, c, *postfix;;
67+
char **cpp, c, *postfix;
6868
FILE *fp, *fopen();
6969
int cpp_defs();
7070

@@ -134,24 +134,21 @@ int main(int argc, char *argv[])
134134
CHECK_MALLOC(iam, "Enter main()");
135135
#endif
136136

137-
138137
for(ii = 0;ii<strlen(*cpp);ii++){
139138
if((*cpp)[ii]=='.'){
140139
postfix = &((*cpp)[ii+1]);
141140
}
142141
}
143142
// printf("%s\n", postfix);
144-
145143

146144
if ( iam >= 0 && iam < 6 ) { /* I am in grid 1. */
147145
iam = grid1.iam; /* Get the logical number in the new grid. */
148146

149147
/* ------------------------------------------------------------
150148
GET THE MATRIX FROM FILE AND SETUP THE RIGHT HAND SIDE.
151149
------------------------------------------------------------*/
152-
dcreate_matrix_postfix(&A, nrhs, &b, &ldb, &xtrue, &ldx, fp, postfix, &grid1);
153-
154-
150+
dcreate_matrix_postfix(&A, nrhs, &b, &ldb, &xtrue, &ldx, fp, postfix, &grid1);
151+
155152
if ( !(berr = doubleMalloc_dist(nrhs)) )
156153
ABORT("Malloc fails for berr[].");
157154

@@ -205,6 +202,7 @@ int main(int argc, char *argv[])
205202
PStatFree(&stat);
206203
Destroy_CompRowLoc_Matrix_dist(&A);
207204
ScalePermstructFree(&ScalePermstruct);
205+
dDestroy_Tree(n, &grid1, &LUstruct);
208206
Destroy_LU(n, &grid1, &LUstruct);
209207
LUstructFree(&LUstruct);
210208
if ( options.SolveInitialized ) {
@@ -220,7 +218,7 @@ int main(int argc, char *argv[])
220218
/* ------------------------------------------------------------
221219
GET THE MATRIX FROM FILE AND SETUP THE RIGHT HAND SIDE.
222220
------------------------------------------------------------*/
223-
dcreate_matrix_postfix(&A, nrhs, &b, &ldb, &xtrue, &ldx, fp, postfix, &grid2);
221+
dcreate_matrix_postfix(&A, nrhs, &b, &ldb, &xtrue, &ldx, fp, postfix, &grid2);
224222

225223
if ( !(berr = doubleMalloc_dist(nrhs)) )
226224
ABORT("Malloc fails for berr[].");
@@ -270,6 +268,7 @@ int main(int argc, char *argv[])
270268
PStatFree(&stat);
271269
Destroy_CompRowLoc_Matrix_dist(&A);
272270
ScalePermstructFree(&ScalePermstruct);
271+
dDestroy_Tree(n, &grid2, &LUstruct);
273272
Destroy_LU(n, &grid2, &LUstruct);
274273
LUstructFree(&LUstruct);
275274
if ( options.SolveInitialized ) {

0 commit comments

Comments
 (0)