Commit 25214ef5 authored by Matt Kabelitz's avatar Matt Kabelitz Committed by Sooyoung Choi
Browse files

WIP nnz changes and force Jacobi

parent ff083499
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -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
@@ -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)

+8 −18
Original line number Diff line number Diff line
@@ -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
@@ -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)
@@ -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
+1 −1
Original line number Diff line number Diff line
@@ -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)

+1 −1
Original line number Diff line number Diff line
@@ -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')
+12 −12
Original line number Diff line number Diff line
@@ -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
@@ -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)
@@ -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
@@ -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
@@ -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
@@ -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)
@@ -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)
@@ -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)
@@ -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)
@@ -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.)
@@ -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)

@@ -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