File: | mat/impls/aij/mpi/superlu_dist/superlu_dist.c |
Warning: | line 355, column 34 Array access (from variable 'ajj') results in a null pointer dereference |
[?] Use j/k keys for keyboard navigation
1 | ||||
2 | /* | |||
3 | Provides an interface to the SuperLU_DIST sparse solver | |||
4 | */ | |||
5 | ||||
6 | #include <../src/mat/impls/aij/seq/aij.h> | |||
7 | #include <../src/mat/impls/aij/mpi/mpiaij.h> | |||
8 | ||||
9 | EXTERN_C_BEGIN | |||
10 | #if defined(PETSC_USE_COMPLEX) | |||
11 | #include <superlu_zdefs.h> | |||
12 | #else | |||
13 | #include <superlu_ddefs.h> | |||
14 | #endif | |||
15 | EXTERN_C_END | |||
16 | ||||
17 | typedef struct { | |||
18 | int_t nprow,npcol,*row,*col; | |||
19 | gridinfo_t grid; | |||
20 | superlu_dist_options_t options; | |||
21 | SuperMatrix A_sup; | |||
22 | ScalePermstruct_t ScalePermstruct; | |||
23 | LUstruct_t LUstruct; | |||
24 | int StatPrint; | |||
25 | SOLVEstruct_t SOLVEstruct; | |||
26 | fact_t FactPattern; | |||
27 | MPI_Comm comm_superlu; | |||
28 | #if defined(PETSC_USE_COMPLEX) | |||
29 | doublecomplex *val; | |||
30 | #else | |||
31 | double *val; | |||
32 | #endif | |||
33 | PetscBool matsolve_iscalled,matmatsolve_iscalled; | |||
34 | PetscBool CleanUpSuperLU_Dist; /* Flag to clean up (non-global) SuperLU objects during Destroy */ | |||
35 | } Mat_SuperLU_DIST; | |||
36 | ||||
37 | ||||
38 | PetscErrorCode MatSuperluDistGetDiagU_SuperLU_DIST(Mat F,PetscScalar *diagU) | |||
39 | { | |||
40 | Mat_SuperLU_DIST *lu= (Mat_SuperLU_DIST*)F->data; | |||
41 | ||||
42 | PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize < 64)) { petscstack->function[petscstack->currentsize ] = __func__; petscstack->file[petscstack->currentsize] = "/sandbox/petsc/petsc.next/src/mat/impls/aij/mpi/superlu_dist/superlu_dist.c" ; petscstack->line[petscstack->currentsize] = 42; petscstack ->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack ->currentsize++; } if (petscstack) { petscstack->hotdepth += (PETSC_FALSE || petscstack->hotdepth); } ; } while (0) ; ; } while (0); | |||
43 | #if defined(PETSC_USE_COMPLEX) | |||
44 | PetscStackCall("SuperLU_DIST:pzGetDiagU",pzGetDiagU(F->rmap->N,&lu->LUstruct,&lu->grid,(doublecomplex*)diagU))do { do { do { ; if (petscstack && (petscstack->currentsize < 64)) { petscstack->function[petscstack->currentsize ] = "SuperLU_DIST:pzGetDiagU"; petscstack->file[petscstack ->currentsize] = "/sandbox/petsc/petsc.next/src/mat/impls/aij/mpi/superlu_dist/superlu_dist.c" ; petscstack->line[petscstack->currentsize] = 44; petscstack ->petscroutine[petscstack->currentsize] = PETSC_FALSE; petscstack ->currentsize++; } if (petscstack) { petscstack->hotdepth += (PETSC_FALSE || petscstack->hotdepth); } ; } while (0) ; do {PetscErrorCode _7_ierr = PetscMallocValidate(44,__func__ ,"/sandbox/petsc/petsc.next/src/mat/impls/aij/mpi/superlu_dist/superlu_dist.c" );do {if (__builtin_expect(!!(_7_ierr),0)) return PetscError( ((MPI_Comm)0x44000001),44,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/aij/mpi/superlu_dist/superlu_dist.c" ,_7_ierr,PETSC_ERROR_REPEAT," ");} while (0);} while(0); } while (0);pzGetDiagU(F->rmap->N,&lu->LUstruct,&lu ->grid,(doublecomplex*)diagU);do { do {PetscErrorCode _7_ierr = PetscMallocValidate(44,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/aij/mpi/superlu_dist/superlu_dist.c" );do {if (__builtin_expect(!!(_7_ierr),0)) return PetscError( ((MPI_Comm)0x44000001),44,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/aij/mpi/superlu_dist/superlu_dist.c" ,_7_ierr,PETSC_ERROR_REPEAT," ");} while (0);} while(0); do { ; if (petscstack && petscstack->currentsize > 0 ) { petscstack->currentsize--; petscstack->function[petscstack ->currentsize] = 0; petscstack->file[petscstack->currentsize ] = 0; petscstack->line[petscstack->currentsize] = 0; petscstack ->petscroutine[petscstack->currentsize] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth = (((petscstack-> hotdepth-1)<(0)) ? (0) : (petscstack->hotdepth-1)); } ; } while (0); } while (0); } while(0); | |||
45 | #else | |||
46 | PetscStackCall("SuperLU_DIST:pdGetDiagU",pdGetDiagU(F->rmap->N,&lu->LUstruct,&lu->grid,diagU))do { do { do { ; if (petscstack && (petscstack->currentsize < 64)) { petscstack->function[petscstack->currentsize ] = "SuperLU_DIST:pdGetDiagU"; petscstack->file[petscstack ->currentsize] = "/sandbox/petsc/petsc.next/src/mat/impls/aij/mpi/superlu_dist/superlu_dist.c" ; petscstack->line[petscstack->currentsize] = 46; petscstack ->petscroutine[petscstack->currentsize] = PETSC_FALSE; petscstack ->currentsize++; } if (petscstack) { petscstack->hotdepth += (PETSC_FALSE || petscstack->hotdepth); } ; } while (0) ; do {PetscErrorCode _7_ierr = PetscMallocValidate(46,__func__ ,"/sandbox/petsc/petsc.next/src/mat/impls/aij/mpi/superlu_dist/superlu_dist.c" );do {if (__builtin_expect(!!(_7_ierr),0)) return PetscError( ((MPI_Comm)0x44000001),46,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/aij/mpi/superlu_dist/superlu_dist.c" ,_7_ierr,PETSC_ERROR_REPEAT," ");} while (0);} while(0); } while (0);pdGetDiagU(F->rmap->N,&lu->LUstruct,&lu ->grid,diagU);do { do {PetscErrorCode _7_ierr = PetscMallocValidate (46,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/aij/mpi/superlu_dist/superlu_dist.c" );do {if (__builtin_expect(!!(_7_ierr),0)) return PetscError( ((MPI_Comm)0x44000001),46,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/aij/mpi/superlu_dist/superlu_dist.c" ,_7_ierr,PETSC_ERROR_REPEAT," ");} while (0);} while(0); do { ; if (petscstack && petscstack->currentsize > 0 ) { petscstack->currentsize--; petscstack->function[petscstack ->currentsize] = 0; petscstack->file[petscstack->currentsize ] = 0; petscstack->line[petscstack->currentsize] = 0; petscstack ->petscroutine[petscstack->currentsize] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth = (((petscstack-> hotdepth-1)<(0)) ? (0) : (petscstack->hotdepth-1)); } ; } while (0); } while (0); } while(0); | |||
47 | #endif | |||
48 | PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize > 0) { petscstack->currentsize--; petscstack->function [petscstack->currentsize] = 0; petscstack->file[petscstack ->currentsize] = 0; petscstack->line[petscstack->currentsize ] = 0; petscstack->petscroutine[petscstack->currentsize ] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth = (((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack-> hotdepth-1)); } ; } while (0); return(0);} while (0); | |||
49 | } | |||
50 | ||||
51 | PetscErrorCode MatSuperluDistGetDiagU(Mat F,PetscScalar *diagU) | |||
52 | { | |||
53 | PetscErrorCode ierr; | |||
54 | ||||
55 | PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize < 64)) { petscstack->function[petscstack->currentsize ] = __func__; petscstack->file[petscstack->currentsize] = "/sandbox/petsc/petsc.next/src/mat/impls/aij/mpi/superlu_dist/superlu_dist.c" ; petscstack->line[petscstack->currentsize] = 55; petscstack ->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack ->currentsize++; } if (petscstack) { petscstack->hotdepth += (PETSC_FALSE || petscstack->hotdepth); } ; } while (0) ; ; } while (0); | |||
56 | PetscValidHeaderSpecific(F,MAT_CLASSID,1)do { if (!F) return PetscError(((MPI_Comm)0x44000001),56,__func__ ,"/sandbox/petsc/petsc.next/src/mat/impls/aij/mpi/superlu_dist/superlu_dist.c" ,85,PETSC_ERROR_INITIAL,"Null Object: Parameter # %d",1); if ( !PetscCheckPointer(F,PETSC_OBJECT)) return PetscError(((MPI_Comm )0x44000001),56,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/aij/mpi/superlu_dist/superlu_dist.c" ,64,PETSC_ERROR_INITIAL,"Invalid Pointer to Object: Parameter # %d" ,1); if (((PetscObject)(F))->classid != MAT_CLASSID) { if ( ((PetscObject)(F))->classid == -1) return PetscError(((MPI_Comm )0x44000001),56,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/aij/mpi/superlu_dist/superlu_dist.c" ,64,PETSC_ERROR_INITIAL,"Object already free: Parameter # %d" ,1); else return PetscError(((MPI_Comm)0x44000001),56,__func__ ,"/sandbox/petsc/petsc.next/src/mat/impls/aij/mpi/superlu_dist/superlu_dist.c" ,62,PETSC_ERROR_INITIAL,"Wrong type of object: Parameter # %d" ,1); } } while (0); | |||
57 | ierr = PetscTryMethod(F,"MatSuperluDistGetDiagU_C",(Mat,PetscScalar*),(F,diagU))0; do { PetscErrorCode (*_7_f)(Mat,PetscScalar*), _7_ierr; _7_ierr = PetscObjectQueryFunction_Private(((PetscObject)(F)),("MatSuperluDistGetDiagU_C" ),(PetscVoidFunction*)(&_7_f));do {if (__builtin_expect(! !(_7_ierr),0)) return PetscError(((MPI_Comm)0x44000001),57,__func__ ,"/sandbox/petsc/petsc.next/src/mat/impls/aij/mpi/superlu_dist/superlu_dist.c" ,_7_ierr,PETSC_ERROR_REPEAT," ");} while (0); if (_7_f) {_7_ierr = (*_7_f)(F,diagU);do {if (__builtin_expect(!!(_7_ierr),0)) return PetscError(((MPI_Comm)0x44000001),57,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/aij/mpi/superlu_dist/superlu_dist.c" ,_7_ierr,PETSC_ERROR_REPEAT," ");} while (0);} } while(0);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),57,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/aij/mpi/superlu_dist/superlu_dist.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
58 | PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize > 0) { petscstack->currentsize--; petscstack->function [petscstack->currentsize] = 0; petscstack->file[petscstack ->currentsize] = 0; petscstack->line[petscstack->currentsize ] = 0; petscstack->petscroutine[petscstack->currentsize ] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth = (((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack-> hotdepth-1)); } ; } while (0); return(0);} while (0); | |||
59 | } | |||
60 | ||||
61 | static PetscErrorCode MatDestroy_SuperLU_DIST(Mat A) | |||
62 | { | |||
63 | PetscErrorCode ierr; | |||
64 | Mat_SuperLU_DIST *lu = (Mat_SuperLU_DIST*)A->data; | |||
65 | ||||
66 | PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize < 64)) { petscstack->function[petscstack->currentsize ] = __func__; petscstack->file[petscstack->currentsize] = "/sandbox/petsc/petsc.next/src/mat/impls/aij/mpi/superlu_dist/superlu_dist.c" ; petscstack->line[petscstack->currentsize] = 66; petscstack ->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack ->currentsize++; } if (petscstack) { petscstack->hotdepth += (PETSC_FALSE || petscstack->hotdepth); } ; } while (0) ; ; } while (0); | |||
67 | if (lu->CleanUpSuperLU_Dist) { | |||
68 | /* Deallocate SuperLU_DIST storage */ | |||
69 | PetscStackCall("SuperLU_DIST:Destroy_CompRowLoc_Matrix_dist",Destroy_CompRowLoc_Matrix_dist(&lu->A_sup))do { do { do { ; if (petscstack && (petscstack->currentsize < 64)) { petscstack->function[petscstack->currentsize ] = "SuperLU_DIST:Destroy_CompRowLoc_Matrix_dist"; petscstack ->file[petscstack->currentsize] = "/sandbox/petsc/petsc.next/src/mat/impls/aij/mpi/superlu_dist/superlu_dist.c" ; petscstack->line[petscstack->currentsize] = 69; petscstack ->petscroutine[petscstack->currentsize] = PETSC_FALSE; petscstack ->currentsize++; } if (petscstack) { petscstack->hotdepth += (PETSC_FALSE || petscstack->hotdepth); } ; } while (0) ; do {PetscErrorCode _7_ierr = PetscMallocValidate(69,__func__ ,"/sandbox/petsc/petsc.next/src/mat/impls/aij/mpi/superlu_dist/superlu_dist.c" );do {if (__builtin_expect(!!(_7_ierr),0)) return PetscError( ((MPI_Comm)0x44000001),69,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/aij/mpi/superlu_dist/superlu_dist.c" ,_7_ierr,PETSC_ERROR_REPEAT," ");} while (0);} while(0); } while (0);Destroy_CompRowLoc_Matrix_dist(&lu->A_sup);do { do {PetscErrorCode _7_ierr = PetscMallocValidate(69,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/aij/mpi/superlu_dist/superlu_dist.c" );do {if (__builtin_expect(!!(_7_ierr),0)) return PetscError( ((MPI_Comm)0x44000001),69,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/aij/mpi/superlu_dist/superlu_dist.c" ,_7_ierr,PETSC_ERROR_REPEAT," ");} while (0);} while(0); do { ; if (petscstack && petscstack->currentsize > 0 ) { petscstack->currentsize--; petscstack->function[petscstack ->currentsize] = 0; petscstack->file[petscstack->currentsize ] = 0; petscstack->line[petscstack->currentsize] = 0; petscstack ->petscroutine[petscstack->currentsize] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth = (((petscstack-> hotdepth-1)<(0)) ? (0) : (petscstack->hotdepth-1)); } ; } while (0); } while (0); } while(0); | |||
70 | if (lu->options.SolveInitialized) { | |||
71 | #if defined(PETSC_USE_COMPLEX) | |||
72 | PetscStackCall("SuperLU_DIST:zSolveFinalize",zSolveFinalize(&lu->options, &lu->SOLVEstruct))do { do { do { ; if (petscstack && (petscstack->currentsize < 64)) { petscstack->function[petscstack->currentsize ] = "SuperLU_DIST:zSolveFinalize"; petscstack->file[petscstack ->currentsize] = "/sandbox/petsc/petsc.next/src/mat/impls/aij/mpi/superlu_dist/superlu_dist.c" ; petscstack->line[petscstack->currentsize] = 72; petscstack ->petscroutine[petscstack->currentsize] = PETSC_FALSE; petscstack ->currentsize++; } if (petscstack) { petscstack->hotdepth += (PETSC_FALSE || petscstack->hotdepth); } ; } while (0) ; do {PetscErrorCode _7_ierr = PetscMallocValidate(72,__func__ ,"/sandbox/petsc/petsc.next/src/mat/impls/aij/mpi/superlu_dist/superlu_dist.c" );do {if (__builtin_expect(!!(_7_ierr),0)) return PetscError( ((MPI_Comm)0x44000001),72,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/aij/mpi/superlu_dist/superlu_dist.c" ,_7_ierr,PETSC_ERROR_REPEAT," ");} while (0);} while(0); } while (0);zSolveFinalize(&lu->options, &lu->SOLVEstruct );do { do {PetscErrorCode _7_ierr = PetscMallocValidate(72,__func__ ,"/sandbox/petsc/petsc.next/src/mat/impls/aij/mpi/superlu_dist/superlu_dist.c" );do {if (__builtin_expect(!!(_7_ierr),0)) return PetscError( ((MPI_Comm)0x44000001),72,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/aij/mpi/superlu_dist/superlu_dist.c" ,_7_ierr,PETSC_ERROR_REPEAT," ");} while (0);} while(0); do { ; if (petscstack && petscstack->currentsize > 0 ) { petscstack->currentsize--; petscstack->function[petscstack ->currentsize] = 0; petscstack->file[petscstack->currentsize ] = 0; petscstack->line[petscstack->currentsize] = 0; petscstack ->petscroutine[petscstack->currentsize] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth = (((petscstack-> hotdepth-1)<(0)) ? (0) : (petscstack->hotdepth-1)); } ; } while (0); } while (0); } while(0); | |||
73 | #else | |||
74 | PetscStackCall("SuperLU_DIST:dSolveFinalize",dSolveFinalize(&lu->options, &lu->SOLVEstruct))do { do { do { ; if (petscstack && (petscstack->currentsize < 64)) { petscstack->function[petscstack->currentsize ] = "SuperLU_DIST:dSolveFinalize"; petscstack->file[petscstack ->currentsize] = "/sandbox/petsc/petsc.next/src/mat/impls/aij/mpi/superlu_dist/superlu_dist.c" ; petscstack->line[petscstack->currentsize] = 74; petscstack ->petscroutine[petscstack->currentsize] = PETSC_FALSE; petscstack ->currentsize++; } if (petscstack) { petscstack->hotdepth += (PETSC_FALSE || petscstack->hotdepth); } ; } while (0) ; do {PetscErrorCode _7_ierr = PetscMallocValidate(74,__func__ ,"/sandbox/petsc/petsc.next/src/mat/impls/aij/mpi/superlu_dist/superlu_dist.c" );do {if (__builtin_expect(!!(_7_ierr),0)) return PetscError( ((MPI_Comm)0x44000001),74,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/aij/mpi/superlu_dist/superlu_dist.c" ,_7_ierr,PETSC_ERROR_REPEAT," ");} while (0);} while(0); } while (0);dSolveFinalize(&lu->options, &lu->SOLVEstruct );do { do {PetscErrorCode _7_ierr = PetscMallocValidate(74,__func__ ,"/sandbox/petsc/petsc.next/src/mat/impls/aij/mpi/superlu_dist/superlu_dist.c" );do {if (__builtin_expect(!!(_7_ierr),0)) return PetscError( ((MPI_Comm)0x44000001),74,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/aij/mpi/superlu_dist/superlu_dist.c" ,_7_ierr,PETSC_ERROR_REPEAT," ");} while (0);} while(0); do { ; if (petscstack && petscstack->currentsize > 0 ) { petscstack->currentsize--; petscstack->function[petscstack ->currentsize] = 0; petscstack->file[petscstack->currentsize ] = 0; petscstack->line[petscstack->currentsize] = 0; petscstack ->petscroutine[petscstack->currentsize] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth = (((petscstack-> hotdepth-1)<(0)) ? (0) : (petscstack->hotdepth-1)); } ; } while (0); } while (0); } while(0); | |||
75 | #endif | |||
76 | } | |||
77 | PetscStackCall("SuperLU_DIST:Destroy_LU",Destroy_LU(A->cmap->N, &lu->grid, &lu->LUstruct))do { do { do { ; if (petscstack && (petscstack->currentsize < 64)) { petscstack->function[petscstack->currentsize ] = "SuperLU_DIST:Destroy_LU"; petscstack->file[petscstack ->currentsize] = "/sandbox/petsc/petsc.next/src/mat/impls/aij/mpi/superlu_dist/superlu_dist.c" ; petscstack->line[petscstack->currentsize] = 77; petscstack ->petscroutine[petscstack->currentsize] = PETSC_FALSE; petscstack ->currentsize++; } if (petscstack) { petscstack->hotdepth += (PETSC_FALSE || petscstack->hotdepth); } ; } while (0) ; do {PetscErrorCode _7_ierr = PetscMallocValidate(77,__func__ ,"/sandbox/petsc/petsc.next/src/mat/impls/aij/mpi/superlu_dist/superlu_dist.c" );do {if (__builtin_expect(!!(_7_ierr),0)) return PetscError( ((MPI_Comm)0x44000001),77,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/aij/mpi/superlu_dist/superlu_dist.c" ,_7_ierr,PETSC_ERROR_REPEAT," ");} while (0);} while(0); } while (0);Destroy_LU(A->cmap->N, &lu->grid, &lu-> LUstruct);do { do {PetscErrorCode _7_ierr = PetscMallocValidate (77,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/aij/mpi/superlu_dist/superlu_dist.c" );do {if (__builtin_expect(!!(_7_ierr),0)) return PetscError( ((MPI_Comm)0x44000001),77,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/aij/mpi/superlu_dist/superlu_dist.c" ,_7_ierr,PETSC_ERROR_REPEAT," ");} while (0);} while(0); do { ; if (petscstack && petscstack->currentsize > 0 ) { petscstack->currentsize--; petscstack->function[petscstack ->currentsize] = 0; petscstack->file[petscstack->currentsize ] = 0; petscstack->line[petscstack->currentsize] = 0; petscstack ->petscroutine[petscstack->currentsize] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth = (((petscstack-> hotdepth-1)<(0)) ? (0) : (petscstack->hotdepth-1)); } ; } while (0); } while (0); } while(0); | |||
78 | PetscStackCall("SuperLU_DIST:ScalePermstructFree",ScalePermstructFree(&lu->ScalePermstruct))do { do { do { ; if (petscstack && (petscstack->currentsize < 64)) { petscstack->function[petscstack->currentsize ] = "SuperLU_DIST:ScalePermstructFree"; petscstack->file[petscstack ->currentsize] = "/sandbox/petsc/petsc.next/src/mat/impls/aij/mpi/superlu_dist/superlu_dist.c" ; petscstack->line[petscstack->currentsize] = 78; petscstack ->petscroutine[petscstack->currentsize] = PETSC_FALSE; petscstack ->currentsize++; } if (petscstack) { petscstack->hotdepth += (PETSC_FALSE || petscstack->hotdepth); } ; } while (0) ; do {PetscErrorCode _7_ierr = PetscMallocValidate(78,__func__ ,"/sandbox/petsc/petsc.next/src/mat/impls/aij/mpi/superlu_dist/superlu_dist.c" );do {if (__builtin_expect(!!(_7_ierr),0)) return PetscError( ((MPI_Comm)0x44000001),78,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/aij/mpi/superlu_dist/superlu_dist.c" ,_7_ierr,PETSC_ERROR_REPEAT," ");} while (0);} while(0); } while (0);ScalePermstructFree(&lu->ScalePermstruct);do { do {PetscErrorCode _7_ierr = PetscMallocValidate(78,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/aij/mpi/superlu_dist/superlu_dist.c" );do {if (__builtin_expect(!!(_7_ierr),0)) return PetscError( ((MPI_Comm)0x44000001),78,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/aij/mpi/superlu_dist/superlu_dist.c" ,_7_ierr,PETSC_ERROR_REPEAT," ");} while (0);} while(0); do { ; if (petscstack && petscstack->currentsize > 0 ) { petscstack->currentsize--; petscstack->function[petscstack ->currentsize] = 0; petscstack->file[petscstack->currentsize ] = 0; petscstack->line[petscstack->currentsize] = 0; petscstack ->petscroutine[petscstack->currentsize] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth = (((petscstack-> hotdepth-1)<(0)) ? (0) : (petscstack->hotdepth-1)); } ; } while (0); } while (0); } while(0); | |||
79 | PetscStackCall("SuperLU_DIST:LUstructFree",LUstructFree(&lu->LUstruct))do { do { do { ; if (petscstack && (petscstack->currentsize < 64)) { petscstack->function[petscstack->currentsize ] = "SuperLU_DIST:LUstructFree"; petscstack->file[petscstack ->currentsize] = "/sandbox/petsc/petsc.next/src/mat/impls/aij/mpi/superlu_dist/superlu_dist.c" ; petscstack->line[petscstack->currentsize] = 79; petscstack ->petscroutine[petscstack->currentsize] = PETSC_FALSE; petscstack ->currentsize++; } if (petscstack) { petscstack->hotdepth += (PETSC_FALSE || petscstack->hotdepth); } ; } while (0) ; do {PetscErrorCode _7_ierr = PetscMallocValidate(79,__func__ ,"/sandbox/petsc/petsc.next/src/mat/impls/aij/mpi/superlu_dist/superlu_dist.c" );do {if (__builtin_expect(!!(_7_ierr),0)) return PetscError( ((MPI_Comm)0x44000001),79,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/aij/mpi/superlu_dist/superlu_dist.c" ,_7_ierr,PETSC_ERROR_REPEAT," ");} while (0);} while(0); } while (0);LUstructFree(&lu->LUstruct);do { do {PetscErrorCode _7_ierr = PetscMallocValidate(79,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/aij/mpi/superlu_dist/superlu_dist.c" );do {if (__builtin_expect(!!(_7_ierr),0)) return PetscError( ((MPI_Comm)0x44000001),79,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/aij/mpi/superlu_dist/superlu_dist.c" ,_7_ierr,PETSC_ERROR_REPEAT," ");} while (0);} while(0); do { ; if (petscstack && petscstack->currentsize > 0 ) { petscstack->currentsize--; petscstack->function[petscstack ->currentsize] = 0; petscstack->file[petscstack->currentsize ] = 0; petscstack->line[petscstack->currentsize] = 0; petscstack ->petscroutine[petscstack->currentsize] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth = (((petscstack-> hotdepth-1)<(0)) ? (0) : (petscstack->hotdepth-1)); } ; } while (0); } while (0); } while(0); | |||
80 | ||||
81 | /* Release the SuperLU_DIST process grid. */ | |||
82 | PetscStackCall("SuperLU_DIST:superlu_gridexit",superlu_gridexit(&lu->grid))do { do { do { ; if (petscstack && (petscstack->currentsize < 64)) { petscstack->function[petscstack->currentsize ] = "SuperLU_DIST:superlu_gridexit"; petscstack->file[petscstack ->currentsize] = "/sandbox/petsc/petsc.next/src/mat/impls/aij/mpi/superlu_dist/superlu_dist.c" ; petscstack->line[petscstack->currentsize] = 82; petscstack ->petscroutine[petscstack->currentsize] = PETSC_FALSE; petscstack ->currentsize++; } if (petscstack) { petscstack->hotdepth += (PETSC_FALSE || petscstack->hotdepth); } ; } while (0) ; do {PetscErrorCode _7_ierr = PetscMallocValidate(82,__func__ ,"/sandbox/petsc/petsc.next/src/mat/impls/aij/mpi/superlu_dist/superlu_dist.c" );do {if (__builtin_expect(!!(_7_ierr),0)) return PetscError( ((MPI_Comm)0x44000001),82,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/aij/mpi/superlu_dist/superlu_dist.c" ,_7_ierr,PETSC_ERROR_REPEAT," ");} while (0);} while(0); } while (0);superlu_gridexit(&lu->grid);do { do {PetscErrorCode _7_ierr = PetscMallocValidate(82,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/aij/mpi/superlu_dist/superlu_dist.c" );do {if (__builtin_expect(!!(_7_ierr),0)) return PetscError( ((MPI_Comm)0x44000001),82,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/aij/mpi/superlu_dist/superlu_dist.c" ,_7_ierr,PETSC_ERROR_REPEAT," ");} while (0);} while(0); do { ; if (petscstack && petscstack->currentsize > 0 ) { petscstack->currentsize--; petscstack->function[petscstack ->currentsize] = 0; petscstack->file[petscstack->currentsize ] = 0; petscstack->line[petscstack->currentsize] = 0; petscstack ->petscroutine[petscstack->currentsize] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth = (((petscstack-> hotdepth-1)<(0)) ? (0) : (petscstack->hotdepth-1)); } ; } while (0); } while (0); } while(0); | |||
83 | ierr = MPI_Comm_free(&(lu->comm_superlu));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),83,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/aij/mpi/superlu_dist/superlu_dist.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
84 | } | |||
85 | ierr = PetscFree(A->data)((*PetscTrFree)((void*)(A->data),85,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/aij/mpi/superlu_dist/superlu_dist.c" ) || ((A->data) = 0,0));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),85,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/aij/mpi/superlu_dist/superlu_dist.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
86 | /* clear composed functions */ | |||
87 | ierr = PetscObjectComposeFunction((PetscObject)A,"MatFactorGetSolverType_C",NULL)PetscObjectComposeFunction_Private((PetscObject)A,"MatFactorGetSolverType_C" ,(PetscVoidFunction)(((void*)0)));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),87,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/aij/mpi/superlu_dist/superlu_dist.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
88 | ierr = PetscObjectComposeFunction((PetscObject)A,"MatSuperluDistGetDiagU_C",NULL)PetscObjectComposeFunction_Private((PetscObject)A,"MatSuperluDistGetDiagU_C" ,(PetscVoidFunction)(((void*)0)));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),88,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/aij/mpi/superlu_dist/superlu_dist.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
89 | ||||
90 | PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize > 0) { petscstack->currentsize--; petscstack->function [petscstack->currentsize] = 0; petscstack->file[petscstack ->currentsize] = 0; petscstack->line[petscstack->currentsize ] = 0; petscstack->petscroutine[petscstack->currentsize ] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth = (((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack-> hotdepth-1)); } ; } while (0); return(0);} while (0); | |||
91 | } | |||
92 | ||||
93 | static PetscErrorCode MatSolve_SuperLU_DIST(Mat A,Vec b_mpi,Vec x) | |||
94 | { | |||
95 | Mat_SuperLU_DIST *lu = (Mat_SuperLU_DIST*)A->data; | |||
96 | PetscErrorCode ierr; | |||
97 | PetscMPIInt size; | |||
98 | PetscInt m=A->rmap->n; | |||
99 | SuperLUStat_t stat; | |||
100 | double berr[1]; | |||
101 | PetscScalar *bptr=NULL((void*)0); | |||
102 | int info; /* SuperLU_Dist info code is ALWAYS an int, even with long long indices */ | |||
103 | static PetscBool cite = PETSC_FALSE; | |||
104 | ||||
105 | PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize < 64)) { petscstack->function[petscstack->currentsize ] = __func__; petscstack->file[petscstack->currentsize] = "/sandbox/petsc/petsc.next/src/mat/impls/aij/mpi/superlu_dist/superlu_dist.c" ; petscstack->line[petscstack->currentsize] = 105; petscstack ->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack ->currentsize++; } if (petscstack) { petscstack->hotdepth += (PETSC_FALSE || petscstack->hotdepth); } ; } while (0) ; ; } while (0); | |||
106 | if (lu->options.Fact != FACTORED) SETERRQ(PETSC_COMM_SELF,PETSC_ERR_ARG_WRONG,"SuperLU_DIST options.Fact mush equal FACTORED")return PetscError(((MPI_Comm)0x44000001),106,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/aij/mpi/superlu_dist/superlu_dist.c" ,62,PETSC_ERROR_INITIAL,"SuperLU_DIST options.Fact mush equal FACTORED" ); | |||
107 | ierr = PetscCitationsRegister("@article{lidemmel03,\n author = {Xiaoye S. Li and James W. Demmel},\n title = {{SuperLU_DIST}: A Scalable Distributed-Memory Sparse Direct\n Solver for Unsymmetric Linear Systems},\n journal = {ACM Trans. Mathematical Software},\n volume = {29},\n number = {2},\n pages = {110-140},\n year = 2003\n}\n",&cite);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),107,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/aij/mpi/superlu_dist/superlu_dist.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
108 | ||||
109 | ierr = MPI_Comm_size(PetscObjectComm((PetscObject)A),&size);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),109,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/aij/mpi/superlu_dist/superlu_dist.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
110 | ||||
111 | if (lu->options.SolveInitialized && !lu->matsolve_iscalled) { | |||
112 | /* see comments in MatMatSolve() */ | |||
113 | #if defined(PETSC_USE_COMPLEX) | |||
114 | PetscStackCall("SuperLU_DIST:zSolveFinalize",zSolveFinalize(&lu->options, &lu->SOLVEstruct))do { do { do { ; if (petscstack && (petscstack->currentsize < 64)) { petscstack->function[petscstack->currentsize ] = "SuperLU_DIST:zSolveFinalize"; petscstack->file[petscstack ->currentsize] = "/sandbox/petsc/petsc.next/src/mat/impls/aij/mpi/superlu_dist/superlu_dist.c" ; petscstack->line[petscstack->currentsize] = 114; petscstack ->petscroutine[petscstack->currentsize] = PETSC_FALSE; petscstack ->currentsize++; } if (petscstack) { petscstack->hotdepth += (PETSC_FALSE || petscstack->hotdepth); } ; } while (0) ; do {PetscErrorCode _7_ierr = PetscMallocValidate(114,__func__ ,"/sandbox/petsc/petsc.next/src/mat/impls/aij/mpi/superlu_dist/superlu_dist.c" );do {if (__builtin_expect(!!(_7_ierr),0)) return PetscError( ((MPI_Comm)0x44000001),114,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/aij/mpi/superlu_dist/superlu_dist.c" ,_7_ierr,PETSC_ERROR_REPEAT," ");} while (0);} while(0); } while (0);zSolveFinalize(&lu->options, &lu->SOLVEstruct );do { do {PetscErrorCode _7_ierr = PetscMallocValidate(114,__func__ ,"/sandbox/petsc/petsc.next/src/mat/impls/aij/mpi/superlu_dist/superlu_dist.c" );do {if (__builtin_expect(!!(_7_ierr),0)) return PetscError( ((MPI_Comm)0x44000001),114,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/aij/mpi/superlu_dist/superlu_dist.c" ,_7_ierr,PETSC_ERROR_REPEAT," ");} while (0);} while(0); do { ; if (petscstack && petscstack->currentsize > 0 ) { petscstack->currentsize--; petscstack->function[petscstack ->currentsize] = 0; petscstack->file[petscstack->currentsize ] = 0; petscstack->line[petscstack->currentsize] = 0; petscstack ->petscroutine[petscstack->currentsize] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth = (((petscstack-> hotdepth-1)<(0)) ? (0) : (petscstack->hotdepth-1)); } ; } while (0); } while (0); } while(0); | |||
115 | #else | |||
116 | PetscStackCall("SuperLU_DIST:dSolveFinalize",dSolveFinalize(&lu->options, &lu->SOLVEstruct))do { do { do { ; if (petscstack && (petscstack->currentsize < 64)) { petscstack->function[petscstack->currentsize ] = "SuperLU_DIST:dSolveFinalize"; petscstack->file[petscstack ->currentsize] = "/sandbox/petsc/petsc.next/src/mat/impls/aij/mpi/superlu_dist/superlu_dist.c" ; petscstack->line[petscstack->currentsize] = 116; petscstack ->petscroutine[petscstack->currentsize] = PETSC_FALSE; petscstack ->currentsize++; } if (petscstack) { petscstack->hotdepth += (PETSC_FALSE || petscstack->hotdepth); } ; } while (0) ; do {PetscErrorCode _7_ierr = PetscMallocValidate(116,__func__ ,"/sandbox/petsc/petsc.next/src/mat/impls/aij/mpi/superlu_dist/superlu_dist.c" );do {if (__builtin_expect(!!(_7_ierr),0)) return PetscError( ((MPI_Comm)0x44000001),116,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/aij/mpi/superlu_dist/superlu_dist.c" ,_7_ierr,PETSC_ERROR_REPEAT," ");} while (0);} while(0); } while (0);dSolveFinalize(&lu->options, &lu->SOLVEstruct );do { do {PetscErrorCode _7_ierr = PetscMallocValidate(116,__func__ ,"/sandbox/petsc/petsc.next/src/mat/impls/aij/mpi/superlu_dist/superlu_dist.c" );do {if (__builtin_expect(!!(_7_ierr),0)) return PetscError( ((MPI_Comm)0x44000001),116,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/aij/mpi/superlu_dist/superlu_dist.c" ,_7_ierr,PETSC_ERROR_REPEAT," ");} while (0);} while(0); do { ; if (petscstack && petscstack->currentsize > 0 ) { petscstack->currentsize--; petscstack->function[petscstack ->currentsize] = 0; petscstack->file[petscstack->currentsize ] = 0; petscstack->line[petscstack->currentsize] = 0; petscstack ->petscroutine[petscstack->currentsize] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth = (((petscstack-> hotdepth-1)<(0)) ? (0) : (petscstack->hotdepth-1)); } ; } while (0); } while (0); } while(0); | |||
117 | #endif | |||
118 | lu->options.SolveInitialized = NO; | |||
119 | } | |||
120 | ierr = VecCopy(b_mpi,x);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),120,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/aij/mpi/superlu_dist/superlu_dist.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
121 | ierr = VecGetArray(x,&bptr);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),121,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/aij/mpi/superlu_dist/superlu_dist.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
122 | ||||
123 | PetscStackCall("SuperLU_DIST:PStatInit",PStatInit(&stat))do { do { do { ; if (petscstack && (petscstack->currentsize < 64)) { petscstack->function[petscstack->currentsize ] = "SuperLU_DIST:PStatInit"; petscstack->file[petscstack-> currentsize] = "/sandbox/petsc/petsc.next/src/mat/impls/aij/mpi/superlu_dist/superlu_dist.c" ; petscstack->line[petscstack->currentsize] = 123; petscstack ->petscroutine[petscstack->currentsize] = PETSC_FALSE; petscstack ->currentsize++; } if (petscstack) { petscstack->hotdepth += (PETSC_FALSE || petscstack->hotdepth); } ; } while (0) ; do {PetscErrorCode _7_ierr = PetscMallocValidate(123,__func__ ,"/sandbox/petsc/petsc.next/src/mat/impls/aij/mpi/superlu_dist/superlu_dist.c" );do {if (__builtin_expect(!!(_7_ierr),0)) return PetscError( ((MPI_Comm)0x44000001),123,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/aij/mpi/superlu_dist/superlu_dist.c" ,_7_ierr,PETSC_ERROR_REPEAT," ");} while (0);} while(0); } while (0);PStatInit(&stat);do { do {PetscErrorCode _7_ierr = PetscMallocValidate (123,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/aij/mpi/superlu_dist/superlu_dist.c" );do {if (__builtin_expect(!!(_7_ierr),0)) return PetscError( ((MPI_Comm)0x44000001),123,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/aij/mpi/superlu_dist/superlu_dist.c" ,_7_ierr,PETSC_ERROR_REPEAT," ");} while (0);} while(0); do { ; if (petscstack && petscstack->currentsize > 0 ) { petscstack->currentsize--; petscstack->function[petscstack ->currentsize] = 0; petscstack->file[petscstack->currentsize ] = 0; petscstack->line[petscstack->currentsize] = 0; petscstack ->petscroutine[petscstack->currentsize] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth = (((petscstack-> hotdepth-1)<(0)) ? (0) : (petscstack->hotdepth-1)); } ; } while (0); } while (0); } while(0); /* Initialize the statistics variables. */ | |||
124 | #if defined(PETSC_USE_COMPLEX) | |||
125 | PetscStackCall("SuperLU_DIST:pzgssvx",pzgssvx(&lu->options,&lu->A_sup,&lu->ScalePermstruct,(doublecomplex*)bptr,m,1,&lu->grid,&lu->LUstruct,&lu->SOLVEstruct,berr,&stat,&info))do { do { do { ; if (petscstack && (petscstack->currentsize < 64)) { petscstack->function[petscstack->currentsize ] = "SuperLU_DIST:pzgssvx"; petscstack->file[petscstack-> currentsize] = "/sandbox/petsc/petsc.next/src/mat/impls/aij/mpi/superlu_dist/superlu_dist.c" ; petscstack->line[petscstack->currentsize] = 125; petscstack ->petscroutine[petscstack->currentsize] = PETSC_FALSE; petscstack ->currentsize++; } if (petscstack) { petscstack->hotdepth += (PETSC_FALSE || petscstack->hotdepth); } ; } while (0) ; do {PetscErrorCode _7_ierr = PetscMallocValidate(125,__func__ ,"/sandbox/petsc/petsc.next/src/mat/impls/aij/mpi/superlu_dist/superlu_dist.c" );do {if (__builtin_expect(!!(_7_ierr),0)) return PetscError( ((MPI_Comm)0x44000001),125,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/aij/mpi/superlu_dist/superlu_dist.c" ,_7_ierr,PETSC_ERROR_REPEAT," ");} while (0);} while(0); } while (0);pzgssvx(&lu->options,&lu->A_sup,&lu-> ScalePermstruct,(doublecomplex*)bptr,m,1,&lu->grid,& lu->LUstruct,&lu->SOLVEstruct,berr,&stat,&info );do { do {PetscErrorCode _7_ierr = PetscMallocValidate(125,__func__ ,"/sandbox/petsc/petsc.next/src/mat/impls/aij/mpi/superlu_dist/superlu_dist.c" );do {if (__builtin_expect(!!(_7_ierr),0)) return PetscError( ((MPI_Comm)0x44000001),125,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/aij/mpi/superlu_dist/superlu_dist.c" ,_7_ierr,PETSC_ERROR_REPEAT," ");} while (0);} while(0); do { ; if (petscstack && petscstack->currentsize > 0 ) { petscstack->currentsize--; petscstack->function[petscstack ->currentsize] = 0; petscstack->file[petscstack->currentsize ] = 0; petscstack->line[petscstack->currentsize] = 0; petscstack ->petscroutine[petscstack->currentsize] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth = (((petscstack-> hotdepth-1)<(0)) ? (0) : (petscstack->hotdepth-1)); } ; } while (0); } while (0); } while(0); | |||
126 | #else | |||
127 | PetscStackCall("SuperLU_DIST:pdgssvx",pdgssvx(&lu->options,&lu->A_sup,&lu->ScalePermstruct,bptr,m,1,&lu->grid,&lu->LUstruct,&lu->SOLVEstruct,berr,&stat,&info))do { do { do { ; if (petscstack && (petscstack->currentsize < 64)) { petscstack->function[petscstack->currentsize ] = "SuperLU_DIST:pdgssvx"; petscstack->file[petscstack-> currentsize] = "/sandbox/petsc/petsc.next/src/mat/impls/aij/mpi/superlu_dist/superlu_dist.c" ; petscstack->line[petscstack->currentsize] = 127; petscstack ->petscroutine[petscstack->currentsize] = PETSC_FALSE; petscstack ->currentsize++; } if (petscstack) { petscstack->hotdepth += (PETSC_FALSE || petscstack->hotdepth); } ; } while (0) ; do {PetscErrorCode _7_ierr = PetscMallocValidate(127,__func__ ,"/sandbox/petsc/petsc.next/src/mat/impls/aij/mpi/superlu_dist/superlu_dist.c" );do {if (__builtin_expect(!!(_7_ierr),0)) return PetscError( ((MPI_Comm)0x44000001),127,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/aij/mpi/superlu_dist/superlu_dist.c" ,_7_ierr,PETSC_ERROR_REPEAT," ");} while (0);} while(0); } while (0);pdgssvx(&lu->options,&lu->A_sup,&lu-> ScalePermstruct,bptr,m,1,&lu->grid,&lu->LUstruct ,&lu->SOLVEstruct,berr,&stat,&info);do { do {PetscErrorCode _7_ierr = PetscMallocValidate(127,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/aij/mpi/superlu_dist/superlu_dist.c" );do {if (__builtin_expect(!!(_7_ierr),0)) return PetscError( ((MPI_Comm)0x44000001),127,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/aij/mpi/superlu_dist/superlu_dist.c" ,_7_ierr,PETSC_ERROR_REPEAT," ");} while (0);} while(0); do { ; if (petscstack && petscstack->currentsize > 0 ) { petscstack->currentsize--; petscstack->function[petscstack ->currentsize] = 0; petscstack->file[petscstack->currentsize ] = 0; petscstack->line[petscstack->currentsize] = 0; petscstack ->petscroutine[petscstack->currentsize] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth = (((petscstack-> hotdepth-1)<(0)) ? (0) : (petscstack->hotdepth-1)); } ; } while (0); } while (0); } while(0); | |||
128 | #endif | |||
129 | if (info) SETERRQ1(PETSC_COMM_SELF,PETSC_ERR_LIB,"pdgssvx fails, info: %d\n",info)return PetscError(((MPI_Comm)0x44000001),129,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/aij/mpi/superlu_dist/superlu_dist.c" ,76,PETSC_ERROR_INITIAL,"pdgssvx fails, info: %d\n",info); | |||
130 | ||||
131 | if (lu->options.PrintStat) PStatPrint(&lu->options, &stat, &lu->grid); /* Print the statistics. */ | |||
132 | PetscStackCall("SuperLU_DIST:PStatFree",PStatFree(&stat))do { do { do { ; if (petscstack && (petscstack->currentsize < 64)) { petscstack->function[petscstack->currentsize ] = "SuperLU_DIST:PStatFree"; petscstack->file[petscstack-> currentsize] = "/sandbox/petsc/petsc.next/src/mat/impls/aij/mpi/superlu_dist/superlu_dist.c" ; petscstack->line[petscstack->currentsize] = 132; petscstack ->petscroutine[petscstack->currentsize] = PETSC_FALSE; petscstack ->currentsize++; } if (petscstack) { petscstack->hotdepth += (PETSC_FALSE || petscstack->hotdepth); } ; } while (0) ; do {PetscErrorCode _7_ierr = PetscMallocValidate(132,__func__ ,"/sandbox/petsc/petsc.next/src/mat/impls/aij/mpi/superlu_dist/superlu_dist.c" );do {if (__builtin_expect(!!(_7_ierr),0)) return PetscError( ((MPI_Comm)0x44000001),132,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/aij/mpi/superlu_dist/superlu_dist.c" ,_7_ierr,PETSC_ERROR_REPEAT," ");} while (0);} while(0); } while (0);PStatFree(&stat);do { do {PetscErrorCode _7_ierr = PetscMallocValidate (132,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/aij/mpi/superlu_dist/superlu_dist.c" );do {if (__builtin_expect(!!(_7_ierr),0)) return PetscError( ((MPI_Comm)0x44000001),132,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/aij/mpi/superlu_dist/superlu_dist.c" ,_7_ierr,PETSC_ERROR_REPEAT," ");} while (0);} while(0); do { ; if (petscstack && petscstack->currentsize > 0 ) { petscstack->currentsize--; petscstack->function[petscstack ->currentsize] = 0; petscstack->file[petscstack->currentsize ] = 0; petscstack->line[petscstack->currentsize] = 0; petscstack ->petscroutine[petscstack->currentsize] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth = (((petscstack-> hotdepth-1)<(0)) ? (0) : (petscstack->hotdepth-1)); } ; } while (0); } while (0); } while(0); | |||
133 | ||||
134 | ierr = VecRestoreArray(x,&bptr);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),134,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/aij/mpi/superlu_dist/superlu_dist.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
135 | lu->matsolve_iscalled = PETSC_TRUE; | |||
136 | lu->matmatsolve_iscalled = PETSC_FALSE; | |||
137 | PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize > 0) { petscstack->currentsize--; petscstack->function [petscstack->currentsize] = 0; petscstack->file[petscstack ->currentsize] = 0; petscstack->line[petscstack->currentsize ] = 0; petscstack->petscroutine[petscstack->currentsize ] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth = (((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack-> hotdepth-1)); } ; } while (0); return(0);} while (0); | |||
138 | } | |||
139 | ||||
140 | static PetscErrorCode MatMatSolve_SuperLU_DIST(Mat A,Mat B_mpi,Mat X) | |||
141 | { | |||
142 | Mat_SuperLU_DIST *lu = (Mat_SuperLU_DIST*)A->data; | |||
143 | PetscErrorCode ierr; | |||
144 | PetscMPIInt size; | |||
145 | PetscInt m=A->rmap->n,nrhs; | |||
146 | SuperLUStat_t stat; | |||
147 | double berr[1]; | |||
148 | PetscScalar *bptr; | |||
149 | int info; /* SuperLU_Dist info code is ALWAYS an int, even with long long indices */ | |||
150 | PetscBool flg; | |||
151 | ||||
152 | PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize < 64)) { petscstack->function[petscstack->currentsize ] = __func__; petscstack->file[petscstack->currentsize] = "/sandbox/petsc/petsc.next/src/mat/impls/aij/mpi/superlu_dist/superlu_dist.c" ; petscstack->line[petscstack->currentsize] = 152; petscstack ->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack ->currentsize++; } if (petscstack) { petscstack->hotdepth += (PETSC_FALSE || petscstack->hotdepth); } ; } while (0) ; ; } while (0); | |||
153 | if (lu->options.Fact != FACTORED) SETERRQ(PETSC_COMM_SELF,PETSC_ERR_ARG_WRONG,"SuperLU_DIST options.Fact mush equal FACTORED")return PetscError(((MPI_Comm)0x44000001),153,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/aij/mpi/superlu_dist/superlu_dist.c" ,62,PETSC_ERROR_INITIAL,"SuperLU_DIST options.Fact mush equal FACTORED" ); | |||
154 | ierr = PetscObjectTypeCompareAny((PetscObject)B_mpi,&flg,MATSEQDENSE"seqdense",MATMPIDENSE"mpidense",NULL((void*)0));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),154,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/aij/mpi/superlu_dist/superlu_dist.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
155 | if (!flg) SETERRQ(PetscObjectComm((PetscObject)A),PETSC_ERR_ARG_WRONG,"Matrix B must be MATDENSE matrix")return PetscError(PetscObjectComm((PetscObject)A),155,__func__ ,"/sandbox/petsc/petsc.next/src/mat/impls/aij/mpi/superlu_dist/superlu_dist.c" ,62,PETSC_ERROR_INITIAL,"Matrix B must be MATDENSE matrix"); | |||
156 | ierr = PetscObjectTypeCompareAny((PetscObject)X,&flg,MATSEQDENSE"seqdense",MATMPIDENSE"mpidense",NULL((void*)0));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),156,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/aij/mpi/superlu_dist/superlu_dist.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
157 | if (!flg) SETERRQ(PetscObjectComm((PetscObject)A),PETSC_ERR_ARG_WRONG,"Matrix X must be MATDENSE matrix")return PetscError(PetscObjectComm((PetscObject)A),157,__func__ ,"/sandbox/petsc/petsc.next/src/mat/impls/aij/mpi/superlu_dist/superlu_dist.c" ,62,PETSC_ERROR_INITIAL,"Matrix X must be MATDENSE matrix"); | |||
158 | ||||
159 | ierr = MPI_Comm_size(PetscObjectComm((PetscObject)A),&size);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),159,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/aij/mpi/superlu_dist/superlu_dist.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
160 | ||||
161 | if (lu->options.SolveInitialized && !lu->matmatsolve_iscalled) { | |||
162 | /* communication pattern of SOLVEstruct is unlikely created for matmatsolve, | |||
163 | thus destroy it and create a new SOLVEstruct. | |||
164 | Otherwise it may result in memory corruption or incorrect solution | |||
165 | See src/mat/examples/tests/ex125.c */ | |||
166 | #if defined(PETSC_USE_COMPLEX) | |||
167 | PetscStackCall("SuperLU_DIST:zSolveFinalize",zSolveFinalize(&lu->options, &lu->SOLVEstruct))do { do { do { ; if (petscstack && (petscstack->currentsize < 64)) { petscstack->function[petscstack->currentsize ] = "SuperLU_DIST:zSolveFinalize"; petscstack->file[petscstack ->currentsize] = "/sandbox/petsc/petsc.next/src/mat/impls/aij/mpi/superlu_dist/superlu_dist.c" ; petscstack->line[petscstack->currentsize] = 167; petscstack ->petscroutine[petscstack->currentsize] = PETSC_FALSE; petscstack ->currentsize++; } if (petscstack) { petscstack->hotdepth += (PETSC_FALSE || petscstack->hotdepth); } ; } while (0) ; do {PetscErrorCode _7_ierr = PetscMallocValidate(167,__func__ ,"/sandbox/petsc/petsc.next/src/mat/impls/aij/mpi/superlu_dist/superlu_dist.c" );do {if (__builtin_expect(!!(_7_ierr),0)) return PetscError( ((MPI_Comm)0x44000001),167,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/aij/mpi/superlu_dist/superlu_dist.c" ,_7_ierr,PETSC_ERROR_REPEAT," ");} while (0);} while(0); } while (0);zSolveFinalize(&lu->options, &lu->SOLVEstruct );do { do {PetscErrorCode _7_ierr = PetscMallocValidate(167,__func__ ,"/sandbox/petsc/petsc.next/src/mat/impls/aij/mpi/superlu_dist/superlu_dist.c" );do {if (__builtin_expect(!!(_7_ierr),0)) return PetscError( ((MPI_Comm)0x44000001),167,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/aij/mpi/superlu_dist/superlu_dist.c" ,_7_ierr,PETSC_ERROR_REPEAT," ");} while (0);} while(0); do { ; if (petscstack && petscstack->currentsize > 0 ) { petscstack->currentsize--; petscstack->function[petscstack ->currentsize] = 0; petscstack->file[petscstack->currentsize ] = 0; petscstack->line[petscstack->currentsize] = 0; petscstack ->petscroutine[petscstack->currentsize] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth = (((petscstack-> hotdepth-1)<(0)) ? (0) : (petscstack->hotdepth-1)); } ; } while (0); } while (0); } while(0); | |||
168 | #else | |||
169 | PetscStackCall("SuperLU_DIST:dSolveFinalize",dSolveFinalize(&lu->options, &lu->SOLVEstruct))do { do { do { ; if (petscstack && (petscstack->currentsize < 64)) { petscstack->function[petscstack->currentsize ] = "SuperLU_DIST:dSolveFinalize"; petscstack->file[petscstack ->currentsize] = "/sandbox/petsc/petsc.next/src/mat/impls/aij/mpi/superlu_dist/superlu_dist.c" ; petscstack->line[petscstack->currentsize] = 169; petscstack ->petscroutine[petscstack->currentsize] = PETSC_FALSE; petscstack ->currentsize++; } if (petscstack) { petscstack->hotdepth += (PETSC_FALSE || petscstack->hotdepth); } ; } while (0) ; do {PetscErrorCode _7_ierr = PetscMallocValidate(169,__func__ ,"/sandbox/petsc/petsc.next/src/mat/impls/aij/mpi/superlu_dist/superlu_dist.c" );do {if (__builtin_expect(!!(_7_ierr),0)) return PetscError( ((MPI_Comm)0x44000001),169,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/aij/mpi/superlu_dist/superlu_dist.c" ,_7_ierr,PETSC_ERROR_REPEAT," ");} while (0);} while(0); } while (0);dSolveFinalize(&lu->options, &lu->SOLVEstruct );do { do {PetscErrorCode _7_ierr = PetscMallocValidate(169,__func__ ,"/sandbox/petsc/petsc.next/src/mat/impls/aij/mpi/superlu_dist/superlu_dist.c" );do {if (__builtin_expect(!!(_7_ierr),0)) return PetscError( ((MPI_Comm)0x44000001),169,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/aij/mpi/superlu_dist/superlu_dist.c" ,_7_ierr,PETSC_ERROR_REPEAT," ");} while (0);} while(0); do { ; if (petscstack && petscstack->currentsize > 0 ) { petscstack->currentsize--; petscstack->function[petscstack ->currentsize] = 0; petscstack->file[petscstack->currentsize ] = 0; petscstack->line[petscstack->currentsize] = 0; petscstack ->petscroutine[petscstack->currentsize] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth = (((petscstack-> hotdepth-1)<(0)) ? (0) : (petscstack->hotdepth-1)); } ; } while (0); } while (0); } while(0); | |||
170 | #endif | |||
171 | lu->options.SolveInitialized = NO; | |||
172 | } | |||
173 | ierr = MatCopy(B_mpi,X,SAME_NONZERO_PATTERN);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),173,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/aij/mpi/superlu_dist/superlu_dist.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
174 | ||||
175 | ierr = MatGetSize(B_mpi,NULL((void*)0),&nrhs);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),175,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/aij/mpi/superlu_dist/superlu_dist.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
176 | ||||
177 | PetscStackCall("SuperLU_DIST:PStatInit",PStatInit(&stat))do { do { do { ; if (petscstack && (petscstack->currentsize < 64)) { petscstack->function[petscstack->currentsize ] = "SuperLU_DIST:PStatInit"; petscstack->file[petscstack-> currentsize] = "/sandbox/petsc/petsc.next/src/mat/impls/aij/mpi/superlu_dist/superlu_dist.c" ; petscstack->line[petscstack->currentsize] = 177; petscstack ->petscroutine[petscstack->currentsize] = PETSC_FALSE; petscstack ->currentsize++; } if (petscstack) { petscstack->hotdepth += (PETSC_FALSE || petscstack->hotdepth); } ; } while (0) ; do {PetscErrorCode _7_ierr = PetscMallocValidate(177,__func__ ,"/sandbox/petsc/petsc.next/src/mat/impls/aij/mpi/superlu_dist/superlu_dist.c" );do {if (__builtin_expect(!!(_7_ierr),0)) return PetscError( ((MPI_Comm)0x44000001),177,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/aij/mpi/superlu_dist/superlu_dist.c" ,_7_ierr,PETSC_ERROR_REPEAT," ");} while (0);} while(0); } while (0);PStatInit(&stat);do { do {PetscErrorCode _7_ierr = PetscMallocValidate (177,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/aij/mpi/superlu_dist/superlu_dist.c" );do {if (__builtin_expect(!!(_7_ierr),0)) return PetscError( ((MPI_Comm)0x44000001),177,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/aij/mpi/superlu_dist/superlu_dist.c" ,_7_ierr,PETSC_ERROR_REPEAT," ");} while (0);} while(0); do { ; if (petscstack && petscstack->currentsize > 0 ) { petscstack->currentsize--; petscstack->function[petscstack ->currentsize] = 0; petscstack->file[petscstack->currentsize ] = 0; petscstack->line[petscstack->currentsize] = 0; petscstack ->petscroutine[petscstack->currentsize] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth = (((petscstack-> hotdepth-1)<(0)) ? (0) : (petscstack->hotdepth-1)); } ; } while (0); } while (0); } while(0); /* Initialize the statistics variables. */ | |||
178 | ierr = MatDenseGetArray(X,&bptr);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),178,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/aij/mpi/superlu_dist/superlu_dist.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
179 | ||||
180 | #if defined(PETSC_USE_COMPLEX) | |||
181 | PetscStackCall("SuperLU_DIST:pzgssvx",pzgssvx(&lu->options,&lu->A_sup,&lu->ScalePermstruct,(doublecomplex*)bptr,m,nrhs,&lu->grid, &lu->LUstruct,&lu->SOLVEstruct,berr,&stat,&info))do { do { do { ; if (petscstack && (petscstack->currentsize < 64)) { petscstack->function[petscstack->currentsize ] = "SuperLU_DIST:pzgssvx"; petscstack->file[petscstack-> currentsize] = "/sandbox/petsc/petsc.next/src/mat/impls/aij/mpi/superlu_dist/superlu_dist.c" ; petscstack->line[petscstack->currentsize] = 181; petscstack ->petscroutine[petscstack->currentsize] = PETSC_FALSE; petscstack ->currentsize++; } if (petscstack) { petscstack->hotdepth += (PETSC_FALSE || petscstack->hotdepth); } ; } while (0) ; do {PetscErrorCode _7_ierr = PetscMallocValidate(181,__func__ ,"/sandbox/petsc/petsc.next/src/mat/impls/aij/mpi/superlu_dist/superlu_dist.c" );do {if (__builtin_expect(!!(_7_ierr),0)) return PetscError( ((MPI_Comm)0x44000001),181,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/aij/mpi/superlu_dist/superlu_dist.c" ,_7_ierr,PETSC_ERROR_REPEAT," ");} while (0);} while(0); } while (0);pzgssvx(&lu->options,&lu->A_sup,&lu-> ScalePermstruct,(doublecomplex*)bptr,m,nrhs,&lu->grid, &lu->LUstruct,&lu->SOLVEstruct,berr,&stat, &info);do { do {PetscErrorCode _7_ierr = PetscMallocValidate (181,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/aij/mpi/superlu_dist/superlu_dist.c" );do {if (__builtin_expect(!!(_7_ierr),0)) return PetscError( ((MPI_Comm)0x44000001),181,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/aij/mpi/superlu_dist/superlu_dist.c" ,_7_ierr,PETSC_ERROR_REPEAT," ");} while (0);} while(0); do { ; if (petscstack && petscstack->currentsize > 0 ) { petscstack->currentsize--; petscstack->function[petscstack ->currentsize] = 0; petscstack->file[petscstack->currentsize ] = 0; petscstack->line[petscstack->currentsize] = 0; petscstack ->petscroutine[petscstack->currentsize] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth = (((petscstack-> hotdepth-1)<(0)) ? (0) : (petscstack->hotdepth-1)); } ; } while (0); } while (0); } while(0); | |||
182 | #else | |||
183 | PetscStackCall("SuperLU_DIST:pdgssvx",pdgssvx(&lu->options,&lu->A_sup,&lu->ScalePermstruct,bptr,m,nrhs,&lu->grid,&lu->LUstruct,&lu->SOLVEstruct,berr,&stat,&info))do { do { do { ; if (petscstack && (petscstack->currentsize < 64)) { petscstack->function[petscstack->currentsize ] = "SuperLU_DIST:pdgssvx"; petscstack->file[petscstack-> currentsize] = "/sandbox/petsc/petsc.next/src/mat/impls/aij/mpi/superlu_dist/superlu_dist.c" ; petscstack->line[petscstack->currentsize] = 183; petscstack ->petscroutine[petscstack->currentsize] = PETSC_FALSE; petscstack ->currentsize++; } if (petscstack) { petscstack->hotdepth += (PETSC_FALSE || petscstack->hotdepth); } ; } while (0) ; do {PetscErrorCode _7_ierr = PetscMallocValidate(183,__func__ ,"/sandbox/petsc/petsc.next/src/mat/impls/aij/mpi/superlu_dist/superlu_dist.c" );do {if (__builtin_expect(!!(_7_ierr),0)) return PetscError( ((MPI_Comm)0x44000001),183,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/aij/mpi/superlu_dist/superlu_dist.c" ,_7_ierr,PETSC_ERROR_REPEAT," ");} while (0);} while(0); } while (0);pdgssvx(&lu->options,&lu->A_sup,&lu-> ScalePermstruct,bptr,m,nrhs,&lu->grid,&lu->LUstruct ,&lu->SOLVEstruct,berr,&stat,&info);do { do {PetscErrorCode _7_ierr = PetscMallocValidate(183,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/aij/mpi/superlu_dist/superlu_dist.c" );do {if (__builtin_expect(!!(_7_ierr),0)) return PetscError( ((MPI_Comm)0x44000001),183,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/aij/mpi/superlu_dist/superlu_dist.c" ,_7_ierr,PETSC_ERROR_REPEAT," ");} while (0);} while(0); do { ; if (petscstack && petscstack->currentsize > 0 ) { petscstack->currentsize--; petscstack->function[petscstack ->currentsize] = 0; petscstack->file[petscstack->currentsize ] = 0; petscstack->line[petscstack->currentsize] = 0; petscstack ->petscroutine[petscstack->currentsize] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth = (((petscstack-> hotdepth-1)<(0)) ? (0) : (petscstack->hotdepth-1)); } ; } while (0); } while (0); } while(0); | |||
184 | #endif | |||
185 | ||||
186 | if (info) SETERRQ1(PETSC_COMM_SELF,PETSC_ERR_LIB,"pdgssvx fails, info: %d\n",info)return PetscError(((MPI_Comm)0x44000001),186,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/aij/mpi/superlu_dist/superlu_dist.c" ,76,PETSC_ERROR_INITIAL,"pdgssvx fails, info: %d\n",info); | |||
187 | ierr = MatDenseRestoreArray(X,&bptr);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),187,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/aij/mpi/superlu_dist/superlu_dist.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
188 | ||||
189 | if (lu->options.PrintStat) PStatPrint(&lu->options, &stat, &lu->grid); /* Print the statistics. */ | |||
190 | PetscStackCall("SuperLU_DIST:PStatFree",PStatFree(&stat))do { do { do { ; if (petscstack && (petscstack->currentsize < 64)) { petscstack->function[petscstack->currentsize ] = "SuperLU_DIST:PStatFree"; petscstack->file[petscstack-> currentsize] = "/sandbox/petsc/petsc.next/src/mat/impls/aij/mpi/superlu_dist/superlu_dist.c" ; petscstack->line[petscstack->currentsize] = 190; petscstack ->petscroutine[petscstack->currentsize] = PETSC_FALSE; petscstack ->currentsize++; } if (petscstack) { petscstack->hotdepth += (PETSC_FALSE || petscstack->hotdepth); } ; } while (0) ; do {PetscErrorCode _7_ierr = PetscMallocValidate(190,__func__ ,"/sandbox/petsc/petsc.next/src/mat/impls/aij/mpi/superlu_dist/superlu_dist.c" );do {if (__builtin_expect(!!(_7_ierr),0)) return PetscError( ((MPI_Comm)0x44000001),190,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/aij/mpi/superlu_dist/superlu_dist.c" ,_7_ierr,PETSC_ERROR_REPEAT," ");} while (0);} while(0); } while (0);PStatFree(&stat);do { do {PetscErrorCode _7_ierr = PetscMallocValidate (190,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/aij/mpi/superlu_dist/superlu_dist.c" );do {if (__builtin_expect(!!(_7_ierr),0)) return PetscError( ((MPI_Comm)0x44000001),190,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/aij/mpi/superlu_dist/superlu_dist.c" ,_7_ierr,PETSC_ERROR_REPEAT," ");} while (0);} while(0); do { ; if (petscstack && petscstack->currentsize > 0 ) { petscstack->currentsize--; petscstack->function[petscstack ->currentsize] = 0; petscstack->file[petscstack->currentsize ] = 0; petscstack->line[petscstack->currentsize] = 0; petscstack ->petscroutine[petscstack->currentsize] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth = (((petscstack-> hotdepth-1)<(0)) ? (0) : (petscstack->hotdepth-1)); } ; } while (0); } while (0); } while(0); | |||
191 | lu->matsolve_iscalled = PETSC_FALSE; | |||
192 | lu->matmatsolve_iscalled = PETSC_TRUE; | |||
193 | PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize > 0) { petscstack->currentsize--; petscstack->function [petscstack->currentsize] = 0; petscstack->file[petscstack ->currentsize] = 0; petscstack->line[petscstack->currentsize ] = 0; petscstack->petscroutine[petscstack->currentsize ] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth = (((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack-> hotdepth-1)); } ; } while (0); return(0);} while (0); | |||
194 | } | |||
195 | ||||
196 | /* | |||
197 | input: | |||
198 | F: numeric Cholesky factor | |||
199 | output: | |||
200 | nneg: total number of negative pivots | |||
201 | nzero: total number of zero pivots | |||
202 | npos: (global dimension of F) - nneg - nzero | |||
203 | */ | |||
204 | static PetscErrorCode MatGetInertia_SuperLU_DIST(Mat F,PetscInt *nneg,PetscInt *nzero,PetscInt *npos) | |||
205 | { | |||
206 | PetscErrorCode ierr; | |||
207 | Mat_SuperLU_DIST *lu = (Mat_SuperLU_DIST*)F->data; | |||
208 | PetscScalar *diagU=NULL((void*)0); | |||
209 | PetscInt M,i,neg=0,zero=0,pos=0; | |||
210 | PetscReal r; | |||
211 | ||||
212 | PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize < 64)) { petscstack->function[petscstack->currentsize ] = __func__; petscstack->file[petscstack->currentsize] = "/sandbox/petsc/petsc.next/src/mat/impls/aij/mpi/superlu_dist/superlu_dist.c" ; petscstack->line[petscstack->currentsize] = 212; petscstack ->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack ->currentsize++; } if (petscstack) { petscstack->hotdepth += (PETSC_FALSE || petscstack->hotdepth); } ; } while (0) ; ; } while (0); | |||
213 | if (!F->assembled) SETERRQ(PETSC_COMM_SELF,PETSC_ERR_ARG_WRONG,"Matrix factor F is not assembled")return PetscError(((MPI_Comm)0x44000001),213,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/aij/mpi/superlu_dist/superlu_dist.c" ,62,PETSC_ERROR_INITIAL,"Matrix factor F is not assembled"); | |||
214 | if (lu->options.RowPerm != NOROWPERM) SETERRQ(PETSC_COMM_SELF,PETSC_ERR_ARG_WRONG,"Must set NOROWPERM")return PetscError(((MPI_Comm)0x44000001),214,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/aij/mpi/superlu_dist/superlu_dist.c" ,62,PETSC_ERROR_INITIAL,"Must set NOROWPERM"); | |||
215 | ierr = MatGetSize(F,&M,NULL((void*)0));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),215,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/aij/mpi/superlu_dist/superlu_dist.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
216 | ierr = PetscMalloc1(M,&diagU)PetscMallocA(1,PETSC_FALSE,216,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/aij/mpi/superlu_dist/superlu_dist.c" ,(size_t)(M)*sizeof(**(&diagU)),(&diagU));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),216,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/aij/mpi/superlu_dist/superlu_dist.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
217 | ierr = MatSuperluDistGetDiagU(F,diagU);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),217,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/aij/mpi/superlu_dist/superlu_dist.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
218 | for (i=0; i<M; i++) { | |||
219 | #if defined(PETSC_USE_COMPLEX) | |||
220 | r = PetscImaginaryPart(diagU[i])((PetscReal)0.)/10.0; | |||
221 | if (r< -PETSC_MACHINE_EPSILON2.2204460492503131e-16 || r>PETSC_MACHINE_EPSILON2.2204460492503131e-16) SETERRQ3(PETSC_COMM_SELF,PETSC_ERR_ARG_WRONG,"diagU[%d]=%g + i %g is non-real",i,PetscRealPart(diagU[i]),r*10.0)return PetscError(((MPI_Comm)0x44000001),221,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/aij/mpi/superlu_dist/superlu_dist.c" ,62,PETSC_ERROR_INITIAL,"diagU[%d]=%g + i %g is non-real",i,( diagU[i]),r*10.0); | |||
222 | r = PetscRealPart(diagU[i])(diagU[i]); | |||
223 | #else | |||
224 | r = diagU[i]; | |||
225 | #endif | |||
226 | if (r > 0) { | |||
227 | pos++; | |||
228 | } else if (r < 0) { | |||
229 | neg++; | |||
230 | } else zero++; | |||
231 | } | |||
232 | ||||
233 | ierr = PetscFree(diagU)((*PetscTrFree)((void*)(diagU),233,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/aij/mpi/superlu_dist/superlu_dist.c" ) || ((diagU) = 0,0));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),233,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/aij/mpi/superlu_dist/superlu_dist.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
234 | if (nneg) *nneg = neg; | |||
235 | if (nzero) *nzero = zero; | |||
236 | if (npos) *npos = pos; | |||
237 | PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize > 0) { petscstack->currentsize--; petscstack->function [petscstack->currentsize] = 0; petscstack->file[petscstack ->currentsize] = 0; petscstack->line[petscstack->currentsize ] = 0; petscstack->petscroutine[petscstack->currentsize ] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth = (((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack-> hotdepth-1)); } ; } while (0); return(0);} while (0); | |||
238 | } | |||
239 | ||||
240 | static PetscErrorCode MatLUFactorNumeric_SuperLU_DIST(Mat F,Mat A,const MatFactorInfo *info) | |||
241 | { | |||
242 | Mat_SeqAIJ *aa=NULL((void*)0),*bb=NULL((void*)0); | |||
243 | Mat_SuperLU_DIST *lu = (Mat_SuperLU_DIST*)F->data; | |||
244 | PetscErrorCode ierr; | |||
245 | PetscInt M=A->rmap->N,N=A->cmap->N,i,*ai=NULL((void*)0),*aj=NULL((void*)0),*bi=NULL((void*)0),*bj=NULL((void*)0),nz,rstart,*garray=NULL((void*)0), | |||
246 | m=A->rmap->n, colA_start,j,jcol,jB,countA,countB,*bjj=NULL((void*)0),*ajj=NULL((void*)0); | |||
247 | int sinfo; /* SuperLU_Dist info flag is always an int even with long long indices */ | |||
248 | PetscMPIInt size; | |||
249 | SuperLUStat_t stat; | |||
250 | double *berr=0; | |||
251 | #if defined(PETSC_USE_COMPLEX) | |||
252 | doublecomplex *av=NULL((void*)0), *bv=NULL((void*)0); | |||
253 | #else | |||
254 | double *av=NULL((void*)0), *bv=NULL((void*)0); | |||
255 | #endif | |||
256 | ||||
257 | PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize < 64)) { petscstack->function[petscstack->currentsize ] = __func__; petscstack->file[petscstack->currentsize] = "/sandbox/petsc/petsc.next/src/mat/impls/aij/mpi/superlu_dist/superlu_dist.c" ; petscstack->line[petscstack->currentsize] = 257; petscstack ->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack ->currentsize++; } if (petscstack) { petscstack->hotdepth += (PETSC_FALSE || petscstack->hotdepth); } ; } while (0) ; ; } while (0); | |||
258 | ierr = MPI_Comm_size(PetscObjectComm((PetscObject)A),&size);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),258,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/aij/mpi/superlu_dist/superlu_dist.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
259 | ||||
260 | if (size == 1) { | |||
| ||||
261 | aa = (Mat_SeqAIJ*)A->data; | |||
262 | rstart = 0; | |||
263 | nz = aa->nz; | |||
264 | } else { | |||
265 | Mat_MPIAIJ *mat = (Mat_MPIAIJ*)A->data; | |||
266 | aa = (Mat_SeqAIJ*)(mat->A)->data; | |||
267 | bb = (Mat_SeqAIJ*)(mat->B)->data; | |||
268 | ai = aa->i; aj = aa->j; | |||
269 | bi = bb->i; bj = bb->j; | |||
270 | #if defined(PETSC_USE_COMPLEX) | |||
271 | av = (doublecomplex*)aa->a; | |||
272 | bv = (doublecomplex*)bb->a; | |||
273 | #else | |||
274 | av =aa->a; | |||
275 | bv = bb->a; | |||
276 | #endif | |||
277 | rstart = A->rmap->rstart; | |||
278 | nz = aa->nz + bb->nz; | |||
279 | garray = mat->garray; | |||
280 | } | |||
281 | ||||
282 | /* Allocations for A_sup */ | |||
283 | if (lu->options.Fact == DOFACT) { /* first numeric factorization */ | |||
284 | #if defined(PETSC_USE_COMPLEX) | |||
285 | PetscStackCall("SuperLU_DIST:zallocateA_dist",zallocateA_dist(m, nz, &lu->val, &lu->col, &lu->row))do { do { do { ; if (petscstack && (petscstack->currentsize < 64)) { petscstack->function[petscstack->currentsize ] = "SuperLU_DIST:zallocateA_dist"; petscstack->file[petscstack ->currentsize] = "/sandbox/petsc/petsc.next/src/mat/impls/aij/mpi/superlu_dist/superlu_dist.c" ; petscstack->line[petscstack->currentsize] = 285; petscstack ->petscroutine[petscstack->currentsize] = PETSC_FALSE; petscstack ->currentsize++; } if (petscstack) { petscstack->hotdepth += (PETSC_FALSE || petscstack->hotdepth); } ; } while (0) ; do {PetscErrorCode _7_ierr = PetscMallocValidate(285,__func__ ,"/sandbox/petsc/petsc.next/src/mat/impls/aij/mpi/superlu_dist/superlu_dist.c" );do {if (__builtin_expect(!!(_7_ierr),0)) return PetscError( ((MPI_Comm)0x44000001),285,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/aij/mpi/superlu_dist/superlu_dist.c" ,_7_ierr,PETSC_ERROR_REPEAT," ");} while (0);} while(0); } while (0);zallocateA_dist(m, nz, &lu->val, &lu->col, &lu->row);do { do {PetscErrorCode _7_ierr = PetscMallocValidate (285,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/aij/mpi/superlu_dist/superlu_dist.c" );do {if (__builtin_expect(!!(_7_ierr),0)) return PetscError( ((MPI_Comm)0x44000001),285,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/aij/mpi/superlu_dist/superlu_dist.c" ,_7_ierr,PETSC_ERROR_REPEAT," ");} while (0);} while(0); do { ; if (petscstack && petscstack->currentsize > 0 ) { petscstack->currentsize--; petscstack->function[petscstack ->currentsize] = 0; petscstack->file[petscstack->currentsize ] = 0; petscstack->line[petscstack->currentsize] = 0; petscstack ->petscroutine[petscstack->currentsize] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth = (((petscstack-> hotdepth-1)<(0)) ? (0) : (petscstack->hotdepth-1)); } ; } while (0); } while (0); } while(0); | |||
286 | #else | |||
287 | PetscStackCall("SuperLU_DIST:dallocateA_dist",dallocateA_dist(m, nz, &lu->val, &lu->col, &lu->row))do { do { do { ; if (petscstack && (petscstack->currentsize < 64)) { petscstack->function[petscstack->currentsize ] = "SuperLU_DIST:dallocateA_dist"; petscstack->file[petscstack ->currentsize] = "/sandbox/petsc/petsc.next/src/mat/impls/aij/mpi/superlu_dist/superlu_dist.c" ; petscstack->line[petscstack->currentsize] = 287; petscstack ->petscroutine[petscstack->currentsize] = PETSC_FALSE; petscstack ->currentsize++; } if (petscstack) { petscstack->hotdepth += (PETSC_FALSE || petscstack->hotdepth); } ; } while (0) ; do {PetscErrorCode _7_ierr = PetscMallocValidate(287,__func__ ,"/sandbox/petsc/petsc.next/src/mat/impls/aij/mpi/superlu_dist/superlu_dist.c" );do {if (__builtin_expect(!!(_7_ierr),0)) return PetscError( ((MPI_Comm)0x44000001),287,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/aij/mpi/superlu_dist/superlu_dist.c" ,_7_ierr,PETSC_ERROR_REPEAT," ");} while (0);} while(0); } while (0);dallocateA_dist(m, nz, &lu->val, &lu->col, &lu->row);do { do {PetscErrorCode _7_ierr = PetscMallocValidate (287,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/aij/mpi/superlu_dist/superlu_dist.c" );do {if (__builtin_expect(!!(_7_ierr),0)) return PetscError( ((MPI_Comm)0x44000001),287,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/aij/mpi/superlu_dist/superlu_dist.c" ,_7_ierr,PETSC_ERROR_REPEAT," ");} while (0);} while(0); do { ; if (petscstack && petscstack->currentsize > 0 ) { petscstack->currentsize--; petscstack->function[petscstack ->currentsize] = 0; petscstack->file[petscstack->currentsize ] = 0; petscstack->line[petscstack->currentsize] = 0; petscstack ->petscroutine[petscstack->currentsize] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth = (((petscstack-> hotdepth-1)<(0)) ? (0) : (petscstack->hotdepth-1)); } ; } while (0); } while (0); } while(0); | |||
288 | #endif | |||
289 | } else { /* successive numeric factorization, sparsity pattern and perm_c are reused. */ | |||
290 | if (lu->FactPattern == SamePattern_SameRowPerm) { | |||
291 | lu->options.Fact = SamePattern_SameRowPerm; /* matrix has similar numerical values */ | |||
292 | } else if (lu->FactPattern == SamePattern) { | |||
293 | PetscStackCall("SuperLU_DIST:Destroy_LU",Destroy_LU(N, &lu->grid, &lu->LUstruct))do { do { do { ; if (petscstack && (petscstack->currentsize < 64)) { petscstack->function[petscstack->currentsize ] = "SuperLU_DIST:Destroy_LU"; petscstack->file[petscstack ->currentsize] = "/sandbox/petsc/petsc.next/src/mat/impls/aij/mpi/superlu_dist/superlu_dist.c" ; petscstack->line[petscstack->currentsize] = 293; petscstack ->petscroutine[petscstack->currentsize] = PETSC_FALSE; petscstack ->currentsize++; } if (petscstack) { petscstack->hotdepth += (PETSC_FALSE || petscstack->hotdepth); } ; } while (0) ; do {PetscErrorCode _7_ierr = PetscMallocValidate(293,__func__ ,"/sandbox/petsc/petsc.next/src/mat/impls/aij/mpi/superlu_dist/superlu_dist.c" );do {if (__builtin_expect(!!(_7_ierr),0)) return PetscError( ((MPI_Comm)0x44000001),293,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/aij/mpi/superlu_dist/superlu_dist.c" ,_7_ierr,PETSC_ERROR_REPEAT," ");} while (0);} while(0); } while (0);Destroy_LU(N, &lu->grid, &lu->LUstruct);do { do {PetscErrorCode _7_ierr = PetscMallocValidate(293,__func__ ,"/sandbox/petsc/petsc.next/src/mat/impls/aij/mpi/superlu_dist/superlu_dist.c" );do {if (__builtin_expect(!!(_7_ierr),0)) return PetscError( ((MPI_Comm)0x44000001),293,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/aij/mpi/superlu_dist/superlu_dist.c" ,_7_ierr,PETSC_ERROR_REPEAT," ");} while (0);} while(0); do { ; if (petscstack && petscstack->currentsize > 0 ) { petscstack->currentsize--; petscstack->function[petscstack ->currentsize] = 0; petscstack->file[petscstack->currentsize ] = 0; petscstack->line[petscstack->currentsize] = 0; petscstack ->petscroutine[petscstack->currentsize] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth = (((petscstack-> hotdepth-1)<(0)) ? (0) : (petscstack->hotdepth-1)); } ; } while (0); } while (0); } while(0); /* Deallocate L and U matrices. */ | |||
294 | lu->options.Fact = SamePattern; | |||
295 | } else if (lu->FactPattern == DOFACT) { | |||
296 | PetscStackCall("SuperLU_DIST:Destroy_CompRowLoc_Matrix_dist",Destroy_CompRowLoc_Matrix_dist(&lu->A_sup))do { do { do { ; if (petscstack && (petscstack->currentsize < 64)) { petscstack->function[petscstack->currentsize ] = "SuperLU_DIST:Destroy_CompRowLoc_Matrix_dist"; petscstack ->file[petscstack->currentsize] = "/sandbox/petsc/petsc.next/src/mat/impls/aij/mpi/superlu_dist/superlu_dist.c" ; petscstack->line[petscstack->currentsize] = 296; petscstack ->petscroutine[petscstack->currentsize] = PETSC_FALSE; petscstack ->currentsize++; } if (petscstack) { petscstack->hotdepth += (PETSC_FALSE || petscstack->hotdepth); } ; } while (0) ; do {PetscErrorCode _7_ierr = PetscMallocValidate(296,__func__ ,"/sandbox/petsc/petsc.next/src/mat/impls/aij/mpi/superlu_dist/superlu_dist.c" );do {if (__builtin_expect(!!(_7_ierr),0)) return PetscError( ((MPI_Comm)0x44000001),296,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/aij/mpi/superlu_dist/superlu_dist.c" ,_7_ierr,PETSC_ERROR_REPEAT," ");} while (0);} while(0); } while (0);Destroy_CompRowLoc_Matrix_dist(&lu->A_sup);do { do {PetscErrorCode _7_ierr = PetscMallocValidate(296,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/aij/mpi/superlu_dist/superlu_dist.c" );do {if (__builtin_expect(!!(_7_ierr),0)) return PetscError( ((MPI_Comm)0x44000001),296,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/aij/mpi/superlu_dist/superlu_dist.c" ,_7_ierr,PETSC_ERROR_REPEAT," ");} while (0);} while(0); do { ; if (petscstack && petscstack->currentsize > 0 ) { petscstack->currentsize--; petscstack->function[petscstack ->currentsize] = 0; petscstack->file[petscstack->currentsize ] = 0; petscstack->line[petscstack->currentsize] = 0; petscstack ->petscroutine[petscstack->currentsize] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth = (((petscstack-> hotdepth-1)<(0)) ? (0) : (petscstack->hotdepth-1)); } ; } while (0); } while (0); } while(0); | |||
297 | PetscStackCall("SuperLU_DIST:Destroy_LU",Destroy_LU(N, &lu->grid, &lu->LUstruct))do { do { do { ; if (petscstack && (petscstack->currentsize < 64)) { petscstack->function[petscstack->currentsize ] = "SuperLU_DIST:Destroy_LU"; petscstack->file[petscstack ->currentsize] = "/sandbox/petsc/petsc.next/src/mat/impls/aij/mpi/superlu_dist/superlu_dist.c" ; petscstack->line[petscstack->currentsize] = 297; petscstack ->petscroutine[petscstack->currentsize] = PETSC_FALSE; petscstack ->currentsize++; } if (petscstack) { petscstack->hotdepth += (PETSC_FALSE || petscstack->hotdepth); } ; } while (0) ; do {PetscErrorCode _7_ierr = PetscMallocValidate(297,__func__ ,"/sandbox/petsc/petsc.next/src/mat/impls/aij/mpi/superlu_dist/superlu_dist.c" );do {if (__builtin_expect(!!(_7_ierr),0)) return PetscError( ((MPI_Comm)0x44000001),297,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/aij/mpi/superlu_dist/superlu_dist.c" ,_7_ierr,PETSC_ERROR_REPEAT," ");} while (0);} while(0); } while (0);Destroy_LU(N, &lu->grid, &lu->LUstruct);do { do {PetscErrorCode _7_ierr = PetscMallocValidate(297,__func__ ,"/sandbox/petsc/petsc.next/src/mat/impls/aij/mpi/superlu_dist/superlu_dist.c" );do {if (__builtin_expect(!!(_7_ierr),0)) return PetscError( ((MPI_Comm)0x44000001),297,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/aij/mpi/superlu_dist/superlu_dist.c" ,_7_ierr,PETSC_ERROR_REPEAT," ");} while (0);} while(0); do { ; if (petscstack && petscstack->currentsize > 0 ) { petscstack->currentsize--; petscstack->function[petscstack ->currentsize] = 0; petscstack->file[petscstack->currentsize ] = 0; petscstack->line[petscstack->currentsize] = 0; petscstack ->petscroutine[petscstack->currentsize] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth = (((petscstack-> hotdepth-1)<(0)) ? (0) : (petscstack->hotdepth-1)); } ; } while (0); } while (0); } while(0); | |||
298 | lu->options.Fact = DOFACT; | |||
299 | ||||
300 | #if defined(PETSC_USE_COMPLEX) | |||
301 | PetscStackCall("SuperLU_DIST:zallocateA_dist",zallocateA_dist(m, nz, &lu->val, &lu->col, &lu->row))do { do { do { ; if (petscstack && (petscstack->currentsize < 64)) { petscstack->function[petscstack->currentsize ] = "SuperLU_DIST:zallocateA_dist"; petscstack->file[petscstack ->currentsize] = "/sandbox/petsc/petsc.next/src/mat/impls/aij/mpi/superlu_dist/superlu_dist.c" ; petscstack->line[petscstack->currentsize] = 301; petscstack ->petscroutine[petscstack->currentsize] = PETSC_FALSE; petscstack ->currentsize++; } if (petscstack) { petscstack->hotdepth += (PETSC_FALSE || petscstack->hotdepth); } ; } while (0) ; do {PetscErrorCode _7_ierr = PetscMallocValidate(301,__func__ ,"/sandbox/petsc/petsc.next/src/mat/impls/aij/mpi/superlu_dist/superlu_dist.c" );do {if (__builtin_expect(!!(_7_ierr),0)) return PetscError( ((MPI_Comm)0x44000001),301,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/aij/mpi/superlu_dist/superlu_dist.c" ,_7_ierr,PETSC_ERROR_REPEAT," ");} while (0);} while(0); } while (0);zallocateA_dist(m, nz, &lu->val, &lu->col, &lu->row);do { do {PetscErrorCode _7_ierr = PetscMallocValidate (301,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/aij/mpi/superlu_dist/superlu_dist.c" );do {if (__builtin_expect(!!(_7_ierr),0)) return PetscError( ((MPI_Comm)0x44000001),301,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/aij/mpi/superlu_dist/superlu_dist.c" ,_7_ierr,PETSC_ERROR_REPEAT," ");} while (0);} while(0); do { ; if (petscstack && petscstack->currentsize > 0 ) { petscstack->currentsize--; petscstack->function[petscstack ->currentsize] = 0; petscstack->file[petscstack->currentsize ] = 0; petscstack->line[petscstack->currentsize] = 0; petscstack ->petscroutine[petscstack->currentsize] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth = (((petscstack-> hotdepth-1)<(0)) ? (0) : (petscstack->hotdepth-1)); } ; } while (0); } while (0); } while(0); | |||
302 | #else | |||
303 | PetscStackCall("SuperLU_DIST:dallocateA_dist",dallocateA_dist(m, nz, &lu->val, &lu->col, &lu->row))do { do { do { ; if (petscstack && (petscstack->currentsize < 64)) { petscstack->function[petscstack->currentsize ] = "SuperLU_DIST:dallocateA_dist"; petscstack->file[petscstack ->currentsize] = "/sandbox/petsc/petsc.next/src/mat/impls/aij/mpi/superlu_dist/superlu_dist.c" ; petscstack->line[petscstack->currentsize] = 303; petscstack ->petscroutine[petscstack->currentsize] = PETSC_FALSE; petscstack ->currentsize++; } if (petscstack) { petscstack->hotdepth += (PETSC_FALSE || petscstack->hotdepth); } ; } while (0) ; do {PetscErrorCode _7_ierr = PetscMallocValidate(303,__func__ ,"/sandbox/petsc/petsc.next/src/mat/impls/aij/mpi/superlu_dist/superlu_dist.c" );do {if (__builtin_expect(!!(_7_ierr),0)) return PetscError( ((MPI_Comm)0x44000001),303,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/aij/mpi/superlu_dist/superlu_dist.c" ,_7_ierr,PETSC_ERROR_REPEAT," ");} while (0);} while(0); } while (0);dallocateA_dist(m, nz, &lu->val, &lu->col, &lu->row);do { do {PetscErrorCode _7_ierr = PetscMallocValidate (303,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/aij/mpi/superlu_dist/superlu_dist.c" );do {if (__builtin_expect(!!(_7_ierr),0)) return PetscError( ((MPI_Comm)0x44000001),303,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/aij/mpi/superlu_dist/superlu_dist.c" ,_7_ierr,PETSC_ERROR_REPEAT," ");} while (0);} while(0); do { ; if (petscstack && petscstack->currentsize > 0 ) { petscstack->currentsize--; petscstack->function[petscstack ->currentsize] = 0; petscstack->file[petscstack->currentsize ] = 0; petscstack->line[petscstack->currentsize] = 0; petscstack ->petscroutine[petscstack->currentsize] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth = (((petscstack-> hotdepth-1)<(0)) ? (0) : (petscstack->hotdepth-1)); } ; } while (0); } while (0); } while(0); | |||
304 | #endif | |||
305 | } else { | |||
306 | SETERRQ(PETSC_COMM_SELF,PETSC_ERR_SUP,"options.Fact must be one of SamePattern SamePattern_SameRowPerm DOFACT")return PetscError(((MPI_Comm)0x44000001),306,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/aij/mpi/superlu_dist/superlu_dist.c" ,56,PETSC_ERROR_INITIAL,"options.Fact must be one of SamePattern SamePattern_SameRowPerm DOFACT" ); | |||
307 | } | |||
308 | } | |||
309 | ||||
310 | /* Copy AIJ matrix to superlu_dist matrix */ | |||
311 | if (size == 1) { /* A_sup has same SeqAIJ format as input mat */ | |||
312 | ai = aa->i; aj = aa->j; | |||
313 | #if defined(PETSC_USE_COMPLEX) | |||
314 | av = (doublecomplex*)aa->a; | |||
315 | #else | |||
316 | av = aa->a; | |||
317 | #endif | |||
318 | ||||
319 | ierr = PetscArraycpy(lu->row,ai,(m+1))((sizeof(*(lu->row)) != sizeof(*(ai))) || PetscMemcpy(lu-> row,ai,((m+1))*sizeof(*(lu->row))));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),319,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/aij/mpi/superlu_dist/superlu_dist.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
320 | ierr = PetscArraycpy(lu->col,aj,nz)((sizeof(*(lu->col)) != sizeof(*(aj))) || PetscMemcpy(lu-> col,aj,(nz)*sizeof(*(lu->col))));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),320,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/aij/mpi/superlu_dist/superlu_dist.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
321 | ierr = PetscArraycpy(lu->val,av,nz)((sizeof(*(lu->val)) != sizeof(*(av))) || PetscMemcpy(lu-> val,av,(nz)*sizeof(*(lu->val))));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),321,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/aij/mpi/superlu_dist/superlu_dist.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
322 | } else { | |||
323 | nz = 0; | |||
324 | for (i=0; i<m; i++) { | |||
325 | lu->row[i] = nz; | |||
326 | countA = ai[i+1] - ai[i]; | |||
327 | countB = bi[i+1] - bi[i]; | |||
328 | if (aj) { | |||
329 | ajj = aj + ai[i]; /* ptr to the beginning of this row */ | |||
330 | } else { | |||
331 | ajj = NULL((void*)0); | |||
332 | } | |||
333 | bjj = bj + bi[i]; | |||
334 | ||||
335 | /* B part, smaller col index */ | |||
336 | if (aj) { | |||
337 | colA_start = rstart + ajj[0]; /* the smallest global col index of A */ | |||
338 | } else { /* superlu_dist does not require matrix has diagonal entries, thus aj=NULL would work */ | |||
339 | colA_start = rstart; | |||
340 | } | |||
341 | jB = 0; | |||
342 | for (j=0; j<countB; j++) { | |||
343 | jcol = garray[bjj[j]]; | |||
344 | if (jcol > colA_start) { | |||
345 | jB = j; | |||
346 | break; | |||
347 | } | |||
348 | lu->col[nz] = jcol; | |||
349 | lu->val[nz++] = *bv++; | |||
350 | if (j==countB-1) jB = countB; | |||
351 | } | |||
352 | ||||
353 | /* A part */ | |||
354 | for (j=0; j<countA; j++) { | |||
355 | lu->col[nz] = rstart + ajj[j]; | |||
| ||||
356 | lu->val[nz++] = *av++; | |||
357 | } | |||
358 | ||||
359 | /* B part, larger col index */ | |||
360 | for (j=jB; j<countB; j++) { | |||
361 | lu->col[nz] = garray[bjj[j]]; | |||
362 | lu->val[nz++] = *bv++; | |||
363 | } | |||
364 | } | |||
365 | lu->row[m] = nz; | |||
366 | } | |||
367 | ||||
368 | /* Create and setup A_sup */ | |||
369 | if (lu->options.Fact == DOFACT) { | |||
370 | #if defined(PETSC_USE_COMPLEX) | |||
371 | PetscStackCall("SuperLU_DIST:zCreate_CompRowLoc_Matrix_dist",zCreate_CompRowLoc_Matrix_dist(&lu->A_sup, M, N, nz, m, rstart,lu->val, lu->col, lu->row, SLU_NR_loc, SLU_Z, SLU_GE))do { do { do { ; if (petscstack && (petscstack->currentsize < 64)) { petscstack->function[petscstack->currentsize ] = "SuperLU_DIST:zCreate_CompRowLoc_Matrix_dist"; petscstack ->file[petscstack->currentsize] = "/sandbox/petsc/petsc.next/src/mat/impls/aij/mpi/superlu_dist/superlu_dist.c" ; petscstack->line[petscstack->currentsize] = 371; petscstack ->petscroutine[petscstack->currentsize] = PETSC_FALSE; petscstack ->currentsize++; } if (petscstack) { petscstack->hotdepth += (PETSC_FALSE || petscstack->hotdepth); } ; } while (0) ; do {PetscErrorCode _7_ierr = PetscMallocValidate(371,__func__ ,"/sandbox/petsc/petsc.next/src/mat/impls/aij/mpi/superlu_dist/superlu_dist.c" );do {if (__builtin_expect(!!(_7_ierr),0)) return PetscError( ((MPI_Comm)0x44000001),371,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/aij/mpi/superlu_dist/superlu_dist.c" ,_7_ierr,PETSC_ERROR_REPEAT," ");} while (0);} while(0); } while (0);zCreate_CompRowLoc_Matrix_dist(&lu->A_sup, M, N, nz , m, rstart,lu->val, lu->col, lu->row, SLU_NR_loc, SLU_Z , SLU_GE);do { do {PetscErrorCode _7_ierr = PetscMallocValidate (371,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/aij/mpi/superlu_dist/superlu_dist.c" );do {if (__builtin_expect(!!(_7_ierr),0)) return PetscError( ((MPI_Comm)0x44000001),371,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/aij/mpi/superlu_dist/superlu_dist.c" ,_7_ierr,PETSC_ERROR_REPEAT," ");} while (0);} while(0); do { ; if (petscstack && petscstack->currentsize > 0 ) { petscstack->currentsize--; petscstack->function[petscstack ->currentsize] = 0; petscstack->file[petscstack->currentsize ] = 0; petscstack->line[petscstack->currentsize] = 0; petscstack ->petscroutine[petscstack->currentsize] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth = (((petscstack-> hotdepth-1)<(0)) ? (0) : (petscstack->hotdepth-1)); } ; } while (0); } while (0); } while(0); | |||
372 | #else | |||
373 | PetscStackCall("SuperLU_DIST:dCreate_CompRowLoc_Matrix_dist",dCreate_CompRowLoc_Matrix_dist(&lu->A_sup, M, N, nz, m, rstart,lu->val, lu->col, lu->row, SLU_NR_loc, SLU_D, SLU_GE))do { do { do { ; if (petscstack && (petscstack->currentsize < 64)) { petscstack->function[petscstack->currentsize ] = "SuperLU_DIST:dCreate_CompRowLoc_Matrix_dist"; petscstack ->file[petscstack->currentsize] = "/sandbox/petsc/petsc.next/src/mat/impls/aij/mpi/superlu_dist/superlu_dist.c" ; petscstack->line[petscstack->currentsize] = 373; petscstack ->petscroutine[petscstack->currentsize] = PETSC_FALSE; petscstack ->currentsize++; } if (petscstack) { petscstack->hotdepth += (PETSC_FALSE || petscstack->hotdepth); } ; } while (0) ; do {PetscErrorCode _7_ierr = PetscMallocValidate(373,__func__ ,"/sandbox/petsc/petsc.next/src/mat/impls/aij/mpi/superlu_dist/superlu_dist.c" );do {if (__builtin_expect(!!(_7_ierr),0)) return PetscError( ((MPI_Comm)0x44000001),373,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/aij/mpi/superlu_dist/superlu_dist.c" ,_7_ierr,PETSC_ERROR_REPEAT," ");} while (0);} while(0); } while (0);dCreate_CompRowLoc_Matrix_dist(&lu->A_sup, M, N, nz , m, rstart,lu->val, lu->col, lu->row, SLU_NR_loc, SLU_D , SLU_GE);do { do {PetscErrorCode _7_ierr = PetscMallocValidate (373,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/aij/mpi/superlu_dist/superlu_dist.c" );do {if (__builtin_expect(!!(_7_ierr),0)) return PetscError( ((MPI_Comm)0x44000001),373,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/aij/mpi/superlu_dist/superlu_dist.c" ,_7_ierr,PETSC_ERROR_REPEAT," ");} while (0);} while(0); do { ; if (petscstack && petscstack->currentsize > 0 ) { petscstack->currentsize--; petscstack->function[petscstack ->currentsize] = 0; petscstack->file[petscstack->currentsize ] = 0; petscstack->line[petscstack->currentsize] = 0; petscstack ->petscroutine[petscstack->currentsize] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth = (((petscstack-> hotdepth-1)<(0)) ? (0) : (petscstack->hotdepth-1)); } ; } while (0); } while (0); } while(0); | |||
374 | #endif | |||
375 | } | |||
376 | ||||
377 | /* Factor the matrix. */ | |||
378 | PetscStackCall("SuperLU_DIST:PStatInit",PStatInit(&stat))do { do { do { ; if (petscstack && (petscstack->currentsize < 64)) { petscstack->function[petscstack->currentsize ] = "SuperLU_DIST:PStatInit"; petscstack->file[petscstack-> currentsize] = "/sandbox/petsc/petsc.next/src/mat/impls/aij/mpi/superlu_dist/superlu_dist.c" ; petscstack->line[petscstack->currentsize] = 378; petscstack ->petscroutine[petscstack->currentsize] = PETSC_FALSE; petscstack ->currentsize++; } if (petscstack) { petscstack->hotdepth += (PETSC_FALSE || petscstack->hotdepth); } ; } while (0) ; do {PetscErrorCode _7_ierr = PetscMallocValidate(378,__func__ ,"/sandbox/petsc/petsc.next/src/mat/impls/aij/mpi/superlu_dist/superlu_dist.c" );do {if (__builtin_expect(!!(_7_ierr),0)) return PetscError( ((MPI_Comm)0x44000001),378,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/aij/mpi/superlu_dist/superlu_dist.c" ,_7_ierr,PETSC_ERROR_REPEAT," ");} while (0);} while(0); } while (0);PStatInit(&stat);do { do {PetscErrorCode _7_ierr = PetscMallocValidate (378,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/aij/mpi/superlu_dist/superlu_dist.c" );do {if (__builtin_expect(!!(_7_ierr),0)) return PetscError( ((MPI_Comm)0x44000001),378,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/aij/mpi/superlu_dist/superlu_dist.c" ,_7_ierr,PETSC_ERROR_REPEAT," ");} while (0);} while(0); do { ; if (petscstack && petscstack->currentsize > 0 ) { petscstack->currentsize--; petscstack->function[petscstack ->currentsize] = 0; petscstack->file[petscstack->currentsize ] = 0; petscstack->line[petscstack->currentsize] = 0; petscstack ->petscroutine[petscstack->currentsize] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth = (((petscstack-> hotdepth-1)<(0)) ? (0) : (petscstack->hotdepth-1)); } ; } while (0); } while (0); } while(0); /* Initialize the statistics variables. */ | |||
379 | #if defined(PETSC_USE_COMPLEX) | |||
380 | PetscStackCall("SuperLU_DIST:pzgssvx",pzgssvx(&lu->options, &lu->A_sup, &lu->ScalePermstruct, 0, m, 0, &lu->grid,&lu->LUstruct, &lu->SOLVEstruct, berr, &stat, &sinfo))do { do { do { ; if (petscstack && (petscstack->currentsize < 64)) { petscstack->function[petscstack->currentsize ] = "SuperLU_DIST:pzgssvx"; petscstack->file[petscstack-> currentsize] = "/sandbox/petsc/petsc.next/src/mat/impls/aij/mpi/superlu_dist/superlu_dist.c" ; petscstack->line[petscstack->currentsize] = 380; petscstack ->petscroutine[petscstack->currentsize] = PETSC_FALSE; petscstack ->currentsize++; } if (petscstack) { petscstack->hotdepth += (PETSC_FALSE || petscstack->hotdepth); } ; } while (0) ; do {PetscErrorCode _7_ierr = PetscMallocValidate(380,__func__ ,"/sandbox/petsc/petsc.next/src/mat/impls/aij/mpi/superlu_dist/superlu_dist.c" );do {if (__builtin_expect(!!(_7_ierr),0)) return PetscError( ((MPI_Comm)0x44000001),380,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/aij/mpi/superlu_dist/superlu_dist.c" ,_7_ierr,PETSC_ERROR_REPEAT," ");} while (0);} while(0); } while (0);pzgssvx(&lu->options, &lu->A_sup, &lu-> ScalePermstruct, 0, m, 0, &lu->grid,&lu->LUstruct , &lu->SOLVEstruct, berr, &stat, &sinfo);do { do {PetscErrorCode _7_ierr = PetscMallocValidate(380,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/aij/mpi/superlu_dist/superlu_dist.c" );do {if (__builtin_expect(!!(_7_ierr),0)) return PetscError( ((MPI_Comm)0x44000001),380,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/aij/mpi/superlu_dist/superlu_dist.c" ,_7_ierr,PETSC_ERROR_REPEAT," ");} while (0);} while(0); do { ; if (petscstack && petscstack->currentsize > 0 ) { petscstack->currentsize--; petscstack->function[petscstack ->currentsize] = 0; petscstack->file[petscstack->currentsize ] = 0; petscstack->line[petscstack->currentsize] = 0; petscstack ->petscroutine[petscstack->currentsize] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth = (((petscstack-> hotdepth-1)<(0)) ? (0) : (petscstack->hotdepth-1)); } ; } while (0); } while (0); } while(0); | |||
381 | #else | |||
382 | PetscStackCall("SuperLU_DIST:pdgssvx",pdgssvx(&lu->options, &lu->A_sup, &lu->ScalePermstruct, 0, m, 0, &lu->grid,&lu->LUstruct, &lu->SOLVEstruct, berr, &stat, &sinfo))do { do { do { ; if (petscstack && (petscstack->currentsize < 64)) { petscstack->function[petscstack->currentsize ] = "SuperLU_DIST:pdgssvx"; petscstack->file[petscstack-> currentsize] = "/sandbox/petsc/petsc.next/src/mat/impls/aij/mpi/superlu_dist/superlu_dist.c" ; petscstack->line[petscstack->currentsize] = 382; petscstack ->petscroutine[petscstack->currentsize] = PETSC_FALSE; petscstack ->currentsize++; } if (petscstack) { petscstack->hotdepth += (PETSC_FALSE || petscstack->hotdepth); } ; } while (0) ; do {PetscErrorCode _7_ierr = PetscMallocValidate(382,__func__ ,"/sandbox/petsc/petsc.next/src/mat/impls/aij/mpi/superlu_dist/superlu_dist.c" );do {if (__builtin_expect(!!(_7_ierr),0)) return PetscError( ((MPI_Comm)0x44000001),382,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/aij/mpi/superlu_dist/superlu_dist.c" ,_7_ierr,PETSC_ERROR_REPEAT," ");} while (0);} while(0); } while (0);pdgssvx(&lu->options, &lu->A_sup, &lu-> ScalePermstruct, 0, m, 0, &lu->grid,&lu->LUstruct , &lu->SOLVEstruct, berr, &stat, &sinfo);do { do {PetscErrorCode _7_ierr = PetscMallocValidate(382,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/aij/mpi/superlu_dist/superlu_dist.c" );do {if (__builtin_expect(!!(_7_ierr),0)) return PetscError( ((MPI_Comm)0x44000001),382,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/aij/mpi/superlu_dist/superlu_dist.c" ,_7_ierr,PETSC_ERROR_REPEAT," ");} while (0);} while(0); do { ; if (petscstack && petscstack->currentsize > 0 ) { petscstack->currentsize--; petscstack->function[petscstack ->currentsize] = 0; petscstack->file[petscstack->currentsize ] = 0; petscstack->line[petscstack->currentsize] = 0; petscstack ->petscroutine[petscstack->currentsize] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth = (((petscstack-> hotdepth-1)<(0)) ? (0) : (petscstack->hotdepth-1)); } ; } while (0); } while (0); } while(0); | |||
383 | #endif | |||
384 | ||||
385 | if (sinfo > 0) { | |||
386 | if (A->erroriffailure) { | |||
387 | SETERRQ1(PETSC_COMM_SELF,PETSC_ERR_MAT_LU_ZRPVT,"Zero pivot in row %D",sinfo)return PetscError(((MPI_Comm)0x44000001),387,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/aij/mpi/superlu_dist/superlu_dist.c" ,71,PETSC_ERROR_INITIAL,"Zero pivot in row %D",sinfo); | |||
388 | } else { | |||
389 | if (sinfo <= lu->A_sup.ncol) { | |||
390 | F->factorerrortype = MAT_FACTOR_NUMERIC_ZEROPIVOT; | |||
391 | ierr = PetscInfo1(F,"U(i,i) is exactly zero, i= %D\n",sinfo)PetscInfo_Private(__func__,F,"U(i,i) is exactly zero, i= %D\n" ,sinfo);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),391,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/aij/mpi/superlu_dist/superlu_dist.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
392 | } else if (sinfo > lu->A_sup.ncol) { | |||
393 | /* | |||
394 | number of bytes allocated when memory allocation | |||
395 | failure occurred, plus A->ncol. | |||
396 | */ | |||
397 | F->factorerrortype = MAT_FACTOR_OUTMEMORY; | |||
398 | ierr = PetscInfo1(F,"Number of bytes allocated when memory allocation fails %D\n",sinfo)PetscInfo_Private(__func__,F,"Number of bytes allocated when memory allocation fails %D\n" ,sinfo);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),398,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/aij/mpi/superlu_dist/superlu_dist.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
399 | } | |||
400 | } | |||
401 | } else if (sinfo < 0) { | |||
402 | SETERRQ1(PETSC_COMM_SELF,PETSC_ERR_LIB, "info = %D, argument in p*gssvx() had an illegal value", sinfo)return PetscError(((MPI_Comm)0x44000001),402,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/aij/mpi/superlu_dist/superlu_dist.c" ,76,PETSC_ERROR_INITIAL,"info = %D, argument in p*gssvx() had an illegal value" ,sinfo); | |||
403 | } | |||
404 | ||||
405 | if (lu->options.PrintStat) { | |||
406 | PStatPrint(&lu->options, &stat, &lu->grid); /* Print the statistics. */ | |||
407 | } | |||
408 | PetscStackCall("SuperLU_DIST:PStatFree",PStatFree(&stat))do { do { do { ; if (petscstack && (petscstack->currentsize < 64)) { petscstack->function[petscstack->currentsize ] = "SuperLU_DIST:PStatFree"; petscstack->file[petscstack-> currentsize] = "/sandbox/petsc/petsc.next/src/mat/impls/aij/mpi/superlu_dist/superlu_dist.c" ; petscstack->line[petscstack->currentsize] = 408; petscstack ->petscroutine[petscstack->currentsize] = PETSC_FALSE; petscstack ->currentsize++; } if (petscstack) { petscstack->hotdepth += (PETSC_FALSE || petscstack->hotdepth); } ; } while (0) ; do {PetscErrorCode _7_ierr = PetscMallocValidate(408,__func__ ,"/sandbox/petsc/petsc.next/src/mat/impls/aij/mpi/superlu_dist/superlu_dist.c" );do {if (__builtin_expect(!!(_7_ierr),0)) return PetscError( ((MPI_Comm)0x44000001),408,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/aij/mpi/superlu_dist/superlu_dist.c" ,_7_ierr,PETSC_ERROR_REPEAT," ");} while (0);} while(0); } while (0);PStatFree(&stat);do { do {PetscErrorCode _7_ierr = PetscMallocValidate (408,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/aij/mpi/superlu_dist/superlu_dist.c" );do {if (__builtin_expect(!!(_7_ierr),0)) return PetscError( ((MPI_Comm)0x44000001),408,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/aij/mpi/superlu_dist/superlu_dist.c" ,_7_ierr,PETSC_ERROR_REPEAT," ");} while (0);} while(0); do { ; if (petscstack && petscstack->currentsize > 0 ) { petscstack->currentsize--; petscstack->function[petscstack ->currentsize] = 0; petscstack->file[petscstack->currentsize ] = 0; petscstack->line[petscstack->currentsize] = 0; petscstack ->petscroutine[petscstack->currentsize] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth = (((petscstack-> hotdepth-1)<(0)) ? (0) : (petscstack->hotdepth-1)); } ; } while (0); } while (0); } while(0); | |||
409 | F->assembled = PETSC_TRUE; | |||
410 | F->preallocated = PETSC_TRUE; | |||
411 | lu->options.Fact = FACTORED; /* The factored form of A is supplied. Local option used by this func. only */ | |||
412 | PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize > 0) { petscstack->currentsize--; petscstack->function [petscstack->currentsize] = 0; petscstack->file[petscstack ->currentsize] = 0; petscstack->line[petscstack->currentsize ] = 0; petscstack->petscroutine[petscstack->currentsize ] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth = (((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack-> hotdepth-1)); } ; } while (0); return(0);} while (0); | |||
413 | } | |||
414 | ||||
415 | /* Note the Petsc r and c permutations are ignored */ | |||
416 | static PetscErrorCode MatLUFactorSymbolic_SuperLU_DIST(Mat F,Mat A,IS r,IS c,const MatFactorInfo *info) | |||
417 | { | |||
418 | Mat_SuperLU_DIST *lu = (Mat_SuperLU_DIST*)F->data; | |||
419 | PetscInt M = A->rmap->N,N=A->cmap->N; | |||
420 | ||||
421 | PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize < 64)) { petscstack->function[petscstack->currentsize ] = __func__; petscstack->file[petscstack->currentsize] = "/sandbox/petsc/petsc.next/src/mat/impls/aij/mpi/superlu_dist/superlu_dist.c" ; petscstack->line[petscstack->currentsize] = 421; petscstack ->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack ->currentsize++; } if (petscstack) { petscstack->hotdepth += (PETSC_FALSE || petscstack->hotdepth); } ; } while (0) ; ; } while (0); | |||
422 | /* Initialize the SuperLU process grid. */ | |||
423 | PetscStackCall("SuperLU_DIST:superlu_gridinit",superlu_gridinit(lu->comm_superlu, lu->nprow, lu->npcol, &lu->grid))do { do { do { ; if (petscstack && (petscstack->currentsize < 64)) { petscstack->function[petscstack->currentsize ] = "SuperLU_DIST:superlu_gridinit"; petscstack->file[petscstack ->currentsize] = "/sandbox/petsc/petsc.next/src/mat/impls/aij/mpi/superlu_dist/superlu_dist.c" ; petscstack->line[petscstack->currentsize] = 423; petscstack ->petscroutine[petscstack->currentsize] = PETSC_FALSE; petscstack ->currentsize++; } if (petscstack) { petscstack->hotdepth += (PETSC_FALSE || petscstack->hotdepth); } ; } while (0) ; do {PetscErrorCode _7_ierr = PetscMallocValidate(423,__func__ ,"/sandbox/petsc/petsc.next/src/mat/impls/aij/mpi/superlu_dist/superlu_dist.c" );do {if (__builtin_expect(!!(_7_ierr),0)) return PetscError( ((MPI_Comm)0x44000001),423,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/aij/mpi/superlu_dist/superlu_dist.c" ,_7_ierr,PETSC_ERROR_REPEAT," ");} while (0);} while(0); } while (0);superlu_gridinit(lu->comm_superlu, lu->nprow, lu-> npcol, &lu->grid);do { do {PetscErrorCode _7_ierr = PetscMallocValidate (423,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/aij/mpi/superlu_dist/superlu_dist.c" );do {if (__builtin_expect(!!(_7_ierr),0)) return PetscError( ((MPI_Comm)0x44000001),423,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/aij/mpi/superlu_dist/superlu_dist.c" ,_7_ierr,PETSC_ERROR_REPEAT," ");} while (0);} while(0); do { ; if (petscstack && petscstack->currentsize > 0 ) { petscstack->currentsize--; petscstack->function[petscstack ->currentsize] = 0; petscstack->file[petscstack->currentsize ] = 0; petscstack->line[petscstack->currentsize] = 0; petscstack ->petscroutine[petscstack->currentsize] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth = (((petscstack-> hotdepth-1)<(0)) ? (0) : (petscstack->hotdepth-1)); } ; } while (0); } while (0); } while(0); | |||
424 | ||||
425 | /* Initialize ScalePermstruct and LUstruct. */ | |||
426 | PetscStackCall("SuperLU_DIST:ScalePermstructInit",ScalePermstructInit(M, N, &lu->ScalePermstruct))do { do { do { ; if (petscstack && (petscstack->currentsize < 64)) { petscstack->function[petscstack->currentsize ] = "SuperLU_DIST:ScalePermstructInit"; petscstack->file[petscstack ->currentsize] = "/sandbox/petsc/petsc.next/src/mat/impls/aij/mpi/superlu_dist/superlu_dist.c" ; petscstack->line[petscstack->currentsize] = 426; petscstack ->petscroutine[petscstack->currentsize] = PETSC_FALSE; petscstack ->currentsize++; } if (petscstack) { petscstack->hotdepth += (PETSC_FALSE || petscstack->hotdepth); } ; } while (0) ; do {PetscErrorCode _7_ierr = PetscMallocValidate(426,__func__ ,"/sandbox/petsc/petsc.next/src/mat/impls/aij/mpi/superlu_dist/superlu_dist.c" );do {if (__builtin_expect(!!(_7_ierr),0)) return PetscError( ((MPI_Comm)0x44000001),426,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/aij/mpi/superlu_dist/superlu_dist.c" ,_7_ierr,PETSC_ERROR_REPEAT," ");} while (0);} while(0); } while (0);ScalePermstructInit(M, N, &lu->ScalePermstruct);do { do {PetscErrorCode _7_ierr = PetscMallocValidate(426,__func__ ,"/sandbox/petsc/petsc.next/src/mat/impls/aij/mpi/superlu_dist/superlu_dist.c" );do {if (__builtin_expect(!!(_7_ierr),0)) return PetscError( ((MPI_Comm)0x44000001),426,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/aij/mpi/superlu_dist/superlu_dist.c" ,_7_ierr,PETSC_ERROR_REPEAT," ");} while (0);} while(0); do { ; if (petscstack && petscstack->currentsize > 0 ) { petscstack->currentsize--; petscstack->function[petscstack ->currentsize] = 0; petscstack->file[petscstack->currentsize ] = 0; petscstack->line[petscstack->currentsize] = 0; petscstack ->petscroutine[petscstack->currentsize] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth = (((petscstack-> hotdepth-1)<(0)) ? (0) : (petscstack->hotdepth-1)); } ; } while (0); } while (0); } while(0); | |||
427 | PetscStackCall("SuperLU_DIST:LUstructInit",LUstructInit(N, &lu->LUstruct))do { do { do { ; if (petscstack && (petscstack->currentsize < 64)) { petscstack->function[petscstack->currentsize ] = "SuperLU_DIST:LUstructInit"; petscstack->file[petscstack ->currentsize] = "/sandbox/petsc/petsc.next/src/mat/impls/aij/mpi/superlu_dist/superlu_dist.c" ; petscstack->line[petscstack->currentsize] = 427; petscstack ->petscroutine[petscstack->currentsize] = PETSC_FALSE; petscstack ->currentsize++; } if (petscstack) { petscstack->hotdepth += (PETSC_FALSE || petscstack->hotdepth); } ; } while (0) ; do {PetscErrorCode _7_ierr = PetscMallocValidate(427,__func__ ,"/sandbox/petsc/petsc.next/src/mat/impls/aij/mpi/superlu_dist/superlu_dist.c" );do {if (__builtin_expect(!!(_7_ierr),0)) return PetscError( ((MPI_Comm)0x44000001),427,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/aij/mpi/superlu_dist/superlu_dist.c" ,_7_ierr,PETSC_ERROR_REPEAT," ");} while (0);} while(0); } while (0);LUstructInit(N, &lu->LUstruct);do { do {PetscErrorCode _7_ierr = PetscMallocValidate(427,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/aij/mpi/superlu_dist/superlu_dist.c" );do {if (__builtin_expect(!!(_7_ierr),0)) return PetscError( ((MPI_Comm)0x44000001),427,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/aij/mpi/superlu_dist/superlu_dist.c" ,_7_ierr,PETSC_ERROR_REPEAT," ");} while (0);} while(0); do { ; if (petscstack && petscstack->currentsize > 0 ) { petscstack->currentsize--; petscstack->function[petscstack ->currentsize] = 0; petscstack->file[petscstack->currentsize ] = 0; petscstack->line[petscstack->currentsize] = 0; petscstack ->petscroutine[petscstack->currentsize] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth = (((petscstack-> hotdepth-1)<(0)) ? (0) : (petscstack->hotdepth-1)); } ; } while (0); } while (0); } while(0); | |||
428 | F->ops->lufactornumeric = MatLUFactorNumeric_SuperLU_DIST; | |||
429 | F->ops->solve = MatSolve_SuperLU_DIST; | |||
430 | F->ops->matsolve = MatMatSolve_SuperLU_DIST; | |||
431 | F->ops->getinertia = NULL((void*)0); | |||
432 | ||||
433 | if (A->symmetric || A->hermitian) { | |||
434 | F->ops->getinertia = MatGetInertia_SuperLU_DIST; | |||
435 | } | |||
436 | lu->CleanUpSuperLU_Dist = PETSC_TRUE; | |||
437 | PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize > 0) { petscstack->currentsize--; petscstack->function [petscstack->currentsize] = 0; petscstack->file[petscstack ->currentsize] = 0; petscstack->line[petscstack->currentsize ] = 0; petscstack->petscroutine[petscstack->currentsize ] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth = (((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack-> hotdepth-1)); } ; } while (0); return(0);} while (0); | |||
438 | } | |||
439 | ||||
440 | static PetscErrorCode MatCholeskyFactorSymbolic_SuperLU_DIST(Mat F,Mat A,IS r,const MatFactorInfo *info) | |||
441 | { | |||
442 | PetscErrorCode ierr; | |||
443 | ||||
444 | PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize < 64)) { petscstack->function[petscstack->currentsize ] = __func__; petscstack->file[petscstack->currentsize] = "/sandbox/petsc/petsc.next/src/mat/impls/aij/mpi/superlu_dist/superlu_dist.c" ; petscstack->line[petscstack->currentsize] = 444; petscstack ->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack ->currentsize++; } if (petscstack) { petscstack->hotdepth += (PETSC_FALSE || petscstack->hotdepth); } ; } while (0) ; ; } while (0); | |||
445 | if (!A->symmetric) SETERRQ(PetscObjectComm((PetscObject)A),PETSC_ERR_ARG_WRONG,"Input matrix must be symmetric\n")return PetscError(PetscObjectComm((PetscObject)A),445,__func__ ,"/sandbox/petsc/petsc.next/src/mat/impls/aij/mpi/superlu_dist/superlu_dist.c" ,62,PETSC_ERROR_INITIAL,"Input matrix must be symmetric\n"); | |||
446 | ierr = MatLUFactorSymbolic_SuperLU_DIST(F,A,r,r,info);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),446,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/aij/mpi/superlu_dist/superlu_dist.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
447 | F->ops->choleskyfactornumeric = MatLUFactorNumeric_SuperLU_DIST; | |||
448 | PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize > 0) { petscstack->currentsize--; petscstack->function [petscstack->currentsize] = 0; petscstack->file[petscstack ->currentsize] = 0; petscstack->line[petscstack->currentsize ] = 0; petscstack->petscroutine[petscstack->currentsize ] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth = (((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack-> hotdepth-1)); } ; } while (0); return(0);} while (0); | |||
449 | } | |||
450 | ||||
451 | static PetscErrorCode MatFactorGetSolverType_aij_superlu_dist(Mat A,MatSolverType *type) | |||
452 | { | |||
453 | PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize < 64)) { petscstack->function[petscstack->currentsize ] = __func__; petscstack->file[petscstack->currentsize] = "/sandbox/petsc/petsc.next/src/mat/impls/aij/mpi/superlu_dist/superlu_dist.c" ; petscstack->line[petscstack->currentsize] = 453; petscstack ->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack ->currentsize++; } if (petscstack) { petscstack->hotdepth += (PETSC_FALSE || petscstack->hotdepth); } ; } while (0) ; ; } while (0); | |||
454 | *type = MATSOLVERSUPERLU_DIST"superlu_dist"; | |||
455 | PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize > 0) { petscstack->currentsize--; petscstack->function [petscstack->currentsize] = 0; petscstack->file[petscstack ->currentsize] = 0; petscstack->line[petscstack->currentsize ] = 0; petscstack->petscroutine[petscstack->currentsize ] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth = (((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack-> hotdepth-1)); } ; } while (0); return(0);} while (0); | |||
456 | } | |||
457 | ||||
458 | static PetscErrorCode MatView_Info_SuperLU_DIST(Mat A,PetscViewer viewer) | |||
459 | { | |||
460 | Mat_SuperLU_DIST *lu=(Mat_SuperLU_DIST*)A->data; | |||
461 | superlu_dist_options_t options; | |||
462 | PetscErrorCode ierr; | |||
463 | ||||
464 | PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize < 64)) { petscstack->function[petscstack->currentsize ] = __func__; petscstack->file[petscstack->currentsize] = "/sandbox/petsc/petsc.next/src/mat/impls/aij/mpi/superlu_dist/superlu_dist.c" ; petscstack->line[petscstack->currentsize] = 464; petscstack ->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack ->currentsize++; } if (petscstack) { petscstack->hotdepth += (PETSC_FALSE || petscstack->hotdepth); } ; } while (0) ; ; } while (0); | |||
465 | /* check if matrix is superlu_dist type */ | |||
466 | if (A->ops->solve != MatSolve_SuperLU_DIST) PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize > 0) { petscstack->currentsize--; petscstack->function [petscstack->currentsize] = 0; petscstack->file[petscstack ->currentsize] = 0; petscstack->line[petscstack->currentsize ] = 0; petscstack->petscroutine[petscstack->currentsize ] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth = (((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack-> hotdepth-1)); } ; } while (0); return(0);} while (0); | |||
467 | ||||
468 | options = lu->options; | |||
469 | ierr = PetscViewerASCIIPrintf(viewer,"SuperLU_DIST run parameters:\n");CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),469,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/aij/mpi/superlu_dist/superlu_dist.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
470 | ierr = PetscViewerASCIIPrintf(viewer," Process grid nprow %D x npcol %D \n",lu->nprow,lu->npcol);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),470,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/aij/mpi/superlu_dist/superlu_dist.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
471 | ierr = PetscViewerASCIIPrintf(viewer," Equilibrate matrix %s \n",PetscBools[options.Equil != NO]);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),471,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/aij/mpi/superlu_dist/superlu_dist.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
472 | ierr = PetscViewerASCIIPrintf(viewer," Replace tiny pivots %s \n",PetscBools[options.ReplaceTinyPivot != NO]);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),472,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/aij/mpi/superlu_dist/superlu_dist.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
473 | ierr = PetscViewerASCIIPrintf(viewer," Use iterative refinement %s \n",PetscBools[options.IterRefine == SLU_DOUBLE]);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),473,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/aij/mpi/superlu_dist/superlu_dist.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
474 | ierr = PetscViewerASCIIPrintf(viewer," Processors in row %d col partition %d \n",lu->nprow,lu->npcol);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),474,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/aij/mpi/superlu_dist/superlu_dist.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
475 | ||||
476 | switch (options.RowPerm) { | |||
477 | case NOROWPERM: | |||
478 | ierr = PetscViewerASCIIPrintf(viewer," Row permutation NOROWPERM\n");CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),478,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/aij/mpi/superlu_dist/superlu_dist.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
479 | break; | |||
480 | case LargeDiag_MC64: | |||
481 | ierr = PetscViewerASCIIPrintf(viewer," Row permutation LargeDiag_MC64\n");CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),481,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/aij/mpi/superlu_dist/superlu_dist.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
482 | break; | |||
483 | case LargeDiag_AWPM: | |||
484 | ierr = PetscViewerASCIIPrintf(viewer," Row permutation LargeDiag_AWPM\n");CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),484,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/aij/mpi/superlu_dist/superlu_dist.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
485 | break; | |||
486 | case MY_PERMR: | |||
487 | ierr = PetscViewerASCIIPrintf(viewer," Row permutation MY_PERMR\n");CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),487,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/aij/mpi/superlu_dist/superlu_dist.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
488 | break; | |||
489 | default: | |||
490 | SETERRQ(PETSC_COMM_SELF,PETSC_ERR_ARG_WRONG,"Unknown column permutation")return PetscError(((MPI_Comm)0x44000001),490,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/aij/mpi/superlu_dist/superlu_dist.c" ,62,PETSC_ERROR_INITIAL,"Unknown column permutation"); | |||
491 | } | |||
492 | ||||
493 | switch (options.ColPerm) { | |||
494 | case NATURAL: | |||
495 | ierr = PetscViewerASCIIPrintf(viewer," Column permutation NATURAL\n");CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),495,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/aij/mpi/superlu_dist/superlu_dist.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
496 | break; | |||
497 | case MMD_AT_PLUS_A: | |||
498 | ierr = PetscViewerASCIIPrintf(viewer," Column permutation MMD_AT_PLUS_A\n");CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),498,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/aij/mpi/superlu_dist/superlu_dist.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
499 | break; | |||
500 | case MMD_ATA: | |||
501 | ierr = PetscViewerASCIIPrintf(viewer," Column permutation MMD_ATA\n");CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),501,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/aij/mpi/superlu_dist/superlu_dist.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
502 | break; | |||
503 | /* Even though this is called METIS, the SuperLU_DIST code sets this by default if PARMETIS is defined, not METIS */ | |||
504 | case METIS_AT_PLUS_A: | |||
505 | ierr = PetscViewerASCIIPrintf(viewer," Column permutation METIS_AT_PLUS_A\n");CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),505,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/aij/mpi/superlu_dist/superlu_dist.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
506 | break; | |||
507 | case PARMETIS: | |||
508 | ierr = PetscViewerASCIIPrintf(viewer," Column permutation PARMETIS\n");CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),508,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/aij/mpi/superlu_dist/superlu_dist.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
509 | break; | |||
510 | default: | |||
511 | SETERRQ(PETSC_COMM_SELF,PETSC_ERR_ARG_WRONG,"Unknown column permutation")return PetscError(((MPI_Comm)0x44000001),511,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/aij/mpi/superlu_dist/superlu_dist.c" ,62,PETSC_ERROR_INITIAL,"Unknown column permutation"); | |||
512 | } | |||
513 | ||||
514 | ierr = PetscViewerASCIIPrintf(viewer," Parallel symbolic factorization %s \n",PetscBools[options.ParSymbFact != NO]);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),514,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/aij/mpi/superlu_dist/superlu_dist.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
515 | ||||
516 | if (lu->FactPattern == SamePattern) { | |||
517 | ierr = PetscViewerASCIIPrintf(viewer," Repeated factorization SamePattern\n");CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),517,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/aij/mpi/superlu_dist/superlu_dist.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
518 | } else if (lu->FactPattern == SamePattern_SameRowPerm) { | |||
519 | ierr = PetscViewerASCIIPrintf(viewer," Repeated factorization SamePattern_SameRowPerm\n");CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),519,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/aij/mpi/superlu_dist/superlu_dist.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
520 | } else if (lu->FactPattern == DOFACT) { | |||
521 | ierr = PetscViewerASCIIPrintf(viewer," Repeated factorization DOFACT\n");CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),521,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/aij/mpi/superlu_dist/superlu_dist.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
522 | } else { | |||
523 | SETERRQ(PETSC_COMM_SELF,PETSC_ERR_ARG_WRONG,"Unknown factorization pattern")return PetscError(((MPI_Comm)0x44000001),523,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/aij/mpi/superlu_dist/superlu_dist.c" ,62,PETSC_ERROR_INITIAL,"Unknown factorization pattern"); | |||
524 | } | |||
525 | PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize > 0) { petscstack->currentsize--; petscstack->function [petscstack->currentsize] = 0; petscstack->file[petscstack ->currentsize] = 0; petscstack->line[petscstack->currentsize ] = 0; petscstack->petscroutine[petscstack->currentsize ] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth = (((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack-> hotdepth-1)); } ; } while (0); return(0);} while (0); | |||
526 | } | |||
527 | ||||
528 | static PetscErrorCode MatView_SuperLU_DIST(Mat A,PetscViewer viewer) | |||
529 | { | |||
530 | PetscErrorCode ierr; | |||
531 | PetscBool iascii; | |||
532 | PetscViewerFormat format; | |||
533 | ||||
534 | PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize < 64)) { petscstack->function[petscstack->currentsize ] = __func__; petscstack->file[petscstack->currentsize] = "/sandbox/petsc/petsc.next/src/mat/impls/aij/mpi/superlu_dist/superlu_dist.c" ; petscstack->line[petscstack->currentsize] = 534; petscstack ->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack ->currentsize++; } if (petscstack) { petscstack->hotdepth += (PETSC_FALSE || petscstack->hotdepth); } ; } while (0) ; ; } while (0); | |||
535 | ierr = PetscObjectTypeCompare((PetscObject)viewer,PETSCVIEWERASCII"ascii",&iascii);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),535,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/aij/mpi/superlu_dist/superlu_dist.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
536 | if (iascii) { | |||
537 | ierr = PetscViewerGetFormat(viewer,&format);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),537,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/aij/mpi/superlu_dist/superlu_dist.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
538 | if (format == PETSC_VIEWER_ASCII_INFO) { | |||
539 | ierr = MatView_Info_SuperLU_DIST(A,viewer);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),539,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/aij/mpi/superlu_dist/superlu_dist.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
540 | } | |||
541 | } | |||
542 | PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize > 0) { petscstack->currentsize--; petscstack->function [petscstack->currentsize] = 0; petscstack->file[petscstack ->currentsize] = 0; petscstack->line[petscstack->currentsize ] = 0; petscstack->petscroutine[petscstack->currentsize ] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth = (((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack-> hotdepth-1)); } ; } while (0); return(0);} while (0); | |||
543 | } | |||
544 | ||||
545 | static PetscErrorCode MatGetFactor_aij_superlu_dist(Mat A,MatFactorType ftype,Mat *F) | |||
546 | { | |||
547 | Mat B; | |||
548 | Mat_SuperLU_DIST *lu; | |||
549 | PetscErrorCode ierr; | |||
550 | PetscInt M=A->rmap->N,N=A->cmap->N,indx; | |||
551 | PetscMPIInt size; | |||
552 | superlu_dist_options_t options; | |||
553 | PetscBool flg; | |||
554 | const char *colperm[] = {"NATURAL","MMD_AT_PLUS_A","MMD_ATA","METIS_AT_PLUS_A","PARMETIS"}; | |||
555 | const char *rowperm[] = {"NOROWPERM","LargeDiag_MC64","LargeDiag_AWPM","MY_PERMR"}; | |||
556 | const char *factPattern[] = {"SamePattern","SamePattern_SameRowPerm","DOFACT"}; | |||
557 | PetscBool set; | |||
558 | ||||
559 | PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize < 64)) { petscstack->function[petscstack->currentsize ] = __func__; petscstack->file[petscstack->currentsize] = "/sandbox/petsc/petsc.next/src/mat/impls/aij/mpi/superlu_dist/superlu_dist.c" ; petscstack->line[petscstack->currentsize] = 559; petscstack ->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack ->currentsize++; } if (petscstack) { petscstack->hotdepth += (PETSC_FALSE || petscstack->hotdepth); } ; } while (0) ; ; } while (0); | |||
560 | /* Create the factorization matrix */ | |||
561 | ierr = MatCreate(PetscObjectComm((PetscObject)A),&B);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),561,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/aij/mpi/superlu_dist/superlu_dist.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
562 | ierr = MatSetSizes(B,A->rmap->n,A->cmap->n,M,N);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),562,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/aij/mpi/superlu_dist/superlu_dist.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
563 | ierr = PetscStrallocpy("superlu_dist",&((PetscObject)B)->type_name);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),563,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/aij/mpi/superlu_dist/superlu_dist.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
564 | ierr = MatSetUp(B);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),564,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/aij/mpi/superlu_dist/superlu_dist.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
565 | B->ops->getinfo = MatGetInfo_External; | |||
566 | B->ops->view = MatView_SuperLU_DIST; | |||
567 | B->ops->destroy = MatDestroy_SuperLU_DIST; | |||
568 | ||||
569 | if (ftype == MAT_FACTOR_LU) { | |||
570 | B->factortype = MAT_FACTOR_LU; | |||
571 | B->ops->lufactorsymbolic = MatLUFactorSymbolic_SuperLU_DIST; | |||
572 | } else { | |||
573 | B->factortype = MAT_FACTOR_CHOLESKY; | |||
574 | B->ops->choleskyfactorsymbolic = MatCholeskyFactorSymbolic_SuperLU_DIST; | |||
575 | } | |||
576 | ||||
577 | /* set solvertype */ | |||
578 | ierr = PetscFree(B->solvertype)((*PetscTrFree)((void*)(B->solvertype),578,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/aij/mpi/superlu_dist/superlu_dist.c" ) || ((B->solvertype) = 0,0));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),578,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/aij/mpi/superlu_dist/superlu_dist.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
579 | ierr = PetscStrallocpy(MATSOLVERSUPERLU_DIST"superlu_dist",&B->solvertype);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),579,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/aij/mpi/superlu_dist/superlu_dist.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
580 | ||||
581 | ierr = PetscNewLog(B,&lu)(PetscMallocA(1,PETSC_TRUE,581,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/aij/mpi/superlu_dist/superlu_dist.c" ,(size_t)(1)*sizeof(**(((&lu)))),(((&lu)))) || PetscLogObjectMemory ((PetscObject)B,sizeof(**(&lu))));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),581,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/aij/mpi/superlu_dist/superlu_dist.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
582 | B->data = lu; | |||
583 | ||||
584 | /* Set the default input options: | |||
585 | options.Fact = DOFACT; | |||
586 | options.Equil = YES; | |||
587 | options.ParSymbFact = NO; | |||
588 | options.ColPerm = METIS_AT_PLUS_A; | |||
589 | options.RowPerm = LargeDiag_MC64; | |||
590 | options.ReplaceTinyPivot = YES; | |||
591 | options.IterRefine = DOUBLE; | |||
592 | options.Trans = NOTRANS; | |||
593 | options.SolveInitialized = NO; -hold the communication pattern used MatSolve() and MatMatSolve() | |||
594 | options.RefineInitialized = NO; | |||
595 | options.PrintStat = YES; | |||
596 | */ | |||
597 | set_default_options_dist(&options); | |||
598 | ||||
599 | ierr = MPI_Comm_dup(PetscObjectComm((PetscObject)A),&(lu->comm_superlu));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),599,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/aij/mpi/superlu_dist/superlu_dist.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
600 | ierr = MPI_Comm_size(PetscObjectComm((PetscObject)A),&size);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),600,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/aij/mpi/superlu_dist/superlu_dist.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
601 | /* Default num of process columns and rows */ | |||
602 | lu->nprow = (int_t) (0.5 + PetscSqrtReal((PetscReal)size)sqrt((PetscReal)size)); | |||
603 | if (!lu->nprow) lu->nprow = 1; | |||
604 | while (lu->nprow > 0) { | |||
605 | lu->npcol = (int_t) (size/lu->nprow); | |||
606 | if (size == lu->nprow * lu->npcol) break; | |||
607 | lu->nprow--; | |||
608 | } | |||
609 | ||||
610 | ierr = PetscOptionsBegin(PetscObjectComm((PetscObject)A),((PetscObject)A)->prefix,"SuperLU_Dist Options","Mat")0; do { PetscOptionItems PetscOptionsObjectBase; PetscOptionItems *PetscOptionsObject = &PetscOptionsObjectBase; PetscMemzero (PetscOptionsObject,sizeof(PetscOptionItems)); for (PetscOptionsObject ->count=(PetscOptionsPublish?-1:1); PetscOptionsObject-> count<2; PetscOptionsObject->count++) { PetscErrorCode _5_ierr = PetscOptionsBegin_Private(PetscOptionsObject,PetscObjectComm ((PetscObject)A),((PetscObject)A)->prefix,"SuperLU_Dist Options" ,"Mat");do {if (__builtin_expect(!!(_5_ierr),0)) return PetscError (((MPI_Comm)0x44000001),610,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/aij/mpi/superlu_dist/superlu_dist.c" ,_5_ierr,PETSC_ERROR_REPEAT," ");} while (0);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),610,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/aij/mpi/superlu_dist/superlu_dist.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
611 | ierr = PetscOptionsInt("-mat_superlu_dist_r","Number rows in processor partition","None",lu->nprow,(PetscInt*)&lu->nprow,NULL)PetscOptionsInt_Private(PetscOptionsObject,"-mat_superlu_dist_r" ,"Number rows in processor partition","None",lu->nprow,(PetscInt *)&lu->nprow,((void*)0),(-2147483647 - 1),2147483647);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),611,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/aij/mpi/superlu_dist/superlu_dist.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
612 | ierr = PetscOptionsInt("-mat_superlu_dist_c","Number columns in processor partition","None",lu->npcol,(PetscInt*)&lu->npcol,NULL)PetscOptionsInt_Private(PetscOptionsObject,"-mat_superlu_dist_c" ,"Number columns in processor partition","None",lu->npcol, (PetscInt*)&lu->npcol,((void*)0),(-2147483647 - 1),2147483647 );CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),612,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/aij/mpi/superlu_dist/superlu_dist.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
613 | if (size != lu->nprow * lu->npcol) SETERRQ3(PETSC_COMM_SELF,PETSC_ERR_ARG_SIZ,"Number of processes %d must equal to nprow %d * npcol %d",size,lu->nprow,lu->npcol)return PetscError(((MPI_Comm)0x44000001),613,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/aij/mpi/superlu_dist/superlu_dist.c" ,60,PETSC_ERROR_INITIAL,"Number of processes %d must equal to nprow %d * npcol %d" ,size,lu->nprow,lu->npcol); | |||
614 | ||||
615 | ierr = PetscOptionsBool("-mat_superlu_dist_equil","Equilibrate matrix","None",options.Equil ? PETSC_TRUE : PETSC_FALSE,&flg,&set)PetscOptionsBool_Private(PetscOptionsObject,"-mat_superlu_dist_equil" ,"Equilibrate matrix","None",options.Equil ? PETSC_TRUE : PETSC_FALSE ,&flg,&set);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),615,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/aij/mpi/superlu_dist/superlu_dist.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
616 | if (set && !flg) options.Equil = NO; | |||
617 | ||||
618 | ierr = PetscOptionsEList("-mat_superlu_dist_rowperm","Row permutation","None",rowperm,4,rowperm[1],&indx,&flg)PetscOptionsEList_Private(PetscOptionsObject,"-mat_superlu_dist_rowperm" ,"Row permutation","None",rowperm,4,rowperm[1],&indx,& flg);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),618,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/aij/mpi/superlu_dist/superlu_dist.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
619 | if (flg) { | |||
620 | switch (indx) { | |||
621 | case 0: | |||
622 | options.RowPerm = NOROWPERM; | |||
623 | break; | |||
624 | case 1: | |||
625 | options.RowPerm = LargeDiag_MC64; | |||
626 | break; | |||
627 | case 2: | |||
628 | options.RowPerm = LargeDiag_AWPM; | |||
629 | break; | |||
630 | case 3: | |||
631 | options.RowPerm = MY_PERMR; | |||
632 | break; | |||
633 | default: | |||
634 | SETERRQ(PETSC_COMM_SELF,PETSC_ERR_ARG_WRONG,"Unknown row permutation")return PetscError(((MPI_Comm)0x44000001),634,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/aij/mpi/superlu_dist/superlu_dist.c" ,62,PETSC_ERROR_INITIAL,"Unknown row permutation"); | |||
635 | } | |||
636 | } | |||
637 | ||||
638 | ierr = PetscOptionsEList("-mat_superlu_dist_colperm","Column permutation","None",colperm,5,colperm[3],&indx,&flg)PetscOptionsEList_Private(PetscOptionsObject,"-mat_superlu_dist_colperm" ,"Column permutation","None",colperm,5,colperm[3],&indx,& flg);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),638,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/aij/mpi/superlu_dist/superlu_dist.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
639 | if (flg) { | |||
640 | switch (indx) { | |||
641 | case 0: | |||
642 | options.ColPerm = NATURAL; | |||
643 | break; | |||
644 | case 1: | |||
645 | options.ColPerm = MMD_AT_PLUS_A; | |||
646 | break; | |||
647 | case 2: | |||
648 | options.ColPerm = MMD_ATA; | |||
649 | break; | |||
650 | case 3: | |||
651 | options.ColPerm = METIS_AT_PLUS_A; | |||
652 | break; | |||
653 | case 4: | |||
654 | options.ColPerm = PARMETIS; /* only works for np>1 */ | |||
655 | break; | |||
656 | default: | |||
657 | SETERRQ(PETSC_COMM_SELF,PETSC_ERR_ARG_WRONG,"Unknown column permutation")return PetscError(((MPI_Comm)0x44000001),657,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/aij/mpi/superlu_dist/superlu_dist.c" ,62,PETSC_ERROR_INITIAL,"Unknown column permutation"); | |||
658 | } | |||
659 | } | |||
660 | ||||
661 | options.ReplaceTinyPivot = NO; | |||
662 | ierr = PetscOptionsBool("-mat_superlu_dist_replacetinypivot","Replace tiny pivots","None",options.ReplaceTinyPivot ? PETSC_TRUE : PETSC_FALSE,&flg,&set)PetscOptionsBool_Private(PetscOptionsObject,"-mat_superlu_dist_replacetinypivot" ,"Replace tiny pivots","None",options.ReplaceTinyPivot ? PETSC_TRUE : PETSC_FALSE,&flg,&set);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),662,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/aij/mpi/superlu_dist/superlu_dist.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
663 | if (set && flg) options.ReplaceTinyPivot = YES; | |||
664 | ||||
665 | options.ParSymbFact = NO; | |||
666 | ierr = PetscOptionsBool("-mat_superlu_dist_parsymbfact","Parallel symbolic factorization","None",PETSC_FALSE,&flg,&set)PetscOptionsBool_Private(PetscOptionsObject,"-mat_superlu_dist_parsymbfact" ,"Parallel symbolic factorization","None",PETSC_FALSE,&flg ,&set);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),666,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/aij/mpi/superlu_dist/superlu_dist.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
667 | if (set && flg && size>1) { | |||
668 | #if defined(PETSC_HAVE_PARMETIS1) | |||
669 | options.ParSymbFact = YES; | |||
670 | options.ColPerm = PARMETIS; /* in v2.2, PARMETIS is forced for ParSymbFact regardless of user ordering setting */ | |||
671 | #else | |||
672 | SETERRQ(PETSC_COMM_SELF,PETSC_ERR_SUP,"parsymbfact needs PARMETIS")return PetscError(((MPI_Comm)0x44000001),672,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/aij/mpi/superlu_dist/superlu_dist.c" ,56,PETSC_ERROR_INITIAL,"parsymbfact needs PARMETIS"); | |||
673 | #endif | |||
674 | } | |||
675 | ||||
676 | lu->FactPattern = SamePattern; | |||
677 | ierr = PetscOptionsEList("-mat_superlu_dist_fact","Sparsity pattern for repeated matrix factorization","None",factPattern,3,factPattern[0],&indx,&flg)PetscOptionsEList_Private(PetscOptionsObject,"-mat_superlu_dist_fact" ,"Sparsity pattern for repeated matrix factorization","None", factPattern,3,factPattern[0],&indx,&flg);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),677,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/aij/mpi/superlu_dist/superlu_dist.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
678 | if (flg) { | |||
679 | switch (indx) { | |||
680 | case 0: | |||
681 | lu->FactPattern = SamePattern; | |||
682 | break; | |||
683 | case 1: | |||
684 | lu->FactPattern = SamePattern_SameRowPerm; | |||
685 | break; | |||
686 | case 2: | |||
687 | lu->FactPattern = DOFACT; | |||
688 | break; | |||
689 | } | |||
690 | } | |||
691 | ||||
692 | options.IterRefine = NOREFINE; | |||
693 | ierr = PetscOptionsBool("-mat_superlu_dist_iterrefine","Use iterative refinement","None",options.IterRefine == NOREFINE ? PETSC_FALSE : PETSC_TRUE ,&flg,&set)PetscOptionsBool_Private(PetscOptionsObject,"-mat_superlu_dist_iterrefine" ,"Use iterative refinement","None",options.IterRefine == NOREFINE ? PETSC_FALSE : PETSC_TRUE,&flg,&set);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),693,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/aij/mpi/superlu_dist/superlu_dist.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
694 | if (set) { | |||
695 | if (flg) options.IterRefine = SLU_DOUBLE; | |||
696 | else options.IterRefine = NOREFINE; | |||
697 | } | |||
698 | ||||
699 | if (PetscLogPrintInfo) options.PrintStat = YES; | |||
700 | else options.PrintStat = NO; | |||
701 | ierr = PetscOptionsBool("-mat_superlu_dist_statprint","Print factorization information","None",(PetscBool)options.PrintStat,(PetscBool*)&options.PrintStat,NULL)PetscOptionsBool_Private(PetscOptionsObject,"-mat_superlu_dist_statprint" ,"Print factorization information","None",(PetscBool)options. PrintStat,(PetscBool*)&options.PrintStat,((void*)0));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),701,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/aij/mpi/superlu_dist/superlu_dist.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
702 | ierr = PetscOptionsEnd()_5_ierr = PetscOptionsEnd_Private(PetscOptionsObject);do {if ( __builtin_expect(!!(_5_ierr),0)) return PetscError(((MPI_Comm )0x44000001),702,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/aij/mpi/superlu_dist/superlu_dist.c" ,_5_ierr,PETSC_ERROR_REPEAT," ");} while (0);}} while (0);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),702,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/aij/mpi/superlu_dist/superlu_dist.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
703 | ||||
704 | lu->options = options; | |||
705 | lu->options.Fact = DOFACT; | |||
706 | lu->matsolve_iscalled = PETSC_FALSE; | |||
707 | lu->matmatsolve_iscalled = PETSC_FALSE; | |||
708 | ||||
709 | ierr = PetscObjectComposeFunction((PetscObject)B,"MatFactorGetSolverType_C",MatFactorGetSolverType_aij_superlu_dist)PetscObjectComposeFunction_Private((PetscObject)B,"MatFactorGetSolverType_C" ,(PetscVoidFunction)(MatFactorGetSolverType_aij_superlu_dist) );CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),709,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/aij/mpi/superlu_dist/superlu_dist.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
710 | ierr = PetscObjectComposeFunction((PetscObject)B,"MatSuperluDistGetDiagU_C",MatSuperluDistGetDiagU_SuperLU_DIST)PetscObjectComposeFunction_Private((PetscObject)B,"MatSuperluDistGetDiagU_C" ,(PetscVoidFunction)(MatSuperluDistGetDiagU_SuperLU_DIST));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),710,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/aij/mpi/superlu_dist/superlu_dist.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
711 | ||||
712 | *F = B; | |||
713 | PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize > 0) { petscstack->currentsize--; petscstack->function [petscstack->currentsize] = 0; petscstack->file[petscstack ->currentsize] = 0; petscstack->line[petscstack->currentsize ] = 0; petscstack->petscroutine[petscstack->currentsize ] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth = (((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack-> hotdepth-1)); } ; } while (0); return(0);} while (0); | |||
714 | } | |||
715 | ||||
716 | PETSC_EXTERNextern __attribute__((visibility ("default"))) PetscErrorCode MatSolverTypeRegister_SuperLU_DIST(void) | |||
717 | { | |||
718 | PetscErrorCode ierr; | |||
719 | PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize < 64)) { petscstack->function[petscstack->currentsize ] = __func__; petscstack->file[petscstack->currentsize] = "/sandbox/petsc/petsc.next/src/mat/impls/aij/mpi/superlu_dist/superlu_dist.c" ; petscstack->line[petscstack->currentsize] = 719; petscstack ->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack ->currentsize++; } if (petscstack) { petscstack->hotdepth += (PETSC_FALSE || petscstack->hotdepth); } ; } while (0) ; ; } while (0); | |||
720 | ierr = MatSolverTypeRegister(MATSOLVERSUPERLU_DIST"superlu_dist",MATMPIAIJ"mpiaij", MAT_FACTOR_LU,MatGetFactor_aij_superlu_dist);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),720,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/aij/mpi/superlu_dist/superlu_dist.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
721 | ierr = MatSolverTypeRegister(MATSOLVERSUPERLU_DIST"superlu_dist",MATSEQAIJ"seqaij", MAT_FACTOR_LU,MatGetFactor_aij_superlu_dist);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),721,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/aij/mpi/superlu_dist/superlu_dist.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
722 | ierr = MatSolverTypeRegister(MATSOLVERSUPERLU_DIST"superlu_dist",MATMPIAIJ"mpiaij", MAT_FACTOR_CHOLESKY,MatGetFactor_aij_superlu_dist);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),722,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/aij/mpi/superlu_dist/superlu_dist.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
723 | ierr = MatSolverTypeRegister(MATSOLVERSUPERLU_DIST"superlu_dist",MATSEQAIJ"seqaij", MAT_FACTOR_CHOLESKY,MatGetFactor_aij_superlu_dist);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),723,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/aij/mpi/superlu_dist/superlu_dist.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
724 | PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize > 0) { petscstack->currentsize--; petscstack->function [petscstack->currentsize] = 0; petscstack->file[petscstack ->currentsize] = 0; petscstack->line[petscstack->currentsize ] = 0; petscstack->petscroutine[petscstack->currentsize ] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth = (((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack-> hotdepth-1)); } ; } while (0); return(0);} while (0); | |||
725 | } | |||
726 | ||||
727 | /*MC | |||
728 | MATSOLVERSUPERLU_DIST - Parallel direct solver package for LU factorization | |||
729 | ||||
730 | Use ./configure --download-superlu_dist --download-parmetis --download-metis --download-ptscotch to have PETSc installed with SuperLU_DIST | |||
731 | ||||
732 | Use -pc_type lu -pc_factor_mat_solver_type superlu_dist to use this direct solver | |||
733 | ||||
734 | Works with AIJ matrices | |||
735 | ||||
736 | Options Database Keys: | |||
737 | + -mat_superlu_dist_r <n> - number of rows in processor partition | |||
738 | . -mat_superlu_dist_c <n> - number of columns in processor partition | |||
739 | . -mat_superlu_dist_equil - equilibrate the matrix | |||
740 | . -mat_superlu_dist_rowperm <NOROWPERM,LargeDiag_MC64,LargeDiag_AWPM,MY_PERMR> - row permutation | |||
741 | . -mat_superlu_dist_colperm <MMD_AT_PLUS_A,MMD_ATA,NATURAL> - column permutation | |||
742 | . -mat_superlu_dist_replacetinypivot - replace tiny pivots | |||
743 | . -mat_superlu_dist_fact <SamePattern> - (choose one of) SamePattern SamePattern_SameRowPerm DOFACT | |||
744 | . -mat_superlu_dist_iterrefine - use iterative refinement | |||
745 | - -mat_superlu_dist_statprint - print factorization information | |||
746 | ||||
747 | Level: beginner | |||
748 | ||||
749 | .seealso: PCLU | |||
750 | ||||
751 | .seealso: PCFactorSetMatSolverType(), MatSolverType | |||
752 | ||||
753 | M*/ |