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:Np,1:nLocalOld,1:nvar)
integer, intent(in) :: wFirst
integer, intent(in) :: wLast
real(kind=prec), intent(in) :: uWin(1:Np,1:Np,1:Np,wFirst:wLast,1:nvar)

Calls

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

Called by

proc~~verifymigration~2~~CalledByGraph proc~verifymigration~2 VerifyMigration proc~adapt_amrcontroller3d Adapt_AMRController3D proc~adapt_amrcontroller3d->proc~verifymigration~2

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:Np,1:nLocalOld,1:nvar)
    integer,intent(in) :: wFirst
    integer,intent(in) :: wLast
    real(prec),intent(in) :: uWin(1:Np,1:Np,1:Np,wFirst:wLast,1:nvar)
    ! Local
    integer :: iv,e,i,j,k,nbad
    real(prec),allocatable :: uRef(:,:,:,:,:)

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

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