168 int allow_permutations,
185 superlu_dist_options_t* options;
188 dScalePermstruct_t* ScalePermstruct;
189 dLUstruct_t* LUstruct;
190 dSOLVEstruct_t* SOLVEstruct;
199 int_t* rowptr = NULL;
201 int_t job, rowequ, colequ, iinfo, need_value,
i, j, irow, icol;
202 int_t m_loc, fst_row, nnz, nnz_loc;
203 int_t *colptr, *rowind;
204 Glu_persist_t* Glu_persist;
205 Glu_freeable_t* Glu_freeable = NULL;
207 float GA_mem_use = 0.0;
208 float dist_mem_use = 0.0;
209 superlu_dist_mem_usage_t num_mem_usage, symb_mem_usage;
218 double *C, *R, *C1, *R1, *x_col;
219 double amax,
t, colcnd, rowcnd;
221 char equed[1], norm[1];
225 int_t Equil, factored, notran, permc_spec;
250 grid = (gridinfo_t*)SUPERLU_MALLOC(
sizeof(gridinfo_t));
251 superlu_gridinit(comm, nprow, npcol, grid);
252 superlu_data->
grid = grid;
256 if (iam >= nprow * npcol)
return;
260 (superlu_dist_options_t*)SUPERLU_MALLOC(
sizeof(superlu_dist_options_t));
261 A = (SuperMatrix*)SUPERLU_MALLOC(
sizeof(SuperMatrix));
263 (dScalePermstruct_t*)SUPERLU_MALLOC(
sizeof(dScalePermstruct_t));
264 LUstruct = (dLUstruct_t*)SUPERLU_MALLOC(
sizeof(dLUstruct_t));
265 SOLVEstruct = (dSOLVEstruct_t*)SUPERLU_MALLOC(
sizeof(dSOLVEstruct_t));
268 dCreate_CompRowLoc_Matrix_dist(A,
282 set_default_options_dist(options);
285 options->Trans = NOTRANS;
290 options->RowPerm = LargeDiag_MC64;
295 options->ColPerm = MMD_AT_PLUS_A;
298 if (allow_permutations == 0)
300 options->ColPerm = NATURAL;
301 options->RowPerm = NOROWPERM;
309 options->IterRefine = SLU_DOUBLE;
313 options->ReplaceTinyPivot = YES;
318 options->PrintStat = YES;
322 options->PrintStat = NO;
326 if ((!iam) && (doc == 0))
328 printf(
"\nPerforming SuperLU_DIST setup\n");
329 printf(
"Process grid\t%d X %d\n", grid->nprow, grid->npcol);
330 print_options_dist(options);
334 dScalePermstructInit(m, n, ScalePermstruct);
335 dLUstructInit(n, LUstruct);
353 options->Fact = FACTORED;
362 printf(
"\nStats after distributed setup....\n");
363 PStatPrint(options, &stat, grid);
370 superlu_data->
options = options;
374 superlu_data->
colequ = colequ;
375 superlu_data->
rowequ = rowequ;
376 superlu_data->
anorm = anorm;
377 *data = superlu_data;
388 grid = superlu_data->
grid;
392 if (iam >= nprow * npcol)
397 if ((doc == 0) && (!iam))
399 printf(
"\nPerforming SuperLU_DIST solve\n");
406 options = superlu_data->
options;
410 colequ = superlu_data->
colequ;
411 rowequ = superlu_data->
rowequ;
412 anorm = superlu_data->
anorm;
417 if (!(berr = doubleMalloc_dist(nrhs)))
419 ABORT(
"Malloc fails for berr[].");
446 grid = superlu_data->
grid;
450 if (iam >= nprow * npcol)
454 if ((doc == 0) && (!iam))
456 printf(
"\nCleaning up memory allocated for SuperLU_DIST\n");
463 options = superlu_data->
options;
471 R = ScalePermstruct->R;
472 C = ScalePermstruct->C;
475 Fact = options->Fact;
476 factored = (Fact == FACTORED);
477 Equil = (!factored && options->Equil == YES);
480 if (Equil && Fact != SamePattern_SameRowPerm)
482 switch (ScalePermstruct->DiagScale)
502 dScalePermstructFree(ScalePermstruct);
503 dDestroy_LU(n, grid, LUstruct);
504 dLUstructFree(LUstruct);
505 dSolveFinalize(options, SOLVEstruct);
508 Destroy_SuperMatrix_Store_dist(A);
512 SUPERLU_FREE(ScalePermstruct);
513 SUPERLU_FREE(LUstruct);
514 SUPERLU_FREE(SOLVEstruct);
515 SUPERLU_FREE(options);
519 superlu_gridexit(grid);
522 SUPERLU_FREE(superlu_data);
562 int allow_permutations,
577 superlu_dist_options_t* options;
580 dScalePermstruct_t* ScalePermstruct;
581 dLUstruct_t* LUstruct;
590 int_t job, rowequ, colequ, iinfo,
i, j, irow;
592 int_t *colptr, *rowind;
593 int_t Equil, factored, notran, permc_spec;
596 Glu_persist_t* Glu_persist;
597 Glu_freeable_t* Glu_freeable = NULL;
601 double *a, *X, *b_col;
603 double *C, *R, *C1, *R1, *b_work, *x_col;
604 double amax,
t, colcnd, rowcnd;
606 char equed[1], norm[1];
634 grid = (gridinfo_t*)SUPERLU_MALLOC(
sizeof(gridinfo_t));
635 superlu_gridinit(comm, nprow, npcol, grid);
636 superlu_data->
grid = grid;
640 if (iam >= nprow * npcol)
647 (superlu_dist_options_t*)SUPERLU_MALLOC(
sizeof(superlu_dist_options_t));
648 A = (SuperMatrix*)SUPERLU_MALLOC(
sizeof(SuperMatrix));
650 (dScalePermstruct_t*)SUPERLU_MALLOC(
sizeof(dScalePermstruct_t));
651 LUstruct = (dLUstruct_t*)SUPERLU_MALLOC(
sizeof(dLUstruct_t));
654 set_default_options_dist(options);
657 options->Trans = NOTRANS;
662 options->RowPerm = LargeDiag_MC64;
666 options->ColPerm = MMD_AT_PLUS_A;
669 if (allow_permutations == 0)
671 options->ColPerm = NATURAL;
672 options->RowPerm = NOROWPERM;
677 options->IterRefine = SLU_DOUBLE;
682 options->PrintStat = YES;
686 options->PrintStat = NO;
690 if ((!iam) && (doc == 0))
692 printf(
"\nPerforming SuperLU_DIST setup\n");
693 printf(
"Process grid\t%d X %d\n", grid->nprow, grid->npcol);
694 print_options_dist(options);
698 dCreate_CompCol_Matrix_dist(
699 A, m, n, nnz, values, row_index, col_start, SLU_NC, SLU_D, SLU_GE);
702 dScalePermstructInit(m, n, ScalePermstruct);
703 dLUstructInit(n, LUstruct);
707 pdgssvx_ABglobal(options,
720 options->Fact = FACTORED;
724 printf(
"Trouble in pdgstrf. Info=%i\n", *info);
728 "U(%i,%i) is exactly zero. The factorization has\n", *info, *info);
729 printf(
"been completed, but the factor U is exactly singular,\n");
730 printf(
"and division by zero will occur if it is used to solve a\n");
731 printf(
"system of equations.\n");
735 printf(
"The %i-th argument had an illegal value.\n", *info);
746 printf(
"\nStats after global setup....\n");
747 PStatPrint(options, &stat, grid);
754 superlu_data->
options = options;
757 superlu_data->
colequ = colequ;
758 superlu_data->
rowequ = rowequ;
759 superlu_data->
anorm = anorm;
760 *data = superlu_data;
771 grid = superlu_data->
grid;
775 if (iam >= nprow * npcol)
780 if ((doc == 0) && (!iam))
782 printf(
"\nPerforming SuperLU_DIST solve\n");
789 options = superlu_data->
options;
792 colequ = superlu_data->
colequ;
793 rowequ = superlu_data->
rowequ;
794 anorm = superlu_data->
anorm;
799 if (!(berr = doubleMalloc_dist(nrhs)))
801 ABORT(
"Malloc fails for berr[].");
805 pdgssvx_ABglobal(options,
827 grid = superlu_data->
grid;
831 if (iam >= nprow * npcol)
835 if ((doc == 0) && (!iam))
837 printf(
"\nCleaning up memory allocated for SuperLU_DIST\n");
844 options = superlu_data->
options;
851 R = ScalePermstruct->R;
852 C = ScalePermstruct->C;
855 Fact = options->Fact;
856 factored = (Fact == FACTORED);
857 Equil = (!factored && options->Equil == YES);
860 if (Equil && Fact != SamePattern_SameRowPerm)
862 switch (ScalePermstruct->DiagScale)
882 dDestroy_LU(n, grid, LUstruct);
883 dScalePermstructFree(ScalePermstruct);
884 dLUstructFree(LUstruct);
887 Destroy_SuperMatrix_Store_dist(A);
891 SUPERLU_FREE(ScalePermstruct);
892 SUPERLU_FREE(LUstruct);
893 SUPERLU_FREE(options);
897 superlu_gridexit(grid);
900 SUPERLU_FREE(superlu_data);
void superlu_dist_global_matrix(opt_flag_t opt_flag, int allow_permutations, int n_in, int nnz_in, double *values, int *row_index, int *col_start, double *b, int nprow, int npcol, int doc, void **data, int *info, MPI_Comm comm)
void superlu_dist_distributed_matrix(opt_flag_t opt_flag, int allow_permutations, int n, int nnz_local, int nrow_local, int first_row, double *values, int *col_index, int *row_start, double *b, int nprow, int npcol, int doc, void **data, int *info, MPI_Comm comm)