Retire one decomposition from the process-wide lifecycle bookkeeping and, if it was the last one and SELF initialized MPI, finalize.
Shared by the CPU and GPU DomainDecomposition Free implementations.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| logical, | intent(inout) | :: | ownsMpi | |||
| integer, | intent(in) | :: | rankId | |||
| integer, | intent(in) | :: | nRanks |
subroutine ReleaseMPI(ownsMpi,rankId,nRanks)
!! Retire one decomposition from the process-wide lifecycle bookkeeping and,
!! if it was the last one and SELF initialized MPI, finalize.
!!
!! Shared by the CPU and GPU DomainDecomposition Free implementations.
implicit none
logical,intent(inout) :: ownsMpi
integer,intent(in) :: rankId
integer,intent(in) :: nRanks
! Local
integer :: ierror
logical :: mpiIsFinalized
ownsMpi = .false.
nLiveDecomps = max(nLiveDecomps-1,0)
! Other meshes are still live; they need MPI to stay up.
if(nLiveDecomps > 0) return
call MPI_Finalized(mpiIsFinalized,ierror)
if(selfInitializedMpi .and. .not. mpiIsFinalized) then
print*,__FILE__," : Rank ",rankId+1,"/",nRanks," checking out."
call MPI_FINALIZE(ierror)
endif
selfInitializedMpi = .false.
endsubroutine ReleaseMPI