ESMF_TestResultsGather Subroutine

public subroutine ESMF_TestResultsGather(vm, localPet, petCount, testResults, file, line, unit, rc)

Arguments

Type IntentOptional Attributes Name
type(ESMF_VM), intent(in) :: vm
integer, intent(in) :: localPet
integer, intent(in) :: petCount
integer, intent(in) :: testResults
character(len=*), intent(in) :: file
integer, intent(in) :: line
integer, intent(in), optional :: unit
integer, intent(out), optional :: rc

Calls

proc~~esmf_testresultsgather~~CallsGraph proc~esmf_testresultsgather ESMF_TestResultsGather c_esmc_printpassflush c_esmc_printpassflush proc~esmf_testresultsgather->c_esmc_printpassflush interface~esmf_vmgather ESMF_VMGather proc~esmf_testresultsgather->interface~esmf_vmgather proc~esmf_vmbarrier ESMF_VMBarrier proc~esmf_testresultsgather->proc~esmf_vmbarrier proc~esmf_vmgatherflogical2d ESMF_VMGatherFLogical2D interface~esmf_vmgather->proc~esmf_vmgatherflogical2d proc~esmf_vmgatheri4 ESMF_VMGatherI4 interface~esmf_vmgather->proc~esmf_vmgatheri4 proc~esmf_vmgatheri8 ESMF_VMGatherI8 interface~esmf_vmgather->proc~esmf_vmgatheri8 proc~esmf_vmgatherlogical ESMF_VMGatherLogical interface~esmf_vmgather->proc~esmf_vmgatherlogical proc~esmf_vmgatherr4 ESMF_VMGatherR4 interface~esmf_vmgather->proc~esmf_vmgatherr4 proc~esmf_vmgatherr8 ESMF_VMGatherR8 interface~esmf_vmgather->proc~esmf_vmgatherr8 c_esmc_vmbarrier c_esmc_vmbarrier proc~esmf_vmbarrier->c_esmc_vmbarrier proc~esmf_imerr ESMF_IMErr proc~esmf_vmbarrier->proc~esmf_imerr proc~esmf_logfounderror ESMF_LogFoundError proc~esmf_vmbarrier->proc~esmf_logfounderror proc~esmf_vmgetcurrent ESMF_VMGetCurrent proc~esmf_vmbarrier->proc~esmf_vmgetcurrent proc~esmf_vmgetinit ESMF_VMGetInit proc~esmf_vmbarrier->proc~esmf_vmgetinit proc~esmf_imerr->proc~esmf_logfounderror proc~esmf_initcheckdeep ESMF_InitCheckDeep proc~esmf_imerr->proc~esmf_initcheckdeep esmf_breakpoint esmf_breakpoint proc~esmf_logfounderror->esmf_breakpoint proc~esmf_logrc2msg ESMF_LogRc2Msg proc~esmf_logfounderror->proc~esmf_logrc2msg proc~esmf_logwrite ESMF_LogWrite proc~esmf_logfounderror->proc~esmf_logwrite proc~esmf_vmgatherflogical2d->proc~esmf_imerr proc~esmf_vmgatherflogical2d->proc~esmf_logfounderror proc~esmf_vmgatherflogical2d->proc~esmf_vmgetinit interface~c_esmc_vmgather c_ESMC_VMGather proc~esmf_vmgatherflogical2d->interface~c_esmc_vmgather interface~c_esmc_vmgathernb c_ESMC_VMGatherNB proc~esmf_vmgatherflogical2d->interface~c_esmc_vmgathernb proc~esmf_vmgatheri4->proc~esmf_imerr proc~esmf_vmgatheri4->proc~esmf_logfounderror proc~esmf_vmgatheri4->proc~esmf_vmgetinit proc~esmf_vmgatheri4->interface~c_esmc_vmgather proc~esmf_vmgatheri4->interface~c_esmc_vmgathernb proc~esmf_vmgatheri8->proc~esmf_imerr proc~esmf_vmgatheri8->proc~esmf_logfounderror proc~esmf_vmgatheri8->proc~esmf_vmgetinit proc~esmf_vmgatheri8->interface~c_esmc_vmgather proc~esmf_vmgatheri8->interface~c_esmc_vmgathernb proc~esmf_vmgatherlogical->proc~esmf_imerr proc~esmf_vmgatherlogical->proc~esmf_logfounderror proc~esmf_vmgatherlogical->proc~esmf_vmgetinit proc~esmf_vmgatherlogical->interface~c_esmc_vmgather proc~esmf_vmgatherlogical->interface~c_esmc_vmgathernb proc~esmf_vmgatherr4->proc~esmf_imerr proc~esmf_vmgatherr4->proc~esmf_logfounderror proc~esmf_vmgatherr4->proc~esmf_vmgetinit proc~esmf_vmgatherr4->interface~c_esmc_vmgather proc~esmf_vmgatherr4->interface~c_esmc_vmgathernb proc~esmf_vmgatherr8->proc~esmf_imerr proc~esmf_vmgatherr8->proc~esmf_logfounderror proc~esmf_vmgatherr8->proc~esmf_vmgetinit proc~esmf_vmgatherr8->interface~c_esmc_vmgather proc~esmf_vmgatherr8->interface~c_esmc_vmgathernb proc~esmf_vmgetcurrent->proc~esmf_logfounderror c_esmc_vmgetcurrent c_esmc_vmgetcurrent proc~esmf_vmgetcurrent->c_esmc_vmgetcurrent c_esmc_loggeterrormsg c_esmc_loggeterrormsg proc~esmf_logrc2msg->c_esmc_loggeterrormsg c_esmc_vmwtime c_esmc_vmwtime proc~esmf_logwrite->c_esmc_vmwtime proc~esmf_logclose ESMF_LogClose proc~esmf_logwrite->proc~esmf_logclose proc~esmf_logflush ESMF_LogFlush proc~esmf_logwrite->proc~esmf_logflush proc~esmf_logopenfile ESMF_LogOpenFile proc~esmf_logwrite->proc~esmf_logopenfile proc~esmf_utiliounitflush ESMF_UtilIOUnitFlush proc~esmf_logwrite->proc~esmf_utiliounitflush proc~esmf_utilstring2array ESMF_UtilString2Array proc~esmf_logwrite->proc~esmf_utilstring2array

Called by

proc~~esmf_testresultsgather~~CalledByGraph proc~esmf_testresultsgather ESMF_TestResultsGather proc~esmf_testglobal ESMF_TestGlobal proc~esmf_testglobal->proc~esmf_testresultsgather program~esmf_test_harness esmf_test_harness program~esmf_test_harness->proc~esmf_testglobal

Source Code

      subroutine ESMF_TestResultsGather(vm, localPet, petCount, testResults, &
        file, line, unit,  rc)

! !ARGUMENTS:
      type(ESMF_VM), intent(in) :: vm     ! the vm of this pet
      integer, intent(in) :: localPet     ! number of this pet
      integer, intent(in) :: petCount     ! number of pets
      integer, intent(in) :: testResults  ! test results for this pet
      character(*), intent(in) :: file  ! test file name
      integer, intent(in) :: line           ! test file line number
      integer, intent(in), optional :: unit ! additional output unit number
      integer, intent(out), optional :: rc ! return code

! !DESCRIPTION:
!     The gatherPet gathers the test results, PASS/FAIl, from all other
!     Pets and prints out a PASS/FAIL Message . This subroutine should
!     be called at the end of system tests and use test cases.
!
!EOP
!-------------------------------------------------------------------------------
      character(ESMF_MAXSTR) :: msg
!      character(ESMF_MAXSTR) :: failMsg
      integer, allocatable:: array1(:), array2(:)
      integer:: finalrc, gatherRoot, i, localrc
      character(16) :: linestr

      write (linestr,*) line
      linestr = adjustl (linestr)

      allocate(array1(petCount))
      allocate(array2(1))
      ! Store test results
      array2(1) = testResults
      gatherRoot = 0

      ! Don't Gather until all pets are done
      call ESMF_VMBarrier(vm, rc=localrc)
      if (localrc .ne. ESMF_SUCCESS) then
          write(msg, *) " FAIL  ESMF_VMBarrier failed.  Error code ", localrc
          print *, trim(msg)
          if (present(unit)) write(unit, *) trim(msg)
          if (present(rc)) rc = localrc
          return
      endif

      

      ! Gather test results
      call ESMF_VMGather(vm, sendData=array2, recvData=array1, count=1, &
      rootPet=gatherRoot, rc=localrc)
      if (localrc .ne. ESMF_SUCCESS) then
          write(msg, *) " FAIL  ESMF_VMGather failed.  Error code ", localrc
          print *, trim(msg)
          if (present(unit)) write(unit, *) trim(msg)
          if (present(rc)) rc = localrc
          return
      endif


      ! assume success
      finalrc=ESMF_SUCCESS

      ! The gather pet checks the results and prints out PASS/FAIL message.
      if (localPet==gatherRoot) then
        do i=1, petCount
                if (array1(i).EQ.ESMF_FAILURE) finalrc = ESMF_FAILURE
        enddo
        if (finalrc.EQ.ESMF_SUCCESS) then
            print *, " PASS: ", trim(file), ' ', trim (linestr)
            call c_ESMC_PrintPassFlush(); ! print and flush out of C++
        else
            print *, " FAIL: ", trim(file), ' ', trim (linestr)
        endif
      endif
      deallocate(array1)
      deallocate(array2)

      ! Don't end test until all pets are done
      call ESMF_VMBarrier(vm, rc=localrc)
      if (localrc .ne. ESMF_SUCCESS) then
          write(msg, *) " FAIL  ESMF_VMBarrier failed.  Error code ", localrc
          print *, trim(msg)
          if (present(unit)) write(unit, *) trim(msg)
          if (present(rc)) rc = localrc
          return
      endif
      
      if (present(rc)) rc=ESMF_SUCCESS
                                                 
      end subroutine ESMF_TestResultsGather