Loading src/LinearSolverTypes.f90 +3 −0 Original line number Diff line number Diff line Loading @@ -607,6 +607,7 @@ SUBROUTINE init_LinearSolverType_Base(solver,Params,A) !set preconditioner IF((solver%solverMethod == GMRES) .OR. (solver%solverMethod == BICGSTAB)) THEN CALL KSPGetPC(solver%ksp,solver%pc,iperr) #if 0 IF(TRIM(PreCondType)=='SOR') THEN CALL PCSetType(solver%pc,PCSOR,iperr) ELSEIF(TRIM(PreCondType)=='JACOBI') THEN Loading Loading @@ -640,6 +641,8 @@ SUBROUTINE init_LinearSolverType_Base(solver,Params,A) ELSE ! Regardless of what else is set, we'll use block-jacobi ILU CALL PCSetType(solver%pc,PCBJACOBI,iperr) ENDIF #endif CALL PCSetType(solver%pc,PCJACOBI,iperr) ENDIF CALL KSPSetFromOptions(solver%ksp,iperr) Loading src/MatrixTypes.f90 +8 −18 Original line number Diff line number Diff line Loading @@ -111,7 +111,7 @@ PUBLIC :: BandedMatrixType PUBLIC :: DistributedBandedMatrixType PUBLIC :: DistributedBlockBandedMatrixType PUBLIC :: SparseMatrixType INTEGER(SIK),PARAMETER,PUBLIC :: MATVEC_SLOTS=4 INTEGER(SIK),PARAMETER,PUBLIC :: MATVEC_SLOTS=10 ! PETSc implementations #ifdef FUTILITY_HAVE_PETSC PUBLIC :: PETScMatrixType Loading Loading @@ -725,6 +725,7 @@ SUBROUTINE matvec_DistrBandedMatrixType(thisMatrix,x,y,t,ul,d,incx,a,b) ALLOCATE(sendResult(thisMatrix%iOffsets(2),MATVEC_SLOTS)) ALLOCATE(tmpProduct(thisMatrix%iOffsets(rank+2)- & thisMatrix%iOffsets(rank+1))) tmpProduct=0.0_SRK #ifdef HAVE_MPI ! On each rank, loop over the chunks held (on diagonal moving down) Loading Loading @@ -783,34 +784,23 @@ SUBROUTINE matvec_DistrBandedMatrixType(thisMatrix,x,y,t,ul,d,incx,a,b) ! Now, take care of locally held data. SELECT TYPE(thisMatrix) TYPE IS(DistributedBlockBandedMatrixType) IF(thisMatrix%chunks(rank+1)%isInit) THEN CALL BLAS_matvec(THISMATRIX=thisMatrix%chunks(rank+1),X=x, & y=tmpProduct,ALPHA=1.0_SRK,BETA=1.0_SRK) ENDIF IF(.NOT. thisMatrix%blockMask) THEN DO k=1,thisMatrix%nlocalBlocks lowIdx=(k-1)*thisMatrix%blockSize+1 highIdx=lowIdx-1+thisMatrix%blockSize CALL matvec_MatrixType(THISMATRIX=thisMatrix%blocks(k),X=x(lowIdx:highIdx), & Y=tmpProduct(lowIdx:highIdx),ALPHA=1.0_SRK,BETA=0.0_SRK) Y=tmpProduct(lowIdx:highIdx),ALPHA=1.0_SRK,BETA=1.0_SRK) ENDDO IF(thisMatrix%chunks(rank+1)%isInit) THEN CALL BLAS_matvec(THISMATRIX=thisMatrix%chunks(rank+1),X=x, & y=tmpProduct,ALPHA=1.0_SRK,BETA=1.0_SRK) ENDIF ELSE IF(thisMatrix%chunks(rank+1)%isInit) THEN CALL BLAS_matvec(THISMATRIX=thisMatrix%chunks(rank+1),X=x, & y=tmpProduct,ALPHA=1.0_SRK,BETA=0.0_SRK) ELSE tmpProduct=0.0_SRK ENDIF ENDIF TYPE IS(DistributedBandedMatrixType) IF(thisMatrix%chunks(rank+1)%isInit) THEN CALL BLAS_matvec(THISMATRIX=thisMatrix%chunks(rank+1),X=x, & y=tmpProduct,ALPHA=1.0_SRK,BETA=0.0_SRK) ELSE tmpProduct=0.0_SRK y=tmpProduct,ALPHA=1.0_SRK,BETA=1.0_SRK) ENDIF CLASS DEFAULT tmpProduct = 0.0_SRK ENDSELECT ! Wait for remaining requests to finish: DO k=1,MATVEC_SLOTS Loading src/PreconditionerTypes.f90 +1 −1 Original line number Diff line number Diff line Loading @@ -758,7 +758,7 @@ SUBROUTINE init_DistributedSOR_PreCondtype(thisPC,A,params) thisPC%A => A !get omega from the parameter list thisPC%omega = 0.0_SRK thisPC%omega = 1.0_SRK IF (params%has('PreCondType->omega')) & CALL params%get('PreCondType->omega',thisPC%omega) Loading unit_tests/testLinearSolver/testLinearSolverParallel.f90 +1 −1 Original line number Diff line number Diff line Loading @@ -99,7 +99,7 @@ SUBROUTINE testIterativeSolve_GMRES() CALL pList%add('LinearSolverType->matType',DISTRIBUTED_BANDED) CALL pList%add('LinearSolverType->A->MatrixType->n',9) CALL pList%add('LinearSolverType->A->MatrixType->m',9) CALL pList%add('LinearSolverType->A->MatrixType->nnz',33) CALL pList%add('LinearSolverType->A->MatrixType->nnz',33_SLK) CALL pList%add('LinearSolverType->x->VectorType->n',9) CALL pList%add('LinearSolverType->b->VectorType->n',9) CALL pList%add('LinearSolverType->PC->PreCondType->pcType','NOPC') Loading unit_tests/testMatrixTypes/testMatrixTypesParallel.f90 +12 −12 Original line number Diff line number Diff line Loading @@ -104,7 +104,7 @@ SUBROUTINE testDistrBandMatrix() thisMatrix%isInit=.TRUE. thisMatrix%n=10 thisMatrix%m=15 thisMatrix%nnz=4 thisMatrix%nnz=4_SLK thisMatrix%isCreated=.TRUE. thisMatrix%isAssembled=.FALSE. thisMatrix%comm=33 Loading Loading @@ -134,7 +134,7 @@ SUBROUTINE testDistrBandMatrix() CALL pList%clear() CALL pList%add('MatrixType->n',10_SNK) CALL pList%add('MatrixType->m',15_SNK) CALL pList%add('MatrixType->nnz',9_SNK) CALL pList%add('MatrixType->nnz',9_SLK) CALL pList%add('MatrixType->MPI_COMM_ID',PE_COMM_WORLD) CALL pList%validate(pList,optListMat) Loading Loading @@ -182,7 +182,7 @@ SUBROUTINE testDistrBandMatrix() CALL pList%clear() CALL pList%add('MatrixType->n',-1_SNK) CALL pList%add('MatrixType->m',10_SNK) CALL pList%add('MatrixType->nnz',9_SNK) CALL pList%add('MatrixType->nnz',9_SLK) CALL pList%add('MatrixType->MPI_COMM_ID',PE_COMM_WORLD) CALL pList%validate(pList,optListMat) CALL thisMatrix%init(pList) !expect exception Loading @@ -193,7 +193,7 @@ SUBROUTINE testDistrBandMatrix() CALL pList%clear() CALL pList%add('MatrixType->n',10_SNK) CALL pList%add('MatrixType->m',-1_SNK) CALL pList%add('MatrixType->nnz',3_SNK) CALL pList%add('MatrixType->nnz',3_SLK) CALL pList%add('MatrixType->MPI_COMM_ID',PE_COMM_WORLD) CALL pList%validate(pList,optListMat) CALL thisMatrix%init(pList) !expect exception Loading @@ -204,7 +204,7 @@ SUBROUTINE testDistrBandMatrix() CALL pList%clear() CALL pList%add('MatrixType->n',10_SNK) CALL pList%add('MatrixType->m',15_SNK) CALL pList%add('MatrixType->nnz',-1_SNK) CALL pList%add('MatrixType->nnz',-1_SLK) CALL pList%add('MatrixType->MPI_COMM_ID',PE_COMM_WORLD) CALL pList%validate(pList,optListMat) CALL thisMatrix%init(pList) !expect exception Loading @@ -223,7 +223,7 @@ SUBROUTINE testDistrBandMatrix() CALL pList%clear() CALL pList%add('MatrixType->n',4_SNK) CALL pList%add('MatrixType->m',5_SNK) CALL pList%add('MatrixType->nnz',9_SNK) CALL pList%add('MatrixType->nnz',9_SLK) CALL pList%add('MatrixType->MPI_COMM_ID',PE_COMM_WORLD) CALL pList%validate(pList,optListMat) CALL thisMatrix%init(pList) Loading Loading @@ -279,7 +279,7 @@ SUBROUTINE testDistrBandMatrix() CALL pList%clear() CALL pList%add('MatrixType->n',4_SNK) CALL pList%add('MatrixType->m',5_SNK) CALL pList%add('MatrixType->nnz',9_SNK) CALL pList%add('MatrixType->nnz',9_SLK) CALL pList%add('MatrixType->MPI_COMM_ID',PE_COMM_WORLD) CALL pList%validate(pList,optListMat) CALL thisMatrix%init(pList) Loading Loading @@ -329,7 +329,7 @@ SUBROUTINE testDistrBandMatrix() CALL pList%clear() CALL pList%add('MatrixType->n',4_SNK) CALL pList%add('MatrixType->m',5_SNK) CALL pList%add('MatrixType->nnz',7_SNK) CALL pList%add('MatrixType->nnz',7_SLK) CALL pList%add('MatrixType->MPI_COMM_ID',PE_COMM_WORLD) CALL pList%validate(pList,optListMat) CALL thisMatrix%init(pList) Loading Loading @@ -373,7 +373,7 @@ SUBROUTINE testDistrBandMatrix() CALL pList%clear() CALL pList%add('MatrixType->n',4_SNK) CALL pList%add('MatrixType->m',4_SNK) CALL pList%add('MatrixType->nnz',7_SNK) CALL pList%add('MatrixType->nnz',7_SLK) CALL pList%add('MatrixType->MPI_COMM_ID',PE_COMM_WORLD) CALL pList%validate(pList,optListMat) CALL thisMatrix%init(pList) Loading Loading @@ -455,7 +455,7 @@ SUBROUTINE testPetscMatrix() CALL pList%clear() CALL pList%add('MatrixType->n',4_SNK) CALL pList%add('MatrixType->nLocal',2_SNK) CALL pList%add('MatrixType->nnz',2_SNK) CALL pList%add('MatrixType->nnz',2_SLK) CALL pList%add('MatrixType->onz',2_SNK) CALL pList%add('MatrixType->matType',SPARSE) CALL pList%add('MatrixType->isSym',.FALSE.) Loading Loading @@ -542,7 +542,7 @@ SUBROUTINE testDistrBlockBandMatrix() COMPONENT_TEST("distBlockBand%init") CALL pList%clear() CALL pList%add('MatrixType->n',12_SNK) CALL pList%add('MatrixType->nnz',9_SNK) CALL pList%add('MatrixType->nnz',9_SLK) CALl pList%add('MatrixType->blockSize',3_SNK) CALL pList%add('MatrixType->MPI_COMM_ID',PE_COMM_WORLD) Loading Loading @@ -580,7 +580,7 @@ SUBROUTINE testDistrBlockBandMatrix() CALL pList%clear() CALL pList%add('MatrixType->n',6_SNK) CALL plist%add('MatrixType->blockSize',2_SNK) CALL pList%add('MatrixType->nnz',10_SNK) CALL pList%add('MatrixType->nnz',10_SLK) CALL pList%add('MatrixType->MPI_COMM_ID',PE_COMM_WORLD) CALL pList%validate(pList,optListMat) CALL thisMatrix%init(pList) Loading Loading
src/LinearSolverTypes.f90 +3 −0 Original line number Diff line number Diff line Loading @@ -607,6 +607,7 @@ SUBROUTINE init_LinearSolverType_Base(solver,Params,A) !set preconditioner IF((solver%solverMethod == GMRES) .OR. (solver%solverMethod == BICGSTAB)) THEN CALL KSPGetPC(solver%ksp,solver%pc,iperr) #if 0 IF(TRIM(PreCondType)=='SOR') THEN CALL PCSetType(solver%pc,PCSOR,iperr) ELSEIF(TRIM(PreCondType)=='JACOBI') THEN Loading Loading @@ -640,6 +641,8 @@ SUBROUTINE init_LinearSolverType_Base(solver,Params,A) ELSE ! Regardless of what else is set, we'll use block-jacobi ILU CALL PCSetType(solver%pc,PCBJACOBI,iperr) ENDIF #endif CALL PCSetType(solver%pc,PCJACOBI,iperr) ENDIF CALL KSPSetFromOptions(solver%ksp,iperr) Loading
src/MatrixTypes.f90 +8 −18 Original line number Diff line number Diff line Loading @@ -111,7 +111,7 @@ PUBLIC :: BandedMatrixType PUBLIC :: DistributedBandedMatrixType PUBLIC :: DistributedBlockBandedMatrixType PUBLIC :: SparseMatrixType INTEGER(SIK),PARAMETER,PUBLIC :: MATVEC_SLOTS=4 INTEGER(SIK),PARAMETER,PUBLIC :: MATVEC_SLOTS=10 ! PETSc implementations #ifdef FUTILITY_HAVE_PETSC PUBLIC :: PETScMatrixType Loading Loading @@ -725,6 +725,7 @@ SUBROUTINE matvec_DistrBandedMatrixType(thisMatrix,x,y,t,ul,d,incx,a,b) ALLOCATE(sendResult(thisMatrix%iOffsets(2),MATVEC_SLOTS)) ALLOCATE(tmpProduct(thisMatrix%iOffsets(rank+2)- & thisMatrix%iOffsets(rank+1))) tmpProduct=0.0_SRK #ifdef HAVE_MPI ! On each rank, loop over the chunks held (on diagonal moving down) Loading Loading @@ -783,34 +784,23 @@ SUBROUTINE matvec_DistrBandedMatrixType(thisMatrix,x,y,t,ul,d,incx,a,b) ! Now, take care of locally held data. SELECT TYPE(thisMatrix) TYPE IS(DistributedBlockBandedMatrixType) IF(thisMatrix%chunks(rank+1)%isInit) THEN CALL BLAS_matvec(THISMATRIX=thisMatrix%chunks(rank+1),X=x, & y=tmpProduct,ALPHA=1.0_SRK,BETA=1.0_SRK) ENDIF IF(.NOT. thisMatrix%blockMask) THEN DO k=1,thisMatrix%nlocalBlocks lowIdx=(k-1)*thisMatrix%blockSize+1 highIdx=lowIdx-1+thisMatrix%blockSize CALL matvec_MatrixType(THISMATRIX=thisMatrix%blocks(k),X=x(lowIdx:highIdx), & Y=tmpProduct(lowIdx:highIdx),ALPHA=1.0_SRK,BETA=0.0_SRK) Y=tmpProduct(lowIdx:highIdx),ALPHA=1.0_SRK,BETA=1.0_SRK) ENDDO IF(thisMatrix%chunks(rank+1)%isInit) THEN CALL BLAS_matvec(THISMATRIX=thisMatrix%chunks(rank+1),X=x, & y=tmpProduct,ALPHA=1.0_SRK,BETA=1.0_SRK) ENDIF ELSE IF(thisMatrix%chunks(rank+1)%isInit) THEN CALL BLAS_matvec(THISMATRIX=thisMatrix%chunks(rank+1),X=x, & y=tmpProduct,ALPHA=1.0_SRK,BETA=0.0_SRK) ELSE tmpProduct=0.0_SRK ENDIF ENDIF TYPE IS(DistributedBandedMatrixType) IF(thisMatrix%chunks(rank+1)%isInit) THEN CALL BLAS_matvec(THISMATRIX=thisMatrix%chunks(rank+1),X=x, & y=tmpProduct,ALPHA=1.0_SRK,BETA=0.0_SRK) ELSE tmpProduct=0.0_SRK y=tmpProduct,ALPHA=1.0_SRK,BETA=1.0_SRK) ENDIF CLASS DEFAULT tmpProduct = 0.0_SRK ENDSELECT ! Wait for remaining requests to finish: DO k=1,MATVEC_SLOTS Loading
src/PreconditionerTypes.f90 +1 −1 Original line number Diff line number Diff line Loading @@ -758,7 +758,7 @@ SUBROUTINE init_DistributedSOR_PreCondtype(thisPC,A,params) thisPC%A => A !get omega from the parameter list thisPC%omega = 0.0_SRK thisPC%omega = 1.0_SRK IF (params%has('PreCondType->omega')) & CALL params%get('PreCondType->omega',thisPC%omega) Loading
unit_tests/testLinearSolver/testLinearSolverParallel.f90 +1 −1 Original line number Diff line number Diff line Loading @@ -99,7 +99,7 @@ SUBROUTINE testIterativeSolve_GMRES() CALL pList%add('LinearSolverType->matType',DISTRIBUTED_BANDED) CALL pList%add('LinearSolverType->A->MatrixType->n',9) CALL pList%add('LinearSolverType->A->MatrixType->m',9) CALL pList%add('LinearSolverType->A->MatrixType->nnz',33) CALL pList%add('LinearSolverType->A->MatrixType->nnz',33_SLK) CALL pList%add('LinearSolverType->x->VectorType->n',9) CALL pList%add('LinearSolverType->b->VectorType->n',9) CALL pList%add('LinearSolverType->PC->PreCondType->pcType','NOPC') Loading
unit_tests/testMatrixTypes/testMatrixTypesParallel.f90 +12 −12 Original line number Diff line number Diff line Loading @@ -104,7 +104,7 @@ SUBROUTINE testDistrBandMatrix() thisMatrix%isInit=.TRUE. thisMatrix%n=10 thisMatrix%m=15 thisMatrix%nnz=4 thisMatrix%nnz=4_SLK thisMatrix%isCreated=.TRUE. thisMatrix%isAssembled=.FALSE. thisMatrix%comm=33 Loading Loading @@ -134,7 +134,7 @@ SUBROUTINE testDistrBandMatrix() CALL pList%clear() CALL pList%add('MatrixType->n',10_SNK) CALL pList%add('MatrixType->m',15_SNK) CALL pList%add('MatrixType->nnz',9_SNK) CALL pList%add('MatrixType->nnz',9_SLK) CALL pList%add('MatrixType->MPI_COMM_ID',PE_COMM_WORLD) CALL pList%validate(pList,optListMat) Loading Loading @@ -182,7 +182,7 @@ SUBROUTINE testDistrBandMatrix() CALL pList%clear() CALL pList%add('MatrixType->n',-1_SNK) CALL pList%add('MatrixType->m',10_SNK) CALL pList%add('MatrixType->nnz',9_SNK) CALL pList%add('MatrixType->nnz',9_SLK) CALL pList%add('MatrixType->MPI_COMM_ID',PE_COMM_WORLD) CALL pList%validate(pList,optListMat) CALL thisMatrix%init(pList) !expect exception Loading @@ -193,7 +193,7 @@ SUBROUTINE testDistrBandMatrix() CALL pList%clear() CALL pList%add('MatrixType->n',10_SNK) CALL pList%add('MatrixType->m',-1_SNK) CALL pList%add('MatrixType->nnz',3_SNK) CALL pList%add('MatrixType->nnz',3_SLK) CALL pList%add('MatrixType->MPI_COMM_ID',PE_COMM_WORLD) CALL pList%validate(pList,optListMat) CALL thisMatrix%init(pList) !expect exception Loading @@ -204,7 +204,7 @@ SUBROUTINE testDistrBandMatrix() CALL pList%clear() CALL pList%add('MatrixType->n',10_SNK) CALL pList%add('MatrixType->m',15_SNK) CALL pList%add('MatrixType->nnz',-1_SNK) CALL pList%add('MatrixType->nnz',-1_SLK) CALL pList%add('MatrixType->MPI_COMM_ID',PE_COMM_WORLD) CALL pList%validate(pList,optListMat) CALL thisMatrix%init(pList) !expect exception Loading @@ -223,7 +223,7 @@ SUBROUTINE testDistrBandMatrix() CALL pList%clear() CALL pList%add('MatrixType->n',4_SNK) CALL pList%add('MatrixType->m',5_SNK) CALL pList%add('MatrixType->nnz',9_SNK) CALL pList%add('MatrixType->nnz',9_SLK) CALL pList%add('MatrixType->MPI_COMM_ID',PE_COMM_WORLD) CALL pList%validate(pList,optListMat) CALL thisMatrix%init(pList) Loading Loading @@ -279,7 +279,7 @@ SUBROUTINE testDistrBandMatrix() CALL pList%clear() CALL pList%add('MatrixType->n',4_SNK) CALL pList%add('MatrixType->m',5_SNK) CALL pList%add('MatrixType->nnz',9_SNK) CALL pList%add('MatrixType->nnz',9_SLK) CALL pList%add('MatrixType->MPI_COMM_ID',PE_COMM_WORLD) CALL pList%validate(pList,optListMat) CALL thisMatrix%init(pList) Loading Loading @@ -329,7 +329,7 @@ SUBROUTINE testDistrBandMatrix() CALL pList%clear() CALL pList%add('MatrixType->n',4_SNK) CALL pList%add('MatrixType->m',5_SNK) CALL pList%add('MatrixType->nnz',7_SNK) CALL pList%add('MatrixType->nnz',7_SLK) CALL pList%add('MatrixType->MPI_COMM_ID',PE_COMM_WORLD) CALL pList%validate(pList,optListMat) CALL thisMatrix%init(pList) Loading Loading @@ -373,7 +373,7 @@ SUBROUTINE testDistrBandMatrix() CALL pList%clear() CALL pList%add('MatrixType->n',4_SNK) CALL pList%add('MatrixType->m',4_SNK) CALL pList%add('MatrixType->nnz',7_SNK) CALL pList%add('MatrixType->nnz',7_SLK) CALL pList%add('MatrixType->MPI_COMM_ID',PE_COMM_WORLD) CALL pList%validate(pList,optListMat) CALL thisMatrix%init(pList) Loading Loading @@ -455,7 +455,7 @@ SUBROUTINE testPetscMatrix() CALL pList%clear() CALL pList%add('MatrixType->n',4_SNK) CALL pList%add('MatrixType->nLocal',2_SNK) CALL pList%add('MatrixType->nnz',2_SNK) CALL pList%add('MatrixType->nnz',2_SLK) CALL pList%add('MatrixType->onz',2_SNK) CALL pList%add('MatrixType->matType',SPARSE) CALL pList%add('MatrixType->isSym',.FALSE.) Loading Loading @@ -542,7 +542,7 @@ SUBROUTINE testDistrBlockBandMatrix() COMPONENT_TEST("distBlockBand%init") CALL pList%clear() CALL pList%add('MatrixType->n',12_SNK) CALL pList%add('MatrixType->nnz',9_SNK) CALL pList%add('MatrixType->nnz',9_SLK) CALl pList%add('MatrixType->blockSize',3_SNK) CALL pList%add('MatrixType->MPI_COMM_ID',PE_COMM_WORLD) Loading Loading @@ -580,7 +580,7 @@ SUBROUTINE testDistrBlockBandMatrix() CALL pList%clear() CALL pList%add('MatrixType->n',6_SNK) CALL plist%add('MatrixType->blockSize',2_SNK) CALL pList%add('MatrixType->nnz',10_SNK) CALL pList%add('MatrixType->nnz',10_SLK) CALL pList%add('MatrixType->MPI_COMM_ID',PE_COMM_WORLD) CALL pList%validate(pList,optListMat) CALL thisMatrix%init(pList) Loading