VerifyMigration Subroutine

public subroutine VerifyMigration(decomp, Np, nvar, nOld, nLocalOld, uLocal, wFirst, wLast, uWin)

Cross-check a migrated window against the v1 allgathered global old field, bit for bit, over the whole window. Diagnostic only; gated by SELF_AMR_MIGRATE_VERIFY. Bit-identity is the design guarantee (the same numbers routed differently, then fed to the same operators in the same order), so any difference at all is a routing defect and stops the run.

Arguments

TypeIntentOptionalAttributesName
type(DomainDecomposition), intent(in) :: decomp
integer, intent(in) :: Np
integer, intent(in) :: nvar
integer, intent(in) :: nOld
integer, intent(in) :: nLocalOld
real(kind=prec), intent(in) :: uLocal(1:Np,1:Np,1:nLocalOld,1:nvar)
integer, intent(in) :: wFirst
integer, intent(in) :: wLast
real(kind=prec), intent(in) :: uWin(1:Np,1:Np,wFirst:wLast,1:nvar)

Calls

proc~~verifymigration~~CallsGraph proc~verifymigration VerifyMigration proc~allgatherperelemreals AllgatherPerElemReals proc~verifymigration->proc~allgatherperelemreals mpi_allgatherv mpi_allgatherv proc~allgatherperelemreals->mpi_allgatherv

Called by

proc~~verifymigration~~CalledByGraph proc~verifymigration VerifyMigration proc~adapt_amrcontroller2d Adapt_AMRController2D proc~adapt_amrcontroller2d->proc~verifymigration

Contents

Source Code


Source Code

  subroutine VerifyMigration(decomp,Np,nvar,nOld,nLocalOld,uLocal,wFirst,wLast,uWin)
    !! Cross-check a migrated window against the v1 allgathered global old field, bit for bit,
    !! over the whole window. Diagnostic only; gated by SELF_AMR_MIGRATE_VERIFY. Bit-identity is
    !! the design guarantee (the same numbers routed differently, then fed to the same operators
    !! in the same order), so any difference at all is a routing defect and stops the run.
    implicit none
    type(DomainDecomposition),intent(in) :: decomp
    integer,intent(in) :: Np
    integer,intent(in) :: nvar
    integer,intent(in) :: nOld
    integer,intent(in) :: nLocalOld
    real(prec),intent(in) :: uLocal(1:Np,1:Np,1:nLocalOld,1:nvar)
    integer,intent(in) :: wFirst
    integer,intent(in) :: wLast
    real(prec),intent(in) :: uWin(1:Np,1:Np,wFirst:wLast,1:nvar)
    ! Local
    integer :: iv,e,i,j,nbad
    real(prec),allocatable :: uRef(:,:,:,:)

    allocate(uRef(1:Np,1:Np,1:nOld,1:nvar))
    do iv = 1,nvar
      call AllgatherPerElemReals(decomp,Np*Np,uLocal(:,:,:,iv),uRef(:,:,:,iv))
    enddo

    nbad = 0
    do iv = 1,nvar
      do e = wFirst,wLast
        do j = 1,Np
          do i = 1,Np
            if(uWin(i,j,e,iv) /= uRef(i,j,e,iv)) then
              if(nbad == 0) then
                print*,"MIGRATE_VERIFY mismatch on rank",decomp%rankId, &
                  " old element",e," variable",iv," node",i,j, &
                  " window value",uWin(i,j,e,iv)," gathered value",uRef(i,j,e,iv)
              endif
              nbad = nbad+1
            endif
          enddo
        enddo
      enddo
    enddo

    deallocate(uRef)

    if(nbad > 0) then
      print*,__FILE__,':',__LINE__, &
        ' : Error : the migrated window differs from the allgathered old field in ',nbad, &
        ' values.'
      stop 1
    endif

    print*,"MIGRATE_VERIFY rank",decomp%rankId," window",wFirst,wLast," matches the gather"

  endsubroutine VerifyMigration